Skip to main content

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. 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.
Install the skill once in your coding-agent environment:
Run the framework-specific prompt below from the application root. Review the resulting diff before deploying it.

Manual setup: Agnost AI SDK

Call agnost.shutdown() once when the application exits, not after each request.

Manual setup: OpenTelemetry

Agent Framework instruments every Agent with OpenTelemetry using the GenAI semantic conventions. It emits an invoke_agent span per run, a chat span per model call, and an execute_tool span per tool call. Export those spans to Agnost AI, turn on content capture, and add a small span processor that writes your session and user IDs onto every span. This guide uses the Python package.

Install

agent-framework-anthropic is a prerelease package and pulls in agent-framework-core. Use the client package of your model provider instead if you do not use Claude. Agent Framework does not install an OTLP exporter for you.

Setup

Three parts matter:
  • exporters=[OTLPSpanExporter(...)] sends traces only. Agnost AI stores traces, so do not set OTEL_EXPORTER_OTLP_ENDPOINT for it, which would also send logs and metrics.
  • enable_sensitive_data=True adds prompts, answers, tool arguments, and tool results to the spans. Without it, Agnost AI receives the events with no content. You can set ENABLE_SENSITIVE_DATA=true instead.
  • AgnostContextProcessor adds session.id and user.id to each span. Agent Framework sets gen_ai.conversation.id only when the provider manages the conversation on its side, and it never records a user ID. Agnost AI groups all runs with the same session.id into one conversation and attributes it to user.id.
If your app already configures OpenTelemetry, add the Agnost AI exporter and AgnostContextProcessor to your own tracer provider and call enable_instrumentation(enable_sensitive_data=True) from agent_framework.observability instead of configure_otel_providers().

What appears in Agnost AI

  • Conversations: one per session.id. The raw value is kept as original_conversation_id in the conversation metadata.
  • Users: the user.id set in ask.
  • Messages: the user’s message and the agent’s final answer for each agent.run(...) call, from the root invoke_agent span.
  • Events: invoke_agent, chat, and execute_tool spans in a nested tree. Model events carry token counts. Tool events carry the tool name, arguments, and result.

Verify

Run one agent turn, wait about 30 seconds, then open Conversations in Agnost AI. Confirm the conversation shows your user ID, a user message and an assistant answer, and a get_weather tool event with arguments and a result.

Troubleshooting

  • Nothing arrives: install opentelemetry-exporter-otlp-proto-http, confirm the header is X-Agnost-Org-ID and the endpoint ends in /v1/traces. Short scripts must call trace.get_tracer_provider().force_flush() before they exit.
  • Events have no prompts, answers, or tool arguments: pass enable_sensitive_data=True or set ENABLE_SENSITIVE_DATA=true.
  • Each turn is its own conversation, or the user is empty: the run happened outside ask, or AgnostContextProcessor was not added to the tracer provider.
  • Model calls appear twice: the Anthropic Python SDK 2.x also emits its own anthropic.messages.create span for each API call, without message content. Set ANTHROPIC_OPEN_TELEMETRY=false to turn it off.

References

Next steps

  • Conversations: review the complete Agent Framework session.
  • Events: inspect agent, model, and tool activity.
  • Patterns: organize production conversations by what users wanted.