Telemetry and Tracing
Telemetry is enabled by default. Every agent records spans, LLM usage, and events automatically — no setup required. When connected to the mesh, telemetry exports to the Svantic dashboard. Otherwise, it exports to the console.Zero-Config Telemetry
How it works
| Scenario | What happens |
|---|---|
mesh config provided | Spans export to {svantic_url}/telemetry using your credentials. |
No mesh config | Spans export to the console (useful during local development). |
telemetry: false | Telemetry is completely disabled. Nothing is recorded. |
Disabling Telemetry
Settelemetry: false in the agent config:
Custom Spans
Useagent.tracer to add your own instrumentation. Spans automatically nest — starting a span while another is active makes it a child.
Span Types
Generic spans for any operation:Span Methods
| Method | Description |
|---|---|
set_attribute(key, value) | Add a string, number, or boolean attribute. |
set_error(message) | Mark the span as errored with a message. |
end(options?) | Mark the span as complete. LLM spans accept token counts. |
Events
For discrete signals that are not part of the span tree (e.g. “document processed”, “ticket escalated”):trace_id and span_id for correlation.
W3C Trace Propagation
When your agent calls another agent (viaRemoteAgent), trace context propagates automatically using the W3C traceparent header. This creates a unified trace across agent-to-agent calls.
Injecting context into outbound requests
For non-A2A HTTP calls (e.g. calling an external API), inject trace context manually:Adopting inbound context
When your agent receives an HTTP request with atraceparent header, adopt the remote context so your spans join the caller’s trace:
Advanced: Custom Telemetry Instance
If you need full control over export destination, auth, or flush behavior, pass your ownSvanticTelemetry instance:
Export destinations
| Destination | Config |
|---|---|
| Svantic mesh | { endpoint: 'http://gateway/telemetry', auth: { type: 'bearer', token: jwt } } |
| OTLP collector | { endpoint: 'http://collector:4318/v1/traces', protocol: 'otlp' } |
| Console | { type: 'console' } |
Dashboard Integration
When telemetry exports to the Svantic mesh (the default for mesh-connected agents), your traces appear in the Svantic dashboard under the session timeline. You can:- See the full span tree for each capability invocation.
- View LLM token usage per call.
- Trace requests across agent-to-agent boundaries.
- Correlate events with the spans that produced them.
Shutdown
Telemetry flushes automatically on shutdown:agent.stop() (and agent.close()) calls telemetry.shutdown() internally, which stops the flush timer, flushes remaining data, and shuts down the exporter.