Traces are the primary unit of observability in AgentVista. Each trace represents a single agent run and contains one or more spans that record the operations that happened during that run.
Ingest a batch of traces
curl -X POST https://api.agentvista.dev/api/v1/traces/batch \
-H "Authorization: Bearer av_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"traces": [
{
"trace": {
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"agent": "lead-qualifier",
"status": "completed",
"started_at": "2024-01-15T10:00:00Z",
"ended_at": "2024-01-15T10:00:02Z",
"duration_ms": 2000,
"success": true,
"outcome": "qualified",
"total_tokens": 1500,
"total_cost_usd": "0.004500"
},
"spans": [
{
"span_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
"trace_id": "550e8400-e29b-41d4-a716-446655440000",
"type": "llm",
"name": "gpt-4o classify",
"status": "completed",
"started_at": "2024-01-15T10:00:00.100Z",
"ended_at": "2024-01-15T10:00:01.800Z",
"duration_ms": 1700,
"model": "gpt-4o",
"input_tokens": 800,
"output_tokens": 120,
"total_tokens": 920,
"cost_usd": "0.003200"
}
]
}
]
}'
POST /traces/batch
Accepts a batch of traces and their spans from the SDK. Requires an API key with write scope.
The endpoint is idempotent: duplicate trace_id or span_id values are silently accepted. Agent records are auto-created on first trace for a new agent name.
The batch accepts up to 100 total spans across all traces in a single request. Exceeding your monthly event limit returns 429.
Request body
Array of trace objects to ingest. Each object contains a trace header and its spans. Header-level fields for the trace. SDK-generated UUID for this trace. Used for idempotent ingestion.
Name of the agent that produced this trace. An Agent record is auto-created if this name is new.
status
string
default: "completed"
Trace status. One of running, completed, failed, timed_out.
ISO 8601 timestamp when the trace started.
ISO 8601 timestamp when the trace ended. Null for in-progress traces.
Total duration in milliseconds.
Whether the agent run succeeded. Used for success rate calculations.
Free-text description of the outcome (e.g. "qualified", "rejected").
Error description if the trace failed.
Total tokens consumed across all LLM spans in this trace.
Total LLM cost in USD as a decimal string (e.g. "0.004500").
Arbitrary key-value metadata attached to this trace.
Version of the AgentVista SDK that produced this trace.
Array of span objects within this trace. SDK-generated UUID for this span.
UUID of the parent trace.
UUID of the parent span. Null for root spans.
Span type. One of agent, llm, tool, http, db, custom.
Human-readable name for this span (e.g. "gpt-4o classify").
status
string
default: "completed"
Span status. One of running, completed, failed, timed_out.
ISO 8601 timestamp when the span started.
ISO 8601 timestamp when the span ended.
Span duration in milliseconds.
LLM model name (e.g. "gpt-4o"). Only relevant for llm spans.
Input token count. Only relevant for llm spans.
Output token count. Only relevant for llm spans.
Total token count for this span. Only relevant for llm spans.
LLM cost in USD for this span as a decimal string.
Input payload. For llm spans: the prompt. For http spans: the request.
Output payload. For llm spans: the completion. For http spans: the response.
Error description if this span failed.
Arbitrary key-value metadata.
Response — 200
Number of traces successfully ingested.
Number of traces that failed validation or ingestion.
Per-trace error details for any rejected traces. The trace_id of the rejected trace.
Description of why the trace was rejected.
{
"accepted" : 1 ,
"rejected" : 0 ,
"errors" : []
}
Get trace detail
curl https://api.agentvista.dev/api/v1/dashboard/traces/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer av_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
GET /dashboard/traces/{trace_id}
Returns a single trace with all its spans ordered by started_at ascending for waterfall rendering. Returns 404 for traces not owned by the authenticated user.
Path parameters
The trace_id UUID of the trace to retrieve.
Response — 200
Name of the agent that produced this trace.
Trace status: running, completed, failed, or timed_out.
ISO 8601 timestamp or null.
Total duration in milliseconds.
Outcome signal. Null if not yet set.
Free-text outcome description.
Error description if the trace failed.
Total tokens consumed across all LLM spans.
Arbitrary metadata attached at ingestion time.
All spans ordered by started_at ASC. Use parent_span_id to build the waterfall tree. UUID of the parent trace.
UUID of the parent span, or null for root spans.
Span type: agent, llm, tool, http, db, or custom.
Human-readable span name.
ISO 8601 timestamp or null.
Duration in milliseconds.
LLM model name, if applicable.
Input token count, if applicable.
Output token count, if applicable.
Total token count, if applicable.
LLM cost in USD for this span.
Compare two agents
curl "https://api.agentvista.dev/api/v1/dashboard/traces/compare-agents?agent_a=UUID_A&agent_b=UUID_B" \
-H "Authorization: Bearer av_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
GET /dashboard/traces/compare-agents
Returns side-by-side aggregated stats for two agents. Both agents must belong to the authenticated user, otherwise 404 is returned.
Query parameters
UUID of the first agent to compare.
UUID of the second agent to compare.
Response — 200
Array of exactly two agent stat objects, one per requested agent. Total number of traces for this agent.
Fraction of traces with success: true (e.g. 0.73 = 73%).
Average total_cost_usd per trace in USD.
Sum of total_cost_usd across all traces.
95th-percentile duration_ms across all traces.
ISO 8601 timestamp of the most recent trace.
Set trace outcome
curl -X PATCH https://api.agentvista.dev/api/v1/dashboard/traces/550e8400-e29b-41d4-a716-446655440000/outcome \
-H "Authorization: Bearer av_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"success": true, "outcome": "qualified"}'
PATCH /dashboard/traces/{trace_id}/outcome
Sets the success and outcome fields on a trace. Use this to attach human or programmatic feedback to a completed trace. Returns 404 for traces not owned by the authenticated user.
Path parameters
UUID of the trace to update.
Request body
Whether this trace is considered a success.
Free-text description of the outcome (e.g. "qualified", "rejected", "escalated").
Response — 200
UUID of the updated trace.
The updated success value.
The updated outcome value.