Tracing & OpenTelemetry
Tracing & OpenTelemetry
Section titled “Tracing & OpenTelemetry”Every model invocation, tool execution, and agent turn in Dewee generates structured OpenTelemetry-compatible traces (internal/tracing/).
Tracing Architecture
Section titled “Tracing Architecture”- Span Hierarchy:
agent_run→model_turn→tool_execution→observation_capture. - Prompt Cache Metrics: Tracks cache read and cache creation tokens for Anthropic and OpenAI models.
- Cost Rollups: Calculates estimated token expenses per session and workspace.
CLI Tracing Commands
Section titled “CLI Tracing Commands”# Follow real-time trace stream from the gatewaydewee traces follow
# List recent execution traces with error statusdewee traces list --status error
# Include background worker decision traces, which lists hide by defaultdewee traces list --include-background
# Inspect full structured JSON span detailsdewee traces get <trace-id>
# Export trace data for external ingestiondewee traces export <trace-id>Background decision traces
Section titled “Background decision traces”Reflex decisions from background workers (channel memory batches, knowledge-graph chunks and dreaming) that run outside any agent run get their own short-lived trace tagged origin:background. Trace lists hide these by default in RGD, CCP, GET /v1/traces and dewee traces list. Turn on “Show background traces” in RGD or CCP, pass include_background=true to the API, or use --include-background on the CLI to show them. Opening a trace by ID always works. Traces recorded before this tag existed stay visible.