Skip to main content

Overview

Call track_tool_use each time your agent invokes a tool or function within a message turn. A single turn can produce many tool calls — each one is stored as a separate row and is not deduplicated. Use the shared messageId / message_id to group all tool calls belonging to the same turn.

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)
toolNametool_namestringThe name of the tool being invoked — e.g. 'fetch_billing_info'

Optional fields

Field (Node / Browser)Field (Python)TypeDescription
statusstatusstringAny string — 'success', 'failure', '200', '429', HTTP status codes, custom labels
latencyMslatency_msnumberHow long the tool call took in milliseconds
inputinputanyTool input payload (stored in properties.input)
outputoutputanyTool output / result payload (stored in properties.output)
timestamptimestampISO 8601 stringOverride event time

Examples

Trodo.track_tool_use({
  agentId: 'agt_abc12345',
  conversationId: 'conv_9kx2m7pq',
  messageId: 'msg_01jf3t8r',
  toolName: 'fetch_billing_info',
  status: 'success',
  latencyMs: 212,
  input: { customerId: 'cus_8xp3nk7' },
  output: { invoiceId: 'inv_4421', amount: 149.00, status: 'paid' },
});