Skip to main content
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

traces
object[]
required
Array of trace objects to ingest. Each object contains a trace header and its spans.

Response — 200

accepted
number
Number of traces successfully ingested.
rejected
number
Number of traces that failed validation or ingestion.
errors
object[]
Per-trace error details for any rejected traces.
Example response
{
  "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

trace_id
string
required
The trace_id UUID of the trace to retrieve.

Response — 200

trace_id
string
The trace UUID.
agent_name
string
Name of the agent that produced this trace.
status
string
Trace status: running, completed, failed, or timed_out.
started_at
string
ISO 8601 timestamp.
ended_at
string | null
ISO 8601 timestamp or null.
duration_ms
number | null
Total duration in milliseconds.
success
boolean | null
Outcome signal. Null if not yet set.
outcome
string | null
Free-text outcome description.
error_message
string | null
Error description if the trace failed.
total_tokens
number | null
Total tokens consumed across all LLM spans.
total_cost_usd
number | null
Total LLM cost in USD.
metadata
object | null
Arbitrary metadata attached at ingestion time.
spans
object[]
All spans ordered by started_at ASC. Use parent_span_id to build the waterfall tree.

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

agent_a
string
required
UUID of the first agent to compare.
agent_b
string
required
UUID of the second agent to compare.

Response — 200

agents
object[]
Array of exactly two agent stat objects, one per requested agent.

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

trace_id
string
required
UUID of the trace to update.

Request body

success
boolean
required
Whether this trace is considered a success.
outcome
string
Free-text description of the outcome (e.g. "qualified", "rejected", "escalated").

Response — 200

trace_id
string
UUID of the updated trace.
success
boolean
The updated success value.
outcome
string | null
The updated outcome value.