AI Agents
Monitor LLM calls and AI agent runs in Rustrak: model and tool calls, token usage, latency and failures, from the data Sentry SDKs already send.
If your app calls an LLM or runs an AI agent, Agents shows each run: the model calls and tool calls inside it, how many tokens they used, how long they took and which failed. It reads the same data as Sentry’s AI Agent Monitoring, so there is nothing to install on the server.
Send AI data
Turn on your Sentry SDK’s AI integration and tracing. With the Vercel AI SDK in Node.js:
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: 'YOUR_DSN',
tracesSampleRate: 1.0,
integrations: [Sentry.vercelAIIntegration()],
});JavaScriptimport { generateText } from 'ai';
import { openai } from '@ai-sdk/openai';
await Sentry.startSpan({ name: 'research_agent', op: 'gen_ai.invoke_agent' }, () =>
generateText({ model: openai('gpt-4o'), tools: { webSearch /* your tools */ }, prompt: 'Find the latest Rust release' }),
);JavaScriptThe integration records every model call and tool call. Wrap a run in a gen_ai.invoke_agent span to name the agent. Other SDKs have their own AI integrations, such as Python’s for OpenAI, Anthropic and LangChain; any of them works.
Rustrak treats a span as AI when its op starts with gen_ai. or ai., or when it carries gen_ai.operation.name. AI spans travel inside your performance data, so tracing must be on.
Overview
The Overview tab sums up the window: agent runs, LLM calls, tool calls, tokens, average and p95 duration, and errors as a share of AI spans. Below it, runs and duration over time, then two tables:
- Models: requests, errors, input and output tokens, average and p95 latency per model
- Tools: calls, errors, average and p95 latency per tool
Click a row in either table to see the runs that used that model or tool. Narrow everything with the environment filter, the window (last hour to 30 days, or all time) and the search bar, which takes agent:, model:, tool: and status:. A view keeps the tab, the window and the search for next time.
There is no cost widget on purpose: model prices change too often to estimate, so Rustrak shows exact token counts.
Traces
The Traces tab lists one row per run: the agents involved, duration, LLM calls, tool calls, tokens, errors and start time. A run with no agent name shows as (unnamed agent).
Open a run to see its spans as a Waterfall, or switch to Agents to see which agents ran and handed off to each other. Click a span for its agent, model, tool, token counts (input, cached input, output, total), the messages sent and received, the system instructions, the tools offered and requested, and every attribute.
When an LLM call has no response model, Rustrak uses the requested model.
Conversations
The Conversations tab groups runs that share a gen_ai.conversation.id, so you can read a chat turn by turn. Set that attribute on your agent spans to fill it.
Turn agents off
A project that does not use AI can drop this data: Settings → Data → Products turns Agents off. Rustrak then stops storing AI spans as they arrive; what is already stored stays. Turning Performance off turns Agents off too.
API and storage
Every widget has an endpoint under /api/projects/{id}/agents/: summary, runs, duration, models, models/calls, models/tokens, tools, tools/stats, traces, conversations and conversations/{id}. All but conversations/{id}, which returns the whole conversation, take period_hours, and the time series also take interval_hours. The MCP server reads the same data.
AI spans count toward storage. Spans sent inside a transaction are removed with it by retention cleanup; spans sent on their own are not removed by cleanup yet.