All span operations are available under the client.spans namespace. Spans are automatically created when you run prompts or use run_local(), providing visibility into LLM usage, performance, and costs.
Terminology: A span represents a single LLM call. Multiple spans can be grouped into a trace (session) using the trace_id parameter.
Copy
from tracia import Tracia, Eval, EvaluateOptions, ListSpansOptionsclient = Tracia(api_key="tr_your_api_key")# List spans with filtersresult = client.spans.list(ListSpansOptions( prompt_slug="welcome-email", status="SUCCESS", limit=20,))print(result.spans)# Get a single spanspan = client.spans.get("sp_abc123def456")# Submit an evaluation for a spanclient.spans.evaluate( "sp_abc123def456", EvaluateOptions(evaluator="quality", value=Eval.POSITIVE),)