Skip to main content

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.
GET /v1/traces

Query Parameters

ParameterTypeDescription
brain_idstringFilter by brain ID
receptor_idstringFilter by receptor ID (alias: synapse_id)
user_idstringFilter by user ID
searchstringSearch in trace_id and metadata.title
created_afterstringISO date; filter traces created after
created_beforestringISO date; filter traces created before
limitnumberMax traces to return (default: 20)
offsetnumberPagination offset
sortstringSort field: created_at, updated_at, message_count
orderstringSort order: asc or desc

Example Request

const { traces, total } = await auvy.traces.list({
  limit: 20,
  offset: 0,
  sort: 'created_at',
  order: 'desc',
})

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.
GET /v1/traces/:id

Path Parameters

ParameterTypeDescription
idstringTrace ID

Example Request

const { trace } = await auvy.traces.get('trace-id')

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

ParameterTypeDescription
idstringTrace ID

Query parameters

ParameterTypeDescription
limitnumberMaximum 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,
})

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

ParameterTypeDescription
idstringTrace ID

Request Body

FieldTypeRequiredDescription
contentstringYesMessage content (human turn; source_type is set from auth)
metadataobjectNoAdditional metadata (e.g., content_blocks, tool call info)
memory_idsarrayNoArray 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']
})

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

ParameterTypeDescription
trace_idstringTrace ID

Query Parameters

ParameterTypeDescription
tstringShare token (required)
workspacestringWorkspace slug (use with receptor for slug-based share)
receptorstringReceptor slug (use with workspace for slug-based share)
receptor_idstringReceptor UUID (alternative to workspace + receptor, same t)

Example Request

const { trace } = await auvy.public.getTrace(
  'trace-id',
  'share-token',
  'receptor-slug'
)

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

ParameterTypeDescription
trace_idstringTrace ID

Query Parameters

ParameterTypeDescription
tstringShare token (required)
workspacestringWorkspace slug (with receptor for slug-based share)
receptorstringReceptor slug (with workspace for slug-based share)
receptor_idstringReceptor UUID (with t for id-based share)
limitnumberMaximum number of engrams (optional)

Example Request

const { engrams } = await auvy.public.getTraceEngrams(
  'trace-id',
  'share-token',
  'receptor-slug'
)

Trace events (Lane A, SSE)

Server pushes trace-scoped events (e.g. transcript advances, run state) over SSE.
AccessURLAuth
Dashboard / API key / JWTGET /v1/traces/:trace_id/eventsAuthorization + X-Brain-Id when using session users
Receptor share (public chat)GET /v1/public/traces/:trace_id/eventst + 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:
  1. Creation: Traces are automatically created when the first message is added
  2. Engrams: Turns are stored as engrams and returned in API order
  3. State: Trace state is maintained automatically through engrams
  4. 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