Docs
First Trace

First Trace

Understand how traces are captured in Agent Lab and via the ingestion API.

A trace is a stored record of one AI execution: prompt, response, model, tokens, latency, and metadata.

Agent Lab path (local)

The fastest way to create a trace:

  1. Run agentPOST /api/local/run with recordTrace: true
  2. Agent chat — each turn uses the same endpoint with a messages array
  3. Coach — creates coach_local_draft and optional coach_curated traces

Traces from local runs use parameters.source: agent_lab or coach and estimatedCostUsd: 0.

Example (dashboard)

Run agent → enter prompt → Run & trace → open the trace link.

Example (API)

curl -X POST http://localhost:3000/api/local/run \
  -H "Content-Type: application/json" \
  -H "Cookie: <session>" \
  -d '{
    "prompt": "Hello",
    "model": "llama3.2",
    "actionName": "my_first_trace",
    "recordTrace": true
  }'

Response includes traceId when ingestion succeeds.


Production path (SDK / API)

For apps calling cloud models, ingest traces after each completion:

from aitracer import AITracer
 
client = AITracer(api_key="your-api-key")
 
trace = client.trace(
    model="gpt-4o",
    input="Summarize this quarterly report",
    metadata={"workflow": "finance-review"},
)

Or POST /api/traces with a Trace Ingestion API payload.


What to inspect

In Dashboard → Traces, each record includes:

FieldDescription
actionNameGroups runs for training export
modelModel ID used
prompt / responseTraining pair when both present
parameterse.g. trainingPreferred, coachSessionId
estimatedCostUsd$0 for Ollama; provider cost when applicable

Trace → training

Completed traces with prompt + response become trainable examples.


Advanced: governance & verification

Production deployments can attach policy results and integrity verification to traces. See:

These are optional layers on top of basic trace capture.


First Trace – AITracer — AITracer