Skip to main content
When your chatbot conversation or agent run is in flight, every action becomes an event.
Bundled together they form a trace – a structured replay of what happened, step‑by‑step.
The full schema lives in API ▸ Ingestion.

Understanding testId and traceId

Two IDs appear on trace events — here’s what each one does:
Do not set traceId equal to testId. They serve different purposes: testId links the trace to an Avido test run for evaluation, while traceId groups events together into a single trace.

  1. Collect events in memory as they happen.
  2. Flush once at the end (or on fatal error).
  3. Add a log event describing the error if things blow up.
  4. Keep tracing async – never block your user.
  5. Evaluation‑only mode? Only ingest when the run came from an Avido test → check for testId from the Webhook.
  6. LLM events should contain the raw prompt & completion – strip provider JSON wrappers.

SDK installation


Ingesting events

You can send events:
  • Directly via HTTP
  • Via our SDKs (Node: @avidoai/sdk-node, Python: avido)
When authenticating with an API key, include both the x-api-key and x-application-id headers. The application ID should match the application that owns the key so the request can be authorized.

Tip: map your IDs

If you already track a conversation / run in your own DB, pass that same ID as referenceId.
It makes liftover between your system and Avido effortless.

Event types in depth

Every call to client.ingest.create() accepts an array of events. The first event is usually a trace (the root container), followed by one or more step events.

trace — root container

Every ingestion batch should start with a trace event. It groups all subsequent steps together.

llm — LLM calls

Track every call to a language model. Use event: "start" when the call begins and event: "end" when it completes, or send a single event with both input and output after the call finishes.
Send the raw prompt and completion values. Strip any provider-specific JSON wrappers so Avido can display and evaluate them consistently.

tool — function / tool calls

Log every tool or function call your model makes.

retriever — RAG queries

Track retrieval-augmented generation lookups and the chunks they return.

log — everything else

Use log events for system prompts, branching decisions, error details, or anything else worth seeing during debugging.

Full end-to-end example

A complete example capturing a realistic agent run with multiple event types:

Fetching traces

Use the SDK to list or retrieve traces for debugging and analysis.

Error handling

Wrap your ingestion calls so a tracing failure never crashes your application.

Next steps