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.0

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.0
File Size Uploaded Provenance Actions
sovara_langchain-0.1.0.tar.gz 15.3 kB Without provenance Details for sovara_langchain-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 30.7 kB

Release files / sovara_langchain-0.1.0.tar.gz

Download URL sovara_langchain-0.1.0.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ed789901c8da76747b8028bca81641b0c912d0bdc1e482353db5b29d29e1b546
BLAKE2b-256 checksum
How to use checksums
2761d68b56dacc8050a90480989a68a7cf29a3ecc2b6a1f7e4a52a588d03b25f
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.0-py3-none-any.whl

Download URL sovara_langchain-0.1.0-py3-none-any.whl
Size 15.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
27b424aa9a53237003b048061a2d771a471d0939a6046b351171c41769387736
BLAKE2b-256 checksum
How to use checksums
b7c26490ae1aeab56953569ca8350bf6e4cb4fa2f5e485d4f267d351efdf540c
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.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.

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