See what your agent
actually did.

SpanTrail records every tool call, prompt, token and error your AI agent produces, then gives you a timeline you can actually read. Ship in an afternoon.

Start free - 50k events See how it works No card required. Python SDK, 3-line setup.
# pip install spantrail
import spantrail

spantrail.init(api_key="spantrail_sk_...", endpoint="https://host:8443")

@spantrail.trace("research.run")
def research(query):
    with spantrail.span("llm.completion", kind="llm", model="gpt-4o") as s:
        s.input = {"prompt": query}
        s.tokens_input, s.tokens_output = 120, 340
        s.cost_usd = 0.004
        return answer

The problem, precisely

?

You cannot debug what you cannot see

Agent failures are invisible. The run "succeeded" and the output was wrong. No stack trace, no step-by-step record of which tool call drifted.

$

Nobody knows the cost until the bill

Token spend is discovered after the fact, attributed by guesswork, and never tied back to the step that caused it.

R

Replay is manual guesswork

Reproducing a failure means re-running the agent against a live world, hoping it fails the same way a second time.

What you get

A readable timeline

Every span in order: name, duration, inputs, outputs, errors, token counts and cost. Click any trace to see the full tree.

Cost per step

Cost is attached to the span that incurred it, not to a monthly total you have to reverse-engineer.

Error surfacing

Exceptions are captured with their message and the span stack, so a failed run is a link you can send to a colleague.

One key, one endpoint

No agent-side proxy, no key rotation dance, no LLM vendor in the billing path. The SDK is batched and never raises into your app.

What a trace looks like

TraceSpansDurationTokensCostStatus
research.run144,281 ms 18,204$0.31ok
research.run91,104 ms 4,880$0.091 error
deploy.pipeline2218,902 ms 61,120$1.42ok
crawler.fetch3642 ms 1,220$0.021 error

How it works

  1. Install the SDKFive lines to initialize. It reads SPANTRAIL_API_KEY and SPANTRAIL_ENDPOINT from the environment, so nothing is hardcoded.
  2. Wrap your workDecorate a function or open a span around a block. Everything else keeps working unchanged - the SDK swallows its own failures.
  3. Read the timelineEvents are batched in-process and flushed every few seconds over HTTPS to your own endpoint.
Self-hosted on a single Hetzner VPS. 30-day retention. Your data stays in your region.

Pricing

Free

$0

50k events / month. 30-day retention. Unlimited traces.

Pro

$29

1M events / month. 30-day retention. Cost dashboards. Email support.

Team

$99

10M events / month. 90-day retention. Shared workspaces. Priority support.