Appearance
Trace an agent
Record an agent session and inspect its spans in the web app.
Start Rundial and create an API key with the Quickstart. Keep the stack running and set RUNDIAL_API_KEY.
1. Record a trace
Save this as agent.py and run python agent.py. Replace the example work with your agent's calls.
python
import rundial as rd
with rd.init(workspace="default-workspace", project="default-project",
name="support-agent", kind="agent") as run:
with run.trace("answer") as span:
span.set_attrs({"agent.task": "support"})
with run.trace("lookup", kind="tool"):
print("Looked up the answer")
span.event("answer.ready")Nested run.trace() blocks appear as parent and child spans.
2. Open the trace
Open Default Project → Train, select Filter, choose agent under Kind, and select support-agent. Open Traces and select a span to inspect its details.
For token and cost totals, send spans through OpenTelemetry with gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, and gen_ai.usage.cost_usd. Native SDK span attributes do not populate these totals.