Kick off a Trigger.dev agent chat run and get a runId to poll for completion.
runId the caller polls via pollAgentChat until the agent finishes. For real-time streaming UIs, use streamAgentChat instead; for inline blocking calls where you don’t need tokens as they arrive, use syncAgentChat.
retryAfter (seconds) field and the standard Retry-After header. Respect it.Conversation handling. Pass conversationId on follow-up turns to persist history in the same thread. If omitted, the server creates a new conversation labeled with the first 100 chars of message. Conversations not owned by the caller return 404.Typical flow:POST /api/agent/chat with { message } → get runIdGET /api/agent/chat/{runId} every 1–2 s until status reaches completed, failed, or cancelledcompleted, read text, messages, toolCalls from the poll responseBearer authentication header of the form Bearer <token>, where <token> is your auth token.
The user's prompt for this turn. Required, non-empty.
1Prior conversation turns. Omit to start a fresh conversation. Ignored when conversationId resolves to an existing conversation — the server loads history from the DB.
Existing conversation UUID (returned from a previous startAgentChat or syncAgentChat call). If omitted, a new conversation is created from the first 100 chars of message. Must be owned by the caller or the endpoint returns 404.
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Run queued.
Trigger.dev run id (starts with run_). Pass to pollAgentChat to watch status.
Always queued — the run is dispatched but not started yet.
queued The conversation the run is writing into. Present unless conversation creation failed mid-call (non-fatal — the run still proceeds without history).
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$