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.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| secondwind-0.5.1-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details |
| secondwind-0.5.1-py3-none-manylinux_2_34_x86_64.whl | Python 3 | none | Linux glibc 2.34+ x86-64 | Details |
| secondwind-0.5.1-py3-none-manylinux_2_34_aarch64.whl | Python 3 | none | Linux glibc 2.34+ ARM64 | Details |
| secondwind-0.5.1-py3-none-macosx_11_0_x86_64.whl | Python 3 | none | macOS 11.0+ x86-64 | Details |
| secondwind-0.5.1-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.5.1-py3-none-win_amd64.whl
| Download URL | secondwind-0.5.1-py3-none-win_amd64.whl |
|---|---|
| Size | 16.0 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
39f77173c6d635a03684dab471be6e2de76339cb38c0c577e4a0011863675a75
|
|
BLAKE2b-256 checksum How to use checksums |
341409ef2765fdb3590c0ff4d6678c481245623b94562e72bbb4352088e7b619
|
| 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 logRelease files / secondwind-0.5.1-py3-none-manylinux_2_34_x86_64.whl
| Download URL | secondwind-0.5.1-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 |
43d76b09e51edfaeb7ac6ec5a46e4b8898c080c21bb9d01ad8bd1a3c5ddb6a0e
|
|
BLAKE2b-256 checksum How to use checksums |
11a011548bcb0faae448e394e655e6bf3c5031e33051053e154d8269053a4d92
|
| 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 logRelease files / secondwind-0.5.1-py3-none-manylinux_2_34_aarch64.whl
| Download URL | secondwind-0.5.1-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 |
17075a111334819b3fabb05fc7548dda993463cbd1c51d35c1873dbc28b79676
|
|
BLAKE2b-256 checksum How to use checksums |
ca36dfcb28cf102905f51ab00931cddfc9c78d170b649c1840f2fd9b5802028f
|
| 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 logRelease files / secondwind-0.5.1-py3-none-macosx_11_0_x86_64.whl
| Download URL | secondwind-0.5.1-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 |
3c9eada811aa9f2ef85eba3c999186a8737bdee93abc7b5f3da7edf078392cb3
|
|
BLAKE2b-256 checksum How to use checksums |
f9dbcfc64992cc1ac71ae7ef77ff79327496401ff067599e4455aa245ceeb8c3
|
| 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 logRelease files / secondwind-0.5.1-py3-none-macosx_11_0_universal2.whl
| Download URL | secondwind-0.5.1-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 |
a5709699a171a6bd747a2165a3d9f1f4c35cbac555d2dfdd06e6f08db9b3c7e1
|
|
BLAKE2b-256 checksum How to use checksums |
eb502b2cf505d0a3a9675ad43b0748010977a4584ce11aa950269b771d7031d3
|
| 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 logSecurity for secondwind 0.5.1
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.
Attestation for secondwind-0.5.1-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 logA 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.