Choose a setup method
Start with one method for a call path. Combining SDK tracking with framework
OpenTelemetry on the same call can create duplicate interactions.
Recommended: Agnost AI skill
Recommended. Choose this path when you want your coding agent to inspect the
project, select a supported transport, make the smallest instrumentation change,
send a test event, and verify that it reached Agnost AI.
Manual setup: Agnost AI SDK
agnost.shutdown() once when the application exits, not after each request.
Manual setup: OpenTelemetry
Strands Agents emits OpenTelemetry spans for every agent run, event loop cycle, model call, and tool call, using the OpenTelemetry GenAI semantic conventions. Point its OTLP exporter at Agnost AI and set the session and user on the agent.Install
otel extra installs the OTLP HTTP exporter. Swap anthropic for the extra of your model provider.
Setup
Set this before Strands starts:gen_ai_latest_experimental switches Strands to the current GenAI conventions, and gen_ai_span_attributes_only writes prompts and answers as span attributes instead of span events. With both set, Agnost AI shows each turn’s user message and answer as plain text. Without them, Strands still works, but messages show up wrapped in Strands content blocks such as [{"text": "..."}].
trace_attributes puts session.id and user.id on every Strands span. Agnost AI groups all turns with the same session.id into one conversation and attributes it to user.id. Create one Agent per user session, or set a new trace_attributes value for each session.
You can also configure the exporter with the standard variables instead of arguments: set OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://otel.agnost.ai/v1/traces and OTEL_EXPORTER_OTLP_TRACES_HEADERS=X-Agnost-Org-ID=your-org-id, then call setup_otlp_exporter() with no arguments.
What appears in Agnost AI
- Conversations: one per
session.id. The raw value is kept asoriginal_conversation_idin the conversation metadata. - Users: the
user.idfromtrace_attributes. - Messages: the user’s prompt and the agent’s final answer for each
agent(...)call, from the rootinvoke_agentspan. - Events:
invoke_agent,execute_event_loop_cycle,chat, andexecute_toolspans in a nested tree. Tool events carry the tool name, arguments, and result. Model events carry token counts.
Verify
Run one agent call, wait about 30 seconds, then open Conversations in Agnost AI. Confirm the conversation shows youruser.id, a user message and an assistant answer, and a get_weather tool event with arguments and a result.
Troubleshooting
- Nothing arrives: confirm the exporter header is
X-Agnost-Org-IDand the endpoint ends in/v1/traces. Short scripts must calltelemetry.tracer_provider.force_flush()before they exit, because the exporter sends in batches. - Each turn is its own conversation, or the user is empty:
trace_attributesis missingsession.idoruser.id. - Messages look like
[{"text": "..."}]: setOTEL_SEMCONV_STABILITY_OPT_INas shown above before the process starts. - Model calls appear twice: the Anthropic Python SDK 2.x also emits its own
anthropic.messages.createspan for each API call, without message content. SetANTHROPIC_OPEN_TELEMETRY=falseto turn it off. - Your app already has a tracer provider: Strands writes its spans to the global tracer provider. Skip
StrandsTelemetry()and add anOTLPSpanExporterfor Agnost AI to the provider your app already registered.
References
Next steps
- Conversations: review the complete Strands session.
- Events: inspect agent, model, and tool activity.
- Patterns: organize production conversations by what users wanted.