Skip to main content

Sovara for LangChain (Python)

Record LangChain and LangGraph model and tool calls in Sovara, and add relevant lessons to each model request.

uv add "sovara-langchain[agent]"
# or: pip install "sovara-langchain[agent]"

Omit [agent] if you only use wrap_chat_model.

Use

Inside a Sovara trace, pick one per model:

import sovara_langchain
from sovara_langchain import SovaraMiddleware, wrap_chat_model

# create_agent: add the middleware last. It records model and tool calls.
agent = create_agent(model, tools, middleware=[*other_middleware, SovaraMiddleware()])

# Anything else (LangGraph nodes, create_react_agent, with_structured_output): wrap the model,
# and call instrument_tools() once at startup to record tool calls too.
sovara_langchain.instrument_tools()
model = wrap_chat_model(ChatOpenAI(model="gpt-5.4")).bind_tools(tools)
  • instrument_tools() also records tools called directly, without a model-generated tool call.
  • Lessons are one temporary user message at the end of the request. The agent's messages and graph state are never changed.
  • Outside a trace, calls pass through unrecorded. If Sovara is unavailable, calls still run.
  • Last in the list, the middleware records the model, prompt and messages that other middleware settled on, and each retry by other middleware as its own step.
  • Don't use the middleware and the wrapper for the same model.
  • Model calls are recorded as conversations, so Rerun is not available for them.

Requires langchain-core 1.x (langchain 1.1+ for the middleware).

License

MIT.

Metadata

Release files for sovara-langchain 0.1.1

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

Source distribution (sdist)

Source distribution for sovara-langchain 0.1.1
File Size Uploaded Provenance Actions
sovara_langchain-0.1.1.tar.gz 15.3 kB Without provenance Details for sovara_langchain-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sovara-langchain 0.1.1
File Interpreter ABI Platform Actions
sovara_langchain-0.1.1-py3-none-any.whl Python 3 none any Details for sovara_langchain-0.1.1-py3-none-any.whl

Total release size: 30.7 kB

Release files / sovara_langchain-0.1.1.tar.gz

Download URL sovara_langchain-0.1.1.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2e2c89be93444ed38474559da7ba7cce28612b298e712230e858bb062634dd1e
BLAKE2b-256 checksum
How to use checksums
a581f455988b78647ab401c920c316fe4f50700b12395e24dbd4381feac9d674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / sovara_langchain-0.1.1-py3-none-any.whl

Download URL sovara_langchain-0.1.1-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c8daeca640a30666501b3a4cb1f42546d391edc4dd2ff3339e26ce65c1e6a0b
BLAKE2b-256 checksum
How to use checksums
545889c0713f0892e9910b4e8b79a2ccb48656f4b54de60ce763696a4d554fd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.8 {"installer":{"name":"uv","version":"0.13.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for sovara-langchain 0.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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