Skip to content
providerkit
GitHub

createAgentTracing

function createAgentTracing(options?): AgentTracing;

Defined in: agents/src/otel.ts:129

Opt-in execution observation. No exporter, network request or context manager.

Each run span covers one live agent, workflow or remote attempt, not time between resumes. INTERNAL model-operation spans retain SDK operation identity. Core owns their single CLIENT child and all provider/usage fields, including guarded, zero and partial observations. The binding rebinds an already-traced final provider; wrappers hidden inside other decorators cannot be deduplicated. Model/tool returns precede output guards; only run status describes acceptance. Missing starts and cached work do not create spans.

Remote spans describe local observation, not remote billing or confirmed cancellation. Returning a parent-continuation handle can complete a run while the remote task still waits. Its last observed remote state is separate; no peer task/context IDs or questions are captured. Explicit remote.cancel() has no separate SDK operation span. Remote receipts still record cancellation; host HTTP instrumentation may observe the request. Status updates do not prove a send/cancel attempt or known cost.

Explicit parents work without a context manager. Core activates context around provider iterator calls only. Tool/step hooks are observers, NOT async execution scopes: HTTP children there require host instrumentation and a working host-supplied context manager.

Bounds and close() release Agents spans only. They never stop work, close an iterator or replay a paid call. Core’s in-flight spans end on stream termination or caller abort; a stream abandoned without either cannot be closed by this adapter. No content, host context, claims, endpoint, error message or estimated cost is recorded.

Parameter Type
options AgentTracingOptions

AgentTracing