Trace Types

Every event sent to Observe is a trace. There are 5 types.

All traces require traceId, sessionId, and type. Everything else is optional but improves detection quality.

llm_call

A raw LLM completion — the direct request/response to the model. Include provider, model, token counts, and latency for full cost and performance tracking.

Example
{
  "traceId": "t-001",
  "sessionId": "conv-1024",
  "type": "llm_call",
  "llm": {
    "provider": "anthropic",
    "model": "claude-sonnet-4",
    "inputMessages": [
      {"role": "user", "content": "What is my order status?"}
    ],
    "outputMessage": "Your order #1234 shipped on July 5th.",
    "inputTokens": 32,
    "outputTokens": 15,
    "latencyMs": 650,
    "temperature": 0.7
  }
}

llm.provider and llm.model are required when the llm block is present. outputMessage is the text that gets evaluated by Tier 1/2.

agent_response

The final response sent to the end user. Use this instead of llm_call when your agent post-processes the LLM output before sending it. Supports RAG context for grounded evaluation.

Example
{
  "traceId": "t-002",
  "sessionId": "conv-1024",
  "type": "agent_response",
  "response": {
    "text": "Based on our records, your order shipped on July 5th.",
    "latencyMs": 920
  },
  "retrievedContext": {
    "query": "order status 1234",
    "documents": [
      {
        "content": "Order #1234: Shipped July 5, tracking ABC123",
        "source": "orders-db",
        "score": 0.95
      }
    ]
  }
}

When retrievedContext is provided, Tier 2 evaluation compares the response against it — claims not supported by the documents are flagged as hallucination.

user_message

The end user's input. Sending these enables conversation replay and multi-turn context for Tier 2 evaluation.

Example
{
  "traceId": "t-003",
  "sessionId": "conv-1024",
  "userId": "user-7291",
  "type": "user_message",
  "response": {
    "text": "Where is my order?"
  }
}

The text is stored in the response.text field. userId is optional but enables per-user analytics.

tool_call

A tool or function execution by the agent. Include the tool name, arguments, result, and whether it succeeded.

Example
{
  "traceId": "t-004",
  "sessionId": "conv-1024",
  "type": "tool_call",
  "tool": {
    "name": "search_orders",
    "arguments": {"orderId": "1234"},
    "result": {"status": "shipped", "trackingNumber": "ABC123"},
    "success": true,
    "latencyMs": 120
  },
  "availableTools": [
    {"name": "search_orders", "description": "Look up order by ID"},
    {"name": "create_ticket", "description": "Create support ticket"},
    {"name": "refund_order", "description": "Process a refund"}
  ]
}

When availableTools is provided, Tier 2 can evaluate whether the agent selected the right tool for the task. tool.success is used by Tier 1 to detect tool_call_failed.

error

An error event — provider timeout, rate limit, exception, or application error.

Example
{
  "traceId": "t-005",
  "sessionId": "conv-1024",
  "type": "error",
  "response": {
    "text": "Rate limit exceeded: 429 Too Many Requests",
    "latencyMs": 50
  }
}

Tier 1 detects provider_api_error and rate_limit_error from error traces automatically.