Get the result of an AI agent run
GET /ai_agents/{uuid}/runs/{runUuid}
/ai_agents/{uuid}/runs/{runUuid}Reads a run started with run_ai_agent: its state, the answer when it is completed, the sources, the tools the agent used, what it cost, how long it worked and, when it was stopped, the cause.
When to use: After run_ai_agent, to get the answer: call it again after retry_after_ms while state is queued or running, until it is completed or stopped. Also to read the cost of a run, or to see why it stopped.
When not to use: To start a task use run_ai_agent. Runs are kept 30 days; to find one whose uuid was lost use list_ai_agent_runs. A waiting_approval run does not move by polling: a person has to decide in Easymailing. Do not poll faster than retry_after_ms.
Permissions: Requires the automations.read capability. Only the person who started the run, and administrators of automations (automations.manage), can read it. What the agent read in the CRM is shown in tools_used only for records the reader can see.
Value for the X-Auth-Token header parameter.
In: header
Path Parameters
UUID of the agent.
uuidUUID of the run, from the answer of run_ai_agent.
uuidResponse Body
application/problem+json
application/problem+json
application/problem+json
application/problem+json
curl -X GET "https://api.easymailing.com/ai_agents/6e2f0a97-4b1c-4d35-9a8e-2c7d5f1b3e40/runs/d4a8f3c1-7b52-4e09-8c16-5a2e9d0b4f73" \ -H "X-Auth-Token: YOUR_API_KEY"{ "uuid": "095be615-a8ad-4c33-8e9c-c7612fbf6c9f", "agent": "/entity/1", "agent_version": 1, "source": "published", "state": "queued", "stop_cause": "ai_credits_exhausted", "limit_reached": "cost", "task": "string", "record": "/entity/1", "response_format": "text", "answer_text": "string", "answer_fields": {}, "sources": [ {} ], "tools_used": [ {} ], "spent": {}, "duration_ms": 0, "retry_after_ms": 0, "created_by": {}, "created_at": "2019-08-24T14:15:22Z", "started_at": "2019-08-24T14:15:22Z", "finished_at": "2019-08-24T14:15:22Z", "kept_until": "string"}