Traces API
Traces represent conversation contexts for multi-turn interactions and execution tracking. They automatically track message history, state, and provide a unified interface for managing conversation flows.Overview
Traces are the primary mechanism for:- Conversation context — multi-turn interactions with agents
- Execution tracking — following receptor, neuron, and pathway runs
- Message history — stored turns for the thread
- State — context across interactions
title is the stored trace title, typically generated after the first assistant reply. Manual title updates override auto-title.
List Traces
List traces with filtering and pagination.Query Parameters
| Parameter | Type | Description |
|---|---|---|
brain_id | string | Filter by brain ID |
receptor_id | string | Filter by receptor ID |
user_id | string | Filter by user ID |
search | string | Search in trace_id and metadata.title |
created_after | string | ISO date; filter traces created after |
created_before | string | ISO date; filter traces created before |
limit | number | Max traces to return (default: 20) |
offset | number | Pagination offset |
sort | string | Sort field: created_at, updated_at, message_count |
order | string | Sort order: asc or desc |
Example Request
- TypeScript
- curl
Example Response
Get Trace
Get a single trace by ID.Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trace ID |
Example Request
- TypeScript
- curl
Example Response
Get trace messages
Returns serialized message documents for the trace (GET /v1/traces/:id/messages). Response shape includes content, roles, tool metadata, and ordering fields. The SDK method is traces.getEngrams().
Path parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trace ID |
Query parameters
| Parameter | Type | Description |
|---|---|---|
limit | number | Maximum number of engrams to return (default: unlimited) |
Example request
- TypeScript
- curl
Example response
content can include rich structured data.
Add message to trace
Add a message to a trace. This will automatically create the trace if it doesn’t exist.Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Trace ID |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
content | string | Yes | Message content (human turn; source_type is set from auth) |
metadata | object | No | Additional metadata (e.g., content_blocks, tool call info) |
memory_ids | array | No | Array of memory UUIDs to link to the trace |
Example Request
- TypeScript
- curl
Example Response
Public Trace Access
Traces can be accessed via share tokens for public access without requiring full authentication.Get Public Trace
Get a trace using a share token.Path Parameters
| Parameter | Type | Description |
|---|---|---|
trace_id | string | Trace ID |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
t | string | Share token (required) |
workspace | string | Workspace slug (use with receptor for slug-based share) |
receptor | string | Receptor slug (use with workspace for slug-based share) |
receptor_id | string | Receptor UUID (alternative to workspace + receptor, same t) |
Example Request
- TypeScript
- curl
Get public trace engrams
Get engrams for a trace using a share token. UsesGET /v1/traces/:trace_id/messages with share token query parameters. Either pass t + workspace + receptor, or t + receptor_id (same scoping as public receptor invoke and GET /v1/public/traces/:trace_id).
Path Parameters
| Parameter | Type | Description |
|---|---|---|
trace_id | string | Trace ID |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
t | string | Share token (required) |
workspace | string | Workspace slug (with receptor for slug-based share) |
receptor | string | Receptor slug (with workspace for slug-based share) |
receptor_id | string | Receptor UUID (with t for id-based share) |
limit | number | Maximum number of engrams (optional) |
Example Request
- TypeScript
- curl
Trace events (Lane A, SSE)
Server pushes trace-scoped events (e.g. transcript advances, run state) over SSE.| Access | URL | Auth |
|---|---|---|
| Dashboard / API key / JWT | GET /v1/traces/:trace_id/events | Authorization + X-Brain-Id when using session users |
| Receptor share (public chat) | GET /v1/public/traces/:trace_id/events | t + workspace + receptor, or t + receptor_id (same as transcript; see Public trace events) |
auvy.traces.eventsStreamUrl(traceId, options) picks the right base path; for share links pass shareToken in options.
Alternate route: with a valid share query, GET /v1/traces/:trace_id/events also authorizes the same t parameters via resolveTraceAccess (useful for clients that do not use the /v1/public/... prefix). The public chat UI uses the /v1/public/traces/.../events shape.
Trace Lifecycle
Traces follow a simple lifecycle:- Creation: Traces are automatically created when the first message is added
- Engrams: Turns are stored as engrams and returned in API order
- State: Trace state is maintained automatically through engrams
- Retrieval: Traces and their engrams can be retrieved at any time
Integration with Receptors
Traces are created and managed when you invoke receptors with atrace_id. Advanced: the same invoke body may include neuron_task_options (validated like Invoke neuron); omit trace_type: "system" for normal chat so turns stay on the thread timeline.
Document linking
Traces can be linked to document-lane resources for RAG (retrieval-augmented generation):Error Handling
Common error scenarios:- 404 Not Found: Trace doesn’t exist
- 403 Forbidden: Insufficient permissions to access trace
- 400 Bad Request: Invalid trace ID format or missing required fields
Related
- Assets and Artifacts API — ingest and manage document-lane knowledge
- Jobs, streaming, and errors - Stream agent-run responses
- Activity API - View trace activity and engrams