Action guide

Record the result of every tool call back to the agent

POST/v1/events · agent.tool_returned

Emit an `agent.tool_returned` event right after a tool finishes, before handing control back to the model. Stores the result status (success or failure), the duration and any error. Critical for diagnosing slow or flaky tools that derail an agent.

When to emit

Inside your tool dispatcher, immediately after the tool function resolves or rejects, before pushing the result back into the conversation.

Example payload
await recalled.events.create({
  action: "agent.tool_returned",
  actor: { id: user.id, email: user.email },
  organization: user.organizationId,
  metadata: {
    triggered_by_user: "value",
    conversation_id: "value",
    tool_call_id: "value"
  },
});
Metadata to include

Keep metadata flat and consistent across your service so it plays well with search and CSV exports.

KeyPurpose
triggered_by_userSame user id as the matching agent.tool_called event
conversation_idSame conversation id as the matching call
tool_call_idSame tool_call_id as the matching call, used to pair them
tool_nameName of the tool that just returned
resultsuccess or failure
duration_msHow long the tool took to run, in milliseconds
errorError message and code if result is failure
Suggested retention

Keep for at least 3 months. Useful for debugging timeouts and tool-side errors.

Related actions