Local stack
Start the local stack:- Grafana:
http://localhost:3001 - Prometheus:
http://localhost:9090 - Tempo:
http://localhost:3200 - Loki:
http://localhost:3100 - OTEL collector HTTP:
http://localhost:4318
Enable OTEL export
Reproduce with any agent run
With the OTEL env enabled, every agent task emits canonical trace events (AgentTraceEvent / AgentTraceSummary) plus persisted provider session
transcript rows, and exports them to the collector. Launch any agent workflow
with an explicit run id:
AgentTraceEvent / AgentTraceSummary lines and the
custom.demo / custom.ticket annotations to confirm the export path
end to end.
The dedicated
workflows/agent-trace-otel-demo.tsx demo workflow and the
scripts/verify-observability.sh runner were removed in 0.30.0; the generic
repro above replaces them.Loki queries
Smithers OTEL attributes are exposed to Loki as sanitized structured metadata fields such as:smithers_event_categoryrun_idworkflow_pathnode_idnode_attemptagent_familyagent_capture_modetrace_completenessevent_kindsession_row_type
agent-trace: normalized canonical execution events such as deltas, tool lifecycle, usage, and capture warnings/errorsagent-session: provider transcript/session rows observed live or backfilled from persisted session logs
artifact.created stays local-only, not exported to Loki.
Use {service_name="smithers-dev"} as the stream selector, then filter on structured metadata in the LogQL pipeline; | json inspects the structured log body.
All events for one run:
API query examples
Equivalent direct Loki API checks:Tempo trace checks
Tempo search shows Smithers spans once a workflow has run:service.name = smithers-devrunId = <RUN_ID>workflowPath = <workflow path>
Verification checklist
- stack starts in Docker
- Loki is present and queryable
- collector logs pipeline is active
- Pi traces show text deltas, thinking deltas, tool execution lifecycle, final message, usage, and run/node/attempt correlation
- Pi, Claude, and Codex session transcript rows are queryable in Loki
- second agent family is exported with truthful
final-onlycompleteness classification - Gemini
stream-jsonattempts preserve structured deltas truthfully - malformed or truncated structured streams emit
capture.errorand classify ascapture-failed - artifact write failures emit
capture.warningand degrade topartial-observedwithout losing durable DB truth - Tempo search shows Smithers spans and trace attributes including
runId - Prometheus is still scraping the collector
- secrets are redacted from canonical events, OTEL log bodies, and persisted trace artifacts
Automated coverage
apps/observability/tests/agentTrace.test.js covers the canonical contract:
- capability profiles for every agent family
- family + capture-mode detection
- Pi / Claude / Codex / Gemini structured event normalization
- redaction rules for API keys, bearer tokens, and secret-ish key=value pairs
- canonical OTEL log record shaping with stable Loki query attributes
- session-event OTEL log record shaping