Write JSONL traces
OPENAI_API_KEY and a TypeScript runner. It makes a model call and appends a metadata trace to traces.jsonl.
traces.ts
Observe a harness
Pass anEventBus as HarnessRuntime.telemetry and attach instrumentBus(bus, options) to observe runtime/direct model and controller calls. Keep Agent-driver instrumentation on its own bus to avoid counting a call twice. A tool event or missing trace is not evidence of whether an external effect happened; use application records for that.
Capture and shutdown
Choosing an exporter does not opt into content. If you need content, set an explicit bounded capture/redaction policy at both instrumentation and each explicit exporter instance. See capture policy. Export queues and retention are bounded. Slow exporters do not block the Agent’s outcome; drops and export errors appear as diagnostics. Callshutdown() after active work settles to detach and drain within its deadline. The host still owns external providers and clients it supplied.
Flush the core CostTracker separately when you use cost accounting. Telemetry shutdown does not make the accounting store durable, settle an uncertain provider charge, or repair a failed ledger write. Use the accounting query API as the source for cost totals.