Documentation Index
Fetch the complete documentation index at: https://docs.auvy.ai/llms.txt
Use this file to discover all available pages before exploring further.
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 AI agents
- Execution Tracking: Following the execution flow of receptors, neurons, and pathways
- Engram history: Storing and retrieving trace-scoped engrams (conversation system of record)
- State Management: Maintaining context across multiple interactions
Traces are automatically created when the first message is added via engrams. No explicit creation is required.
When available, title is the canonical stored trace title. It is typically generated after the first assistant reply. Clients may show the first user message as a temporary fallback while the canonical title is pending. Manual title updates override the auto-title path.
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 (alias: synapse_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
const { traces, total } = await auvy.traces.list({
limit: 20,
offset: 0,
sort: 'created_at',
order: 'desc',
})
curl "https://api.auvy.ai/v1/traces?limit=20&sort=created_at&order=desc" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"traces": [
{
"id": "trace-uuid",
"trace_id": "trace-id",
"tenant_id": "workspace-uuid",
"user_id": "user-uuid",
"api_key_id": null,
"synapse_id": "receptor-uuid",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:01Z",
"message_count": 5,
"cost_summary": {
"total_cost_usd": 0.01,
"total_tokens": 1000,
"input_tokens": 500,
"output_tokens": 500
}
}
],
"total": 42,
"limit": 20,
"offset": 0,
"has_more": true
}
Note: Trace summaries include synapse_id for compatibility; engrams store receptor_id. Use receptor_id when filtering.
Get Trace
Get a single trace by ID.
Path Parameters
| Parameter | Type | Description |
|---|
id | string | Trace ID |
Example Request
const { trace } = await auvy.traces.get('trace-id')
curl https://api.auvy.ai/v1/traces/trace-id \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"trace": {
"id": "trace-id",
"tenant_id": "tenant-uuid",
"user_id": "user-uuid",
"trace_id": "trace-id",
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}
Get trace engrams
Returns serialized engram documents for the trace (same shape as storage: content as JSON, source_type / target_type, metadata may include merged content_blocks for tool calls). Path remains /messages for compatibility.
GET /v1/traces/:id/messages
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
const { engrams } = await auvy.traces.getEngrams('trace-id')
const { engrams: page } = await auvy.traces.getEngrams('trace-id', {
signal: abortController.signal,
})
curl "https://api.auvy.ai/v1/traces/trace-id/messages?limit=20" \
-H "Authorization: Bearer YOUR_API_KEY"
Example response
{
"engrams": [
{
"id": "engram-uuid",
"workspace_id": "workspace-uuid",
"created_at": "2024-01-01T00:00:00Z",
"content": { "type": "human", "content": "Hello" },
"content_hash": "…",
"metadata": {},
"source_type": "user",
"source_id": "user-uuid",
"target_type": null,
"target_id": null,
"trace_id": "trace-id",
"trace_type": "thread"
}
]
}
Do not log raw engrams in untrusted environments; 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.
POST /v1/traces/:id/messages
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
const { engram } = await auvy.traces.addMessage('trace-id', {
content: 'Hello, AUVY!'
})
const { engram: withMemories } = await auvy.traces.addMessage('trace-id', {
content: 'Analyze this document',
memory_ids: ['memory-uuid-1', 'memory-uuid-2']
})
curl -X POST https://api.auvy.ai/v1/traces/trace-id/messages \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Hello, AUVY!",
"memory_ids": ["memory-uuid-1"]
}'
Example Response
{
"engram": {
"id": "engram-uuid",
"trace_id": "trace-id",
"source_type": "user",
"target_type": null,
"content": { "type": "human", "content": "Hello, AUVY!" },
"content_hash": "…",
"metadata": {},
"created_at": "2024-01-01T00:00:00Z"
}
}
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.
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 (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
const { trace } = await auvy.public.getTrace(
'trace-id',
'share-token',
'receptor-slug'
)
curl "https://api.auvy.ai/v1/public/traces/trace-id?t=share-token&workspace=workspace-slug&receptor=receptor-slug" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
Get public trace engrams
Get engrams for a trace using a share token. Uses GET /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).
GET /v1/traces/:trace_id/messages
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
const { engrams } = await auvy.public.getTraceEngrams(
'trace-id',
'share-token',
'receptor-slug'
)
curl "https://api.auvy.ai/v1/traces/trace-id/messages?t=share-token&workspace=workspace-slug&receptor=receptor-slug&limit=20" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"
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) |
The SDK’s 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 a trace_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.
const { job_id } = await auvy.receptors.invoke('my-workspace', 'my-receptor', {
message: 'Hello',
trace_id: 'trace-id'
})
const status = await auvy.jobs.getStatus(job_id)
const { engrams } = await auvy.traces.getEngrams('trace-id')
Document linking
Traces can be linked to document-lane resources for RAG (retrieval-augmented generation):
// Add message with document resource links
await auvy.traces.addMessage('trace-id', {
content: 'What do you know about this?',
memory_ids: ['resource-uuid-1', 'resource-uuid-2'],
})
// Linked resources are associated with the trace’s recollection as implemented server-side
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