Skip to main content

Tool Runs

GET /v1/agents/{agentId}/tool-runs lists every time the agent's AI used a tool, across every tool: a custom API tool, a Google Sheets or Calendar operation, a Shopify lookup, the built-in lead capture. Each run names the tool as it was then, how it went, the conversation it ran in and the ad that conversation came from. It's read-only and costs no messages. Use it to audit what the AI did in your systems, to reconcile bookings and rows with your own records, to trigger your own automations, and to see which ads produce outcomes, not just conversations.

How do I list this week's bookings?​

curl "https://api.mojeeb.app/v1/agents/YOUR_AGENT_ID/tool-runs?provider=google_calendar&operation=create_event&since=2026-10-20T00:00:00Z" \
-H "Authorization: Bearer mk_live_YOUR_KEY_HERE"

Runs come newest first, cursor-paginated like every list. Each one carries tool (its id, current name, provider and operation), status (pending, success or failed), error, duration_ms, conversation_id, contact_id (the person the conversation is with, so a booking or a sheet row leads straight to the contact), ad_id and ran_at. Filter with tool_id, provider (google_sheets, google_calendar, shopify, custom_api for a custom API tool, custom for an older API call or webhook, mojeeb for the built-in lead capture), operation (add_row, create_event, lead_capture, and so on), status, conversation_id, ad_id, or a window on ran_at with since and before. A list filtered by provider, operation, status or conversation_id covers the last 90 days of runs unless you send since; tool_id and ad_id have no such limit. See the List tool runs reference.

How do I see what was sent and what came back?​

The list leaves both out. GET /v1/agents/{agentId}/tool-runs/{runId} adds request, the request as the AI built it with no headers, every query-string value masked and sensitive body keys masked, and response, what the tool returned as stored. Both keep the stored objects' keys, which follow the tool's kind: a custom API tool's request has method, endpoint and body and its response has status_code and output; an integration's hold the operation's inputs and result. See the Get a tool run reference.

Which ad produced these?​

ad_id on a run is the ad behind the conversation's latest touch at the moment the run happened, so a booking made in a conversation that came from an ad carries that ad. Filter with ad_id to list the outcomes of one ad, and read the ad with Get an ad. A run in a conversation that had no touch, or one recorded before touch tracking began on 20 October 2026, has ad_id null.

Common questions​

Why is tool.name null on some runs?​

The tool was deleted after the run. Its provider and operation stay on the run, since they were recorded when it happened; only the name, which lives on the tool, is gone.

How is this different from a custom API tool's runs?​

Custom API Tools has a runs list under one tool, with the same run shape minus the tool block. This list spans every tool of the agent, including the integrations and the built-in lead capture, and adds the tool, the ad and the filters.

Can I trigger my own automation from a run?​

Poll the list with since set to your last check and act on what is new, for example notify your team when a create_event run succeeds or open a ticket when a run fails. Keep the last ran_at you handled as the next since.

Which scopes do these calls need?​

tool_runs:read for both. It has no write scope: runs are written by the agent alone. Every key holds it today; see Authentication.