Skip to main content

secondwind

Lossless, provable, composable LLM tool-output compression, in-process.

import secondwind

session = secondwind.Session()
out = session.rewrite(request)          # compress a whole request's tool outputs
print(out["stats"])                     # tokens saved
secondwind.compress(block)              # or compress a single tool-output block

# one-line LiteLLM integration:
import litellm
from secondwind.litellm import SecondwindCallback
litellm.callbacks = [SecondwindCallback()]

# ASGI gateway (Starlette / FastAPI): rewrite request bodies before you forward them upstream
from secondwind.asgi import SecondwindMiddleware
app.add_middleware(SecondwindMiddleware)

# LangChain (LCEL): compress tool outputs before the model call
from secondwind.langchain import compress_tool_outputs
chain = compress_tool_outputs() | model

# LangGraph: compress the tool outputs an agent loop re-sends before each model call
from secondwind.langchain import compress_pre_model_hook
agent = create_react_agent(model, tools, pre_model_hook=compress_pre_model_hook())

# Agno: a lossless drop-in for its LLM-based tool-result compression
from secondwind.agno import SecondwindCompressionManager
agent = Agent(model=..., compress_tool_results=True,
              compression_manager=SecondwindCompressionManager(compress_tool_results=True))

# Strands Agents: compress tool results as they are produced
from secondwind.strands import SecondwindHooks
agent = Agent(model=..., tools=[...], hooks=[SecondwindHooks()])

# Cursor: a postToolUse hook that rewrites MCP tool output the model sees
#   ~/.cursor/hooks.json -> { "version": 1, "hooks": { "postToolUse": [ { "command": "python -m secondwind.cursor" } ] } }
# Bring your own codec: it competes in the best-of-N search, and secondwind proves
# decode(encode(x)) == x for every block, so a wrong codec is dropped, never shipped.
class MyCodec:
    def encode(self, text): ...   # -> str | None
    def decode(self, wire): ...   # -> str | None
session = secondwind.Session(codec=MyCodec())     # reckless is safe: proven per-instance
session = secondwind.Session(proposers=False)     # turn the aggressive search off

# Offload big blocks and recover them on demand, or back the store with Redis / S3 / a database.
session = secondwind.Session(resolver="resolve", offload_dir="~/.secondwind/offload")
session = secondwind.Session(store=MyStore())     # any object with put(id, value) and get(id)

Every result is lossless: an inline wire is independently verifiable with secondwind.verify(wire, hash), and a large block is offloaded to a recoverable marker. The native library is bundled, so there is no build step and no model download.

Metadata

Release files for secondwind 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for secondwind 0.4.0
File
secondwind-0.4.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
secondwind-0.4.0-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
secondwind-0.4.0-py3-none-manylinux_2_34_aarch64.whl Python 3 none Linux glibc 2.34+ ARM64 Details
secondwind-0.4.0-py3-none-macosx_11_0_x86_64.whl Python 3 none macOS 11.0+ x86-64 Details
secondwind-0.4.0-py3-none-macosx_11_0_universal2.whl Python 3 none macOS 11.0+ universal2 (ARM64, x86-64) Details

Total release size: 80.4 MB

Release files / secondwind-0.4.0-py3-none-win_amd64.whl

Download URL secondwind-0.4.0-py3-none-win_amd64.whl
Size 16.0 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
3fe7755b90b697ebe68fe1e994e486a6992a84109f80c4fb6b9f0ebf0abcf038
BLAKE2b-256 checksum
How to use checksums
c8d785af1de1d2ccb300e54d0ef430a93888d2741d51e7e6fb9fa338ce63e6b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / secondwind-0.4.0-py3-none-manylinux_2_34_x86_64.whl

Download URL secondwind-0.4.0-py3-none-manylinux_2_34_x86_64.whl
Size 16.1 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e5be2c58cce370b7192b2c676378fbbd3f4c2c5f134ae7812eb1ce347584cd3f
BLAKE2b-256 checksum
How to use checksums
9520fd2e9eeae02651138c3870132396976863cdf5f1c3f220abd1f9b8298ef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / secondwind-0.4.0-py3-none-manylinux_2_34_aarch64.whl

Download URL secondwind-0.4.0-py3-none-manylinux_2_34_aarch64.whl
Size 16.1 MB
Tags Linux glibc 2.34+ ARM64 Python 3
SHA-256 checksum
How to use checksums
270fa305948b774ad8810427cbbae3512c01b9e74af0333dae1b8aaaf3443daf
BLAKE2b-256 checksum
How to use checksums
315443f41a32851531209d731c6170c9434d67bfe4506c3a636b4f4ce2e7ecdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / secondwind-0.4.0-py3-none-macosx_11_0_x86_64.whl

Download URL secondwind-0.4.0-py3-none-macosx_11_0_x86_64.whl
Size 16.0 MB
Tags Python 3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
1c55a7d0b9fc79540317242771acf2ea300de3a986d536347c894f785f2c9932
BLAKE2b-256 checksum
How to use checksums
c9453772be848fd631b1cf37aad696ef222620308ead321a31c44180707736b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Release files / secondwind-0.4.0-py3-none-macosx_11_0_universal2.whl

Download URL secondwind-0.4.0-py3-none-macosx_11_0_universal2.whl
Size 16.1 MB
Tags Python 3 macOS 11.0+ universal2 (ARM64, x86-64)
SHA-256 checksum
How to use checksums
f3e4915a91cb0b79853a03909c4e9d68548ceee1970d4417c050530c2816773e
BLAKE2b-256 checksum
How to use checksums
7421943832301eccb94bec206c2d18bb7052138bb5bc4b7b515e1f9377e392bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

Security for secondwind 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for secondwind-0.4.0-py3-none-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page