Test-run a task
Changed onFire the task once as a test. The run does real research and produces real output, but every write-style tool refuses and every configured delivery is captured on the run instead of being sent. Poll the returned run, then read captured_deliveries for the exact message each channel would have received. Called from an agent chat, the chat is signalled when the run ends, so it need not poll.
To test an event-triggered task against a sample record (a fake order, lead or form answer), pass event: the run receives it as its trigger event exactly as it would a real one, with type set to the task's event_conditions.event_type. Test the real task this way; there is no need to copy it onto a temporary webhook source. Without event, an event task runs with no trigger event. The task's condition_script is not applied to a test run.
A test run never counts as a run of the task: it does not advance next_run_at, does not reset or trip the failure breaker, does not count toward max_runs_per_day, and does not appear in the run history a later run reads. It does consume credits. 400 if event is malformed or the task is not event-triggered; 422 if the task already has a run in flight or the account is out of AI credits.
Request
- Base URLhttps://api.crevio.co/v1
- AuthAPI key in header Authorization
Path parameters
Task id (task_...)
Headers
Makes this write safe to retry: a repeat with the same key replays the first response instead of creating a second resource. Scoped to the account, remembered for 24 hours; reusing a key with a different payload is an error.
Request body
Event tasks only: the sample event the test run receives as its trigger event, shaped as a real one. data is what the run reads as event.data: for an app event, {"object": <the record as its GET endpoint returns it>}, e.g. {"data": {"object": {"id": "ord_test", "amount": 25000, "status": "succeeded", "contact": {"email": "jane@example.com", "first_name": "Jane"}}}} for order.paid; for a webhook source, the delivery's JSON body.
Response
Accepted — the test run executes in the background; poll GET /task_runs/{id}.
The run's own conversation (aichat_...): what it read, called and said. Read it with search_chats.
When a stop was requested. The run stays running until it reaches its next step, then settles as cancelled.
How the agent closed a completed run: verified (it re-checked the result), recorded (it reported without re-checking), or recovered (it never reported; summary is its last message). Null unless an agent turn completed the run.
The event that started this run, {type, data}, exactly as the run received it; data matches the event's webhook payload. Events that waited while the task was busy start one run together as {type, events: [{type, data}, ...]}, oldest first. Null for a run no event started. POST /task_runs/{id}/replay runs the task again on it.
The run (trun_...) whose event this run replays. Null unless started by POST /task_runs/{id}/replay.
The agent's final reply, once the run settled. Present on single-run responses, not in lists.
Why the reply did not parse or validate against response_format.
Changes
- warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status - warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status - warning
added the new
idempotency_errorenum value to theerror/typeresponse property for the response status
4 more changes in this revision
- warning