Skip to main content

Overview

Agent Analytics lets you measure the behavior of AI agents built on any LLM provider. Every method call counts as one event toward your plan limit and appears alongside your regular events in Insights, Funnels, Flows, and Retention.

The 5 tracking methods

MethodWhat it capturesRequired extra field
track_agent_callInbound message / LLM invocation
track_tool_useTool or function call within a turntoolName / tool_name
track_agent_responseLLM output, token counts, cost
track_agent_errorErrors — rate limits, timeouts, tool failures
track_feedbackUser satisfaction, rating, or text commentat least one of satisfaction / rating / feedback

Step 1 — Register your agent

Go to Integrations → AI Agents and click Register New Agent. Enter a name and optional description. You’ll receive an agent_id in the format agt_xxxxxxxx. Use this ID in every tracking call.

Step 2 — Required fields on every call

All 5 methods share these 4 required fields:
FieldNode.jsPythonDescription
Agent IDagentIdagent_idYour registered agent ID (agt_xxxxxxxx)
Conversation IDconversationIdconversation_idStable ID for the conversation thread
Message IDmessageIdmessage_idUnique ID for this specific message turn
User IDdistinctIddistinct_idRequired in Node.js and Python. In the Browser SDK this is optional if the user has already called Trodo.identify() — the session carries the identity automatically.

Quick example — full turn

import trodo from 'trodo-node';

const agentId = 'agt_abc12345';
const messageId = `msg_${Date.now()}`;

await trodo.track_agent_call({
  agentId, conversationId, messageId, distinctId: userId,
  prompt: userMessage, model: 'gpt-4o',
});

try {
  await trodo.track_tool_use({
    agentId, conversationId, messageId, distinctId: userId,
    toolName: 'fetch_billing', status: 'success', latencyMs: 82,
  });

  const response = await openai.chat.completions.create({ ... });

  await trodo.track_agent_response({
    agentId, conversationId, messageId, distinctId: userId,
    model: 'gpt-4o',
    inputTokens: response.usage.prompt_tokens,
    outputTokens: response.usage.completion_tokens,
  });

} catch (err) {
  await trodo.track_agent_error({
    agentId, conversationId, messageId, distinctId: userId,
    errorType: err.type || 'unknown',
    errorMessage: err.message,
    traceback: err.stack,
  });
  throw err;
}

Method reference

MethodDetails
track_agent_callFull docs →
track_tool_useFull docs →
track_agent_responseFull docs →
track_agent_errorFull docs →
track_feedbackFull docs →

Analyzing agent data

Agent events appear in every Trodo analysis tool:
  • Insights — chart call volume, error rates, token usage over time for any agent
  • Funnelsuser signed up → first agent call → upgraded conversion
  • Retention — users who used the SupportBot on day 0, returned on day 7?
  • Flows — see agent calls as steps in the full user journey
Open the event picker in any tool and choose the Agent Calls, Agent Tools, or Agent Errors tab to add an agent metric as a step or filter.