Sovara Python SDK
The sovara package instruments Python agents so Sovara can record LLM calls,
tool calls, logs, and custom trace spans.
Install it in the Python environment where your agent runs:
python -m pip install sovara
Or with uv:
uv add sovara
Create a project-bound client and use it to record runs:
from sovara import SovaraClient
sovara_client = SovaraClient(project_name="My Project")
with sovara_client.run("support-agent"):
run_agent()
For a remote/headless agent, pass the exec server and project token directly:
import os
sovara_client = SovaraClient(
project_name="My Project",
base_url="https://exec.example.com",
agent_token=os.environ["SOVARA_AGENT_TOKEN"],
)
http_client= optionally accepts a caller-owned synchronous httpx.Client
for custom proxy, certificate, or transport behavior. Sovara does not close it.
The terminal command is distributed separately as the native Sovara CLI. Install
that CLI for commands such as sovara record, sovara status, and
sovara probe.
Documentation: https://docs.sovara-labs.com
Explicit conversation turns
run() opens a recording session; it does not create an implicit turn. Declare
interactions with scoped turn() blocks. Setup, cleanup, and other work outside
those blocks are still captured, with no turn membership.
with sovara_client.run("conversation", run_key="chat-123"):
setup()
with sovara_client.turn(turn_input="Hi."):
respond()
with sovara_client.turn(turn_input="Another question."):
respond()
cleanup()
For one recording per interaction, reuse the same project-scoped key and declare the interaction explicitly:
for message in messages:
with sovara_client.run("conversation", run_key="chat-123"):
with sovara_client.turn(turn_input=message):
respond()
Both run() and turn() support async with. A turn block returns its new
turn_id, or None when the outer run is operating without capture. Exiting the
block restores the previous context; it sends no close request and does not
rotate the recording credential. Empty blocks remain visible as empty turns.
turn_input accepts only str or None, preserves empty strings, Unicode,
spaces, and line breaks exactly, and describes this interaction. Fields written
with log(run_key=..., run_input=..., run_output=...) describe the whole run.
Same-run nested turns and using a different client inside the run are rejected.
A subrun's invocation step belongs to the parent's turn, while the child starts
without a turn and may declare its own. Async tasks inherit their originating
turn, and with_context() propagates it to threads; another block never reassigns
that work. Await all tasks and consume streams before leaving the outer recording.
Concurrent turn sections are logical groups, not a total timeline.
This Python SDK requires runner-api 3. Upgrade app-server and exec-server together;
a server offering only versions 1/2 or no compatibility metadata is rejected before
the agent code starts. An unreachable server retains the existing no-capture
fallback, including scoped turn blocks.
Explicit logging and eval runs
An eval run represents one evaluation execution, grouping agent runs and their
aggregate results. create_eval_run() creates its record; your code executes
the evaluation and logs the results.
eval_run_id = sovara_client.create_eval_run()
with sovara_client.run(eval_run_id=eval_run_id) as run_key:
sovara_client.log(run_key=run_key, sample_id="case-1", run_input=question, groundtruth=expected_answer)
answer = agent(question)
sovara_client.log(
run_key=run_key, eval_run_id=eval_run_id, run_output=answer,
llm_judge_output="Matches the reference.", llm_judge_is_correct=True,
)
sovara_client.log(eval_run_id=eval_run_id, accuracy=1.0, sample_count=1)
Pass run_key to log run fields, eval_run_id for fields on an eval run, or both
to verify the run belongs to that eval run while logging results. Set ownership with
run(eval_run_id=...) before execution; it cannot change afterward. Subruns inherit
the owner. Use a fresh run key per evaluation execution and a stable sample_id
for the same case across evaluations. Targets must already exist and are always explicit,
even inside a run context. groundtruth is the run's ground-truth annotation, the
same value you edit in the app; log it while the run is active so its analysis
uses it.
Custom fields accept strict booleans, integers (between -253 and 253), finite
floats, and strings.
Omitted fields remain unchanged; explicit None is rejected. The former
log_input, log_output, and log_metrics methods were removed; use log().
Eval run samples show the run's current fields; they are not snapshots. The application supplies judgments and aggregate metrics, and those metrics are not recalculated automatically. Evaluation executions appear under Evaluations; only online executions appear in Runs.
Explicit logging raises on failure. If recording is unavailable, the context
can yield None; do not pass that as a logging target. A successful log confirms
database commit, but a timeout leaves the write outcome unknown and is not
automatically retried.
Metadata
Release files for sovara 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sovara-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for sovara-0.6.0-py3-none-any.whl |
Release files / sovara-0.6.0-py3-none-any.whl
| Download URL | sovara-0.6.0-py3-none-any.whl |
|---|---|
| Size | 91.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7577a75a4eb56ee888c0b65a0946434f71646949ef863fa71ee313fad19731b5
|
|
BLAKE2b-256 checksum How to use checksums |
dd9045ef3643cd194749d957f7a9c9b6017246e2aac41c52bab999e8d0835419
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 29, 2026.
Transparency logSecurity for sovara 0.6.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
1 file in this release has been uploaded with provenance metadata.
Attestation for sovara-0.6.0-py3-none-any.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 Sep 29, 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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.