Install
LLM monitoring ships as an optional extra. Install the agent with it:If you turn LLM monitoring on without the extra, the agent logs a warning that it is unable to
instrument LLMOBS and carries on without it. Your application is not affected.
Enable LLM monitoring
AddLLMOBS next to your license key and app name. This example is for Django, in your
settings.py:
settings.py
LLMOBS key wherever you configure the agent.
See the Python agent installation guides for where
that is.
Restart your application after the change. The agent must start before the LLM libraries are used,
which is the same rule as the rest of the agent.
Supported libraries
These are traced automatically when the library is installed in your environment.Group calls with decorators
By default each model call is its own span. To group calls into a workflow, an agent, or a tool call you define yourself, wrap your functions with the decorators:workflow, task, agent, and tool. Each one works on sync and async
functions, and the spans nest under the call that started them. See
Span kinds for how each kind is shown.
Where the data appears
Your application shows up under both APM and LLM in the dashboard. The APM views are unchanged, and the LLM views add the model, token, cost, and prompt detail. An application appears under LLM only after it has sent its first LLM span, so make a call through one of the traced libraries before looking for it.Next steps
- Span kinds explains how each kind of LLM span is classified.
- Cost and tokens covers how cost is calculated.
- Python agent overview covers installing and configuring the agent itself.