Skip to main content
Preview. Operations are available to organisations in the Wordsmith MCP and files pilot. See the preview overview. This page describes how they work as built.
Every API request must finish within 29 seconds. A playbook review takes minutes. A report over 200 documents can take much longer. So every endpoint that can outlast a request starts the work in the background and returns an operation straight away. An operation is a handle with a status. You can poll it, long-poll it, or receive a callback when it finishes. The same pattern covers every long-running endpoint in the API and every long-running tool in the MCP server.

The operation object

  • status moves from queued to running, then to one of succeeded, failed or cancelled.
  • resource names the object the operation works on. Read it for the full picture, for example GET /reviews/{id}. resource.id is null until the work has created its resource, such as the session a draft runs in.
  • progress is set while the work runs, and a finished operation keeps its last progress.
  • result is set on success. For a review it holds finding counts and the redline file_id. For a document action it holds the new file_ids. Get Operation lists the result of every type. Numbers in result are JSON numbers.
  • error is set on failure, with a code, a message and retryable.

Three ways to wait

Getting the result in one call

Every endpoint that starts an operation also takes wait, from 0 to 20 seconds. Quick work, such as comparing two short files or filling a blueprint from your own values, then comes back finished in the same response:
If the work is not finished when wait runs out, you get the operation as usual and carry on from there. Code written for the slow path always works.

Retrying safely with Idempotency-Key

If your request times out, you cannot tell whether the review started. Send an Idempotency-Key header on every request that starts an operation:
  • The first request with a key starts the operation.
  • A repeat with the same key and body within 30 days returns the same operation with 200. Nothing runs twice, and you are not charged twice.
  • If the key’s operation failed before its work started, with error.code request_failed and retryable true, a repeat starts the work in a new operation with a new id, and the key then returns that one. The failed operation keeps its id, its outcome and its callback.
  • A repeat with the same key and a different body returns 409 idempotency_key_reused.
Use a fresh key for each piece of work, such as a UUID you store next to the job in your own system.

When an operation fails

error.retryable says whether the same request can succeed on a new attempt. A retryable request_failed operation never started, so a repeat with the same Idempotency-Key starts the work in a new operation. For any other failure, start the work again with a new key.

Cancelling

Cancel Operation asks the worker to stop. Cancellation is best-effort: the operation may read running for a few seconds before it turns cancelled. Work already done, such as cells computed in a report, is kept and charged.

Limits

Each endpoint that starts an operation keeps its own limits, such as the request limit and credits. A long-poll counts once against the request limit, however long it holds.

Which endpoints return an operation

The proposal also planned a research report (research_report). It was not built: for a researched memo, ask an agent with Create Question. Questions keep their existing status endpoint, and each one also gets an operation, so the same waiting code works for them.