Monitoring & Events

Automatic Event Tracking

The SDK automatically captures:

  • Run lifecycle: run.start, run.end
  • Tool execution: tool.request, policy.decision, tool.response
  • Tasks: task.start, task.end
  • Handoffs: handoff events

Run Summary Statistics

Every run.end event includes metadata.summary:

{
  "metadata": {
    "success": true,
    "summary": {
      "tool_calls": { "total": 10, "allowed": 8, "denied": 1, "error": 1 },
      "latencies": { "avg_tool_ms": 50.2, "avg_policy_ms": 0.5, "total_run_ms": 1500.0 },
      "tasks": { "completed": 3, "failed": 1 },
      "handoffs": 1
    }
  }
}

Structured Errors

Errors in tool.response and run.end are structured with type, message, source, and retryable.