Read generation progress

get_job

Reads the progress of a site generation and the events it has produced since your last call.

POST /v1/get_jobScopechat:readRead only

Pass back the cursor from your previous call to receive only the new events. Leave out jobId to read the most recent generation in the chat, which is main, the chat every site comes with, unless you pass chatId, and a chat that has never run one answers with state null.

The response carries chatId, the chat the generation ran in, even when you passed only a jobId. Send any answer to a question the agent asked to that chat.

running means keep polling. stalled means the agent has sent no heartbeat for over a minute and no server is running the turn any more, and it is not an ending either: keep polling, because the platform resumes or closes a generation that has produced nothing for 15 minutes. heartbeatAt is when the agent last sent one, and starts at the time the generation was created. The endings are succeeded, failed and cancelled, and after a failed or canceled generation, or one that ended part way through, anything queued in that chat waits for resume_queue, except after a failure with SC-6002, described below.

A succeeded generation is not always a finished one. incomplete:true means the agent stopped part way through the turn, incompleteReason says how (terminal-reason, max-output-tokens, max-turns, max-budget, agent-error or no-closing-message) and incompleteCode carries the matching error code. The turn was still billed and anything it already changed was kept, so continue the work rather than starting it over.

When it stopped because the AI service hit a usage limit (incompleteCode SC-2001) or because it used every step it may take in one run (incompleteReason max-turns, incompleteCode SC-5004), the platform usually continues it for you. continuedBy then carries the jobId of the generation that picked the work up, so poll that one and do not send a continue yourself. While continuing is true that decision is still being made, so keep polling this generation until continuedBy appears or continuing turns false. Calling cancel_job on this generation while continuing is true stops the continue from starting.

A failed generation whose errorCode is SC-6001 ran out of AI credits part way through. It was stopped there, anything it already changed was kept, and only what the balance could cover was charged, so the workspace needs a plan or more credits before that work is sent again.

A failed generation whose errorCode is SC-6002 was stopped because the AI credits left were set aside for the other chats running in the workspace. Anything it already changed was kept, its chat's queue is not parked, and the work can be sent again once those chats finish. See Multiple chats.

When the response has reset:true, the generation was retried from the start, so discard the events you collected and continue from the new cursor. See When a run fails.

Request

Call it with a POST to https://api.modulify.ai/v1/get_job, sending the inputs below as a JSON object. The token needs the chat:read scope.

It only reads and changes nothing, so retrying it is safe.

curl -X POST https://api.modulify.ai/v1/get_job \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID"}'

Over MCP, the same method is the get_job tool.

Inputs

Input Type Required Description
projectId string Yes The site id.
jobId string No The generation id that send_message returned. Leave it out for the latest generation.
cursor integer No The cursor from your previous call. Use 0 or leave it out on the first call.
limit integer No How many events to return, up to 500. Defaults to 200.
chatId string No The chat whose latest generation to read when jobId is left out: main for the chat every site comes with, or the chatKey of another chat from list_chats. Defaults to main.

Response

Every call answers with the JSON envelope of success, message, data, code and version. data holds the result described above, and on a method that returns a total, count carries it. The response headers carry the call's X-Request-Id and what is left of your per-minute budget in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. Errors explains every status code a call can answer with.