Skip to main content
POST
Dispatch a retrieval agent run
The Retrieval Agent researches a natural-language question across Tako’s knowledge and the live web, then returns schema-defined structured data (structured_output) plus visualization cards and a cited answer. Use it for questions that need real retrieval work — resolving a cohort, ranking or filtering a set, multi-hop aggregation. See the Retrieval Agent guide for examples, structured outputs, streaming, threads, and sources.

Notes

  • To authenticate, send your Tako API key in the X-API-Key header. Store it as an environment variable rather than hardcoding it.
  • The agent is asynchronous: this endpoint returns 202 with a RetrievalAgentRun whose status is queued. Poll Poll a Retrieval Agent run until status is completed or failed.
  • To stream progress live instead of polling, send Accept: text/event-stream. The response is then a Server-Sent Events stream of RetrievalAgentStreamEnvelope events. See the coding-agent reference.

Structured output

Pass an output_schema (JSON Schema) to get machine-usable JSON in result.structured_output. Mark a property with "x-tako-dataset": true to request a dataset slot, filled with exact retrieved rows. Supported subset: object/array/string/number/integer/boolean, enum, required, description. Caps: 16 KB, depth 5, 64 properties, 4 dataset slots — violations return 400 output_schema_invalid.

Choosing sources

source_indexes is optional and defaults to ["data", "web"] — both. Pass it only to restrict: ["data"] (curated knowledge graph only) or ["web"] (open web only). The legacy value "tako" is a synonym for "data".

Continuing a thread

Pass the thread_id from a prior run to ask a follow-up in the same conversation. Omit it to start a new thread. A thread is pinned to the Retrieval Agent and to one set of source_indexes.

Authorizations

X-API-Key
string
header
required

Body

application/json

Request body for POST /v1/agent/retrieval/runs.

query
string
required

Natural-language data-retrieval request for the retrieval agent.

Example:

"S&P 500 semiconductor companies' 2024 revenue and YoY growth"

thread_id
string<uuid> | null

Existing thread to continue (follow-up). Omit to start a new thread.

effort
enum<string>
default:medium

Retrieval-agent effort. Only 'medium' is currently supported.

Available options:
medium
source_indexes
enum<string>[]

Which sources the agent may use: 'data' (curated knowledge), 'web' (open-web search), or both. Defaults to ['data', 'web']. Tako accepts the legacy value 'tako' as a synonym for 'data'.

Available options:
data,
web
Examples:
cards
boolean
default:true

Whether the agent may build visualization cards. The default is true and permissive: the agent may build cards, but it does not have to (a completed run with no cards is legitimate). Set false to suppress card building entirely.

output_schema
Output Schema · object | null

JSON Schema for structured output. The agent writes the synthesized fields. Dataset slots (marked with x-tako-dataset: true) receive exact retrieved rows as a TakoDataset. Supported subset: the object, array, string, number, integer, and boolean types, plus enum, required, and description. Caps: 16KB, depth 5, 64 properties, 4 dataset slots. Violations return 400 output_schema_invalid.

locale
string
default:en-US

BCP-47 locale. Drives the language of the agent's answer and the locale used when rendering card preview images. Defaults to en-US.

timezone
string | null

IANA timezone (for example, 'America/New_York'). The agent uses it to render dates and times in card preview images. It does not affect the returned data.

output_settings
AgentOutputSettings · object | null

Settings that control the response and rendering.

Response

Run dispatched. With Accept: application/json, poll GET /v1/agent/retrieval/runs/{run_id} for the run status. With Accept: text/event-stream, the response is an SSE stream of RetrievalAgentStreamEnvelope events. The stream ends at stream_done. If the stream ends without an agent_result event, poll GET /v1/agent/retrieval/runs/{run_id} for the terminal status.

The retrieval-agent run resource returned by dispatch (202) and poll (GET).

run_id
string
required
status
enum<string>
required
Available options:
queued,
running,
completed,
failed
created_at
string
required
object
string
default:agent.retrieval.run
Allowed value: "agent.retrieval.run"
thread_id
string | null
completed_at
string | null
result
RetrievalAgentResult · object | null

Final retrieval-agent output. answer is markdown prose with [n] citation markers. cards reuse the sibling TakoCard. citations is the unified top-level registry for data and web sources — there is no web_results field. metadata carries definitions, assumptions, and methodology. The structured_output_* fields carry the caller-shaped output_schema result; they are present only if the request supplied output_schema. See each field's description for the exact presence rules.

error
ErrorObject · object | null
usage
Usage · object | null

Usage for one metered request. total_cost_usd is always present (the total quoted charge). compute and data are the additive breakdown; each appears only where it applies. total_cost_usd always equals the sum of the components that appear.

request
RetrievalAgentRunRequest · object | null

Request body for POST /v1/agent/retrieval/runs.