Maxim’s SDK allows you to monitor tool calls (external APIs, internal functions, or any callable operations in your AI application) by capturing the complete lifecycle including arguments, results, timing, and errors.
Use the toolCall method on a trace or span to create a tool call log entry. Provide the tool call ID, name, description, and arguments:JavaScript/TypeScript:
const toolCall = trace.toolCall({ id: 'database-query-001', name: 'query_user_database', description: 'Queries the user database for customer information', args: JSON.stringify({ userId: '12345', fields: ['name', 'email', 'preferences'] }),});
Python:
tool_call = trace.add_tool_call({ "id": "database-query-001", "name": "query_user_database", "description": "Queries the user database for customer information", "args": json.dumps({ "userId": "12345", "fields": ["name", "email", "preferences"] }),})
Automatic Tool Call Logging with Framework Integrations
If you’re using agent frameworks like LangChain, LlamaIndex, or OpenAI Agents SDK with Maxim’s instrumentation, tool calls are automatically logged without manual instrumentation. The SDK captures tool invocations, arguments, results, and errors as part of the agent trace.