Skip to main content

Overview

Call track_agent_call when your agent receives a user message and is about to invoke the LLM. This event marks the start of an agent turn and captures the prompt, model configuration, and which system prompt version is running.

Required fields

Node.js / Python SDK: distinctId / distinct_id is also required. Browser SDK: optional if the user has already called Trodo.identify() in the session.
Field (Node / Browser)Field (Python)TypeDescription
agentIdagent_idstringThe registered agent ID — e.g. 'agt_abc12345'
conversationIdconversation_idstringStable ID for the conversation thread
messageIdmessage_idstringUnique ID for this specific message turn
distinctIddistinct_idstringLinks the event to a Trodo user (required in Node/Python; optional in Browser if identify() was called)

Optional fields

Field (Node / Browser)Field (Python)TypeDescription
promptpromptstringThe user’s message or prompt text
modelmodelstringLLM identifier — e.g. 'gpt-4o', 'claude-3-5-sonnet'
providerproviderstringProvider name — 'openai', 'anthropic', 'google', etc.
temperaturetemperaturenumberSampling temperature passed to the LLM
systemPromptVersionsystem_prompt_versionstringTrack system prompt iterations — e.g. 'v1', 'prod-2024-06'
timestamptimestampISO 8601 stringOverride event time (default: now)

Examples

Trodo.track_agent_call({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  // distinctId is optional here — Trodo.identify() was called on login
  prompt: 'What is the status of my last invoice?',
  model: 'gpt-4o',
  provider: 'openai',
  temperature: 0.7,
  systemPromptVersion: 'prod-2024-06',
});
Pass a systemPromptVersion to track which prompt version drives the best outcomes in your Insights charts.