Start a chat
Changed onHands the agent a job in natural language and opens a chat for it. The agent works the account through the API and every connected integration, like a chat in Crevio, and spends credits the same way. Returns the chat's first run: 202 while it works, or 200 with the agent's reply in result when it settled within wait_seconds. Pass response_format to get the reply as validated JSON in json. Continue the conversation with POST /chats/{id}/messages. Needs the agent scope. 402 insufficient_credits when the account has no credits left.
Request
- Base URLhttps://api.crevio.co/v1
- AuthAPI key in header Authorization
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
What you want done, with all the context the agent needs.
Ask for a JSON reply instead of prose: a JSON Schema, or OpenAI's {type: "json_schema", json_schema: {schema}} (or {type: "json_object"}). The settled run carries the parsed value in json, validated against the schema, or why it failed in json_error.
Hold the response until the run settles, up to this many seconds. 200 with the reply when it settled in time, 202 with the run still going otherwise: poll GET /task_runs/{id}.
A public https URL to POST the finished run to, with its reply, once the run ends (completed, failed, unknown or cancelled), so you need not hold the request open or poll. A run in needs_input has not ended. Failed deliveries retry for about three days; a 4xx stops them. The request is not signed, so use an unguessable URL.
supervised pauses in needs_input before each gated write; read_only forbids writes.
faster thinks less, for simple jobs; smarter (default) thinks it through.
Slug or id of one of your installed skills (GET /skills). The run reads that skill's SKILL.md first and follows it. 422 skill_not_installed when the account has no such skill installed.
Response
The run settled within wait_seconds, with its reply
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