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

Use this when you want one Agnost AI event per agent turn with the exact input and output you choose.
Call agnost.shutdown() once when the application exits, not after each request. Shutting down per request disables telemetry for later agent runs in the same process.

Manual setup: OpenTelemetry

PraisonAI sends provider-prefixed models such as anthropic/claude-haiku-4-5 through LiteLLM. The OpenInference LiteLLM instrumentor turns each model call into an OpenInference LLM span, which Agnost AI accepts. PraisonAI does not emit agent or tool spans of its own, so the setup below adds them with OpenInference’s @tracer.agent and @tracer.tool decorators.

Install

Setup

TracerProvider here comes from openinference.instrumentation. It is the standard OpenTelemetry SDK provider plus the agent and tool decorators. using_attributes puts session.id and user.id on every span inside the block, so Agnost AI groups the run into one conversation and attributes it to the user. One agent.start() call with one tool call produces four events in Agnost AI:
  • an agent event named weather-agent with the prompt as input and the final answer as output
  • one llm event per model call, with the user message, the reply, the model name, and token counts
  • a tool event named get_weather with the tool arguments and result
@tracer.tool keeps the function name, signature, and docstring, so PraisonAI still builds the same tool schema from it.
PraisonAI calls the OpenAI SDK directly, not LiteLLM, when model is a bare OpenAI name such as gpt-4o-mini. For that case also install openinference-instrumentation-openai and call OpenAIInstrumentor().instrument(tracer_provider=provider) next to the LiteLLM instrumentor.

Verify

Run one run_agent(...) call, then open Conversations in Agnost AI and find sess-123. Confirm the conversation shows user u-42, an agent event, llm events with input and output text, and a tool event for each tool the agent called.

Troubleshooting

  • No events: confirm OTEL_EXPORTER_OTLP_HEADERS contains X-Agnost-Org-ID=<your-org-id> and that provider.force_flush() runs before a short script exits.
  • No llm events: call LiteLLMInstrumentor().instrument(...) before the first agent run, and use a provider-prefixed model such as anthropic/..., or add the OpenAI instrumentor for bare OpenAI model names.
  • Every run is a separate conversation: wrap the call in using_attributes(session_id=..., user_id=...) and reuse the same session_id for later turns.
  • No tool events: decorate the tool functions with @tracer.tool before passing them to Agent(tools=[...]).
  • Use one method per call path. Combining the Agnost AI SDK and OpenTelemetry on the same run creates duplicate events.

References

Next steps

  • Conversations: review the complete PraisonAI run.
  • Events: inspect agent, LLM, and tool events.
  • Patterns: organize production conversations by what users wanted.