The ownership model
The Python SDK exposes two top-level building blocks:SovaraClientowns project identity and trace-scoped helpers.tracewraps application functions that should appear as steps.
Top-level traces
Use a top-level trace for a workflow, evaluation sample, batch job, or durable conversation. A recording session opens that trace for appending work; a turn groups one interaction within it.with and
async with.
For a durable conversation or workflow, pass your own stable identifier as
trace_id, or reuse the trace ID yielded by a previous SDK trace. Reuse either value
to add new steps to the same trace in that project.
trace_id; use a stable ID such
as a chat, ticket, or job ID.
The context yields the trace ID. Omit trace_id to create a new trace. Pass
that ID to the CLI, here as TRACE_ID:
Steps and explicit tracing
Inside a trace, supported provider and MCP calls become ordered steps with input, output, latency, status, and error data.trace adds the same visibility to
important application work that automatic instrumentation does not capture.
Subtraces
Subtraces organize child agents, delegated branches, parallel work, and coherent multi-step phases under the active trace.subtrace() for child work. Nesting trace() does not create a child trace.
Trace metadata
Uselog() to attach input, output, and custom fields to a trace.
json.dumps().
Custom fields accept booleans, integers, finite floats, or strings. Omit absent
values instead of passing None. If recording is unavailable, trace_id is
None; skip logging for that trace. See the API reference
for details.
To group sample traces and record verdicts, follow the
Evaluations guide.
Lessons
When automatic injection is enabled and the required models are configured, supported model calls retrieve from the project’s production lessons. Unapplied proposals are not used. Narrow retrieval withlesson_scope on a trace or subtrace:
Controls and concurrency
with_context(...) wrapper inside the
active trace before submitting it to a thread pool:
capture_logs=False to avoid mixing process
stdout/stderr between traces.
Run the application
Run the application normally. The SDK records the trace:Explicit conversation turns
trace() 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.
trace_id and declare
the interaction explicitly:
trace() and turn() support async with. turn_input is an optional
string for the interaction; logged input and output describe the whole trace.
Do not nest turns in the same trace. Await tasks and consume streams before
leaving the recording context.