Skip to main content
To get an in-depth, cited answer to a question, start a run with the query, wait for it to finish, and read the result. This guide demonstrates that workflow in full. The quickstart shows the shortest path to a result. This guide walks the same request through in more detail, including what the SDKs’ create_and_wait / createAndWait hide from you, and the manual poll a plain REST caller has to do instead.

1. Start a run

create_and_wait / createAndWait call create, then poll until the run finishes, and hand back the completed envelope. cURL has no waiter, so the same request only starts the run:
The cURL call returns at once with the run in pending state. output is present but its fields stay unset until the run reaches a terminal state:

2. Poll for the result

Retrieve the run by the id the create call returned. In Python and TypeScript, create_and_wait / createAndWait already did this polling for you above, so run there is already the finished envelope; get is the single check it repeats under the hood, useful on its own when you want to look a run up independently instead of holding onto the object create returned. Over cURL, this is the only way to find out whether the run is done:
See Poll for completion for the full loop that turns one check into “wait until done,” and for wait’s options. Check status before reading anything from output. A run that hasn’t finished yet comes back as running (or pending), not an error, and output’s fields stay unset, the same status as right after the run is created:
started_at distinguishes running from pending: it is null while a run waits for a worker, and set the moment one picks up the run. Keep polling until status is completed, failed, or cancelled, or use wait / createAndWait, which does exactly this loop for you. Once the status is completed, a completed run’s output.text is a cited Markdown report, with inline [n] markers pointing at output.sources:

3. Read the result

In Python and TypeScript, create_and_wait / createAndWait already returned this same envelope, so there is no separate call. Read run.output.text and walk run.output.sources for the citation list:
Example output

Next steps