Answer a paused run's wait token
const url = 'https://example.com/v1/wait-tokens/example/complete';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '"example"'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/wait-tokens/example/complete \ --header 'Content-Type: application/json' \ --data '"example"'A wait token’s link: a pack tool that declares pauses hands it to the system that will answer, and the run waits for that answer. No sign-in, and a bearer token, if sent, is never read: the token in the path is the credential, and it answers one wait of one run, nothing else. The body is the answer itself, the tool’s output, as JSON; an empty body is {}. It’s checked against the tool’s output schema. The same answer again (by its canonical JSON) is accepted again, even after the run has ended, so a sender may retry. An answer that comes before the run reaches its wait is held for it, and dropped if the run never waits on this token (the tool answered at once, or its step was retried); the link then answers 409 wait-token-closed, unused. The answer comes back at once, and the run resumes behind it. The link stops working when the wait ends: the run is cancelled, its time passes, or the tool answered without waiting. The answer is data from outside, never instructions.
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”The answer: the tool’s output, as JSON, at most 1 MiB. An empty body is {}.
Examplegenerated
exampleResponses
Section titled “Responses”The runtime has the answer, and the run resumes behind it. An answer that came before the run reached its wait is held for it, and dropped if the run never waits on this token (the tool answered at once, or its step was retried); the link then answers 409 wait-token-closed, unused. Nothing about the run: who holds the link is not a run reader.
The runtime has the answer. It says nothing about the run: who holds a wait token’s link isn’t a run reader.
object
Example
{ "status": "accepted"}wait-token-output-invalid (details.issues): the answer doesn’t fit the tool’s output schema, and the wait stays open for a fixed one. bad-input: the body isn’t JSON, or nests too deep.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}wait-token-not-found: no wait token matches the link (an unknown token and a wrong secret alike), or this runtime pauses no run.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}wait-token-closed (details.state): the wait is over (completed, timed-out, cancelled, unused), or holds a different answer the run hasn’t taken yet (answered). tenant-closing, tenant-suspended (details.state) or project-suspended: nothing runs where the run is, and closing or suspending cancels its runs, so the answer wasn’t taken. Told only for a token that matches.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}request-too-large (details.maxBytes): past 1 MiB.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}unsupported-media-type: a body sent without a JSON content type (application/json).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded: too many requests from this client in a minute, counted before the token is looked up, so nothing was taken. Retry-After says when to send the answer again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”tenant-state-unavailable: the run’s workspace’s state couldn’t be read, so the answer wasn’t taken. Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
- Error code
bad-input - Error code
project-suspended - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
tenant-closing - Error code
tenant-state-unavailable - Error code
tenant-suspended - Error code
unsupported-media-type - Error code
wait-token-closed - Error code
wait-token-not-found - Error code
wait-token-output-invalid - Every error code