Tracing

Tracing allows you to debug your AI agents and identify issues.

Example of a trace

Feedback tracking

The easiest way to get started with traces is to use our utility wrapper to automatically track your agents and tools.

Wrapping Agents

By wrapping an agent, input, outputs and errors are automatically tracked.

Any query ran inside the agent will be tied to the agent.

// By wrapping your agent's function input, outputs and errors are automatically tracked.
// Sub tools and logs will be tied to the correct agent.
const myAgent = monitor.wrapAgent(async function MyAgent(input) {
// Your agent custom logic
// ...
})
await myAgent("Hello, how are you?")

If you prefer to use anonymous functions, make sure to pass a name as a 2nd argument to the wrapAgent and wrapTool methods.

const myAgent = monitor.wrapAgent(
(input) => {
// Your agent custom logic
// ...
},
{ name: "MyAgent" }
)
from llmonitor import agent
@agent()
def MyAgent(input): # Your agent custom logic # ...
pass

Wrapping Tools

If your agents use tools, you can wrap them as well to track them.

If a wrapped tool is executed inside a wrapped agent, the tool will be automatically tied to the agent without the need to manually reconcialiate them.

// By wrapping the tool, input, outputs and errors are automatically tracked.
// And sub tools / logs will be tied to the correct agent.
const calculator = monitor.wrapTool(async function Calculator(input) {
// Your custom logic
// ...
})
await calculator('1 + 2')
from llmonitor import tool
@tool(name='MySuperTool')
def MyTool(input): # Your tool custom logic # ...
pass

Questions? We're here to help.