Dispatch a Search Agent run
Dispatch a Search Agent run — agentic data retrieval returning structured outputs and cards
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 Search Agent guide for examples, structured outputs, streaming, threads, and sources.
Notes
- To authenticate, send your Tako API key in the
X-API-Keyheader. Store it as an environment variable rather than hardcoding it. - The agent is asynchronous: this endpoint returns
202with aSearchAgentRunwhosestatusisqueued. Poll Poll a Search Agent run untilstatusiscompletedorfailed. - To stream progress live instead of polling, send
Accept: text/event-stream. The response is then a Server-Sent Events stream ofSearchAgentStreamEnvelopeevents. See the coding-agent reference.
Structured output
Pass anoutput_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 thethread_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 Search Agent and to one set of source_indexes.Authorizations
Body
Request body for POST /v1/agent/search/runs.
Natural-language data-retrieval request for the search agent.
"S&P 500 semiconductor companies' 2024 revenue and YoY growth"
Existing thread to continue (follow-up). Omit to start a new thread.
Search-agent effort. Only 'medium' is currently supported.
medium Which sources the agent may use: 'data' (curated knowledge) and/or 'web' (open-web search). Defaults to ['data', 'web']. The legacy value 'tako' is accepted as a synonym for 'data'.
data, web ["data"]["web"]["data", "web"]Whether the agent may build visualization cards. Default true and permissive: true means the agent MAY build cards, not that it must (a completed run with no cards is legitimate). false suppresses card building entirely.
JSON Schema for structured output. Synthesized fields are written by the agent; dataset slots (marked with x-tako-dataset: true) are filled with exact retrieved rows as a TakoDataset. Supported subset: object/array/string/number/integer/boolean types, enum, required, description; caps: 16KB, depth 5, 64 properties, 4 dataset slots. Violations return 400 output_schema_invalid.
BCP-47 locale. Drives the language of the agent's answer and the locale used when rendering card preview images. Defaults to en-US.
IANA timezone (e.g. 'America/New_York') used to render dates/times in card preview images. Does not affect the returned data.
Settings controlling the response/rendering.
Response
Run dispatched. With Accept: application/json, poll GET /v1/agent/search/runs/{run_id} for status. With Accept: text/event-stream, the response is an SSE stream of SearchAgentStreamEnvelope events terminating at stream_done; if the stream ends without an agent_result event, poll GET /v1/agent/search/runs/{run_id} for terminal status.
The search-agent run resource returned by dispatch (202) and poll (GET).
queued, running, completed, failed "agent.search.run"Final search-agent output. answer is markdown prose with [n] citation markers; cards reuse the sibling TakoCard; citations is the unified top-level registry (data + web, S1 §5.2) — there is no web_results field; metadata carries definitions/assumptions/methodology (citations lifted out). structured_output_* fields carry the caller-shaped output_schema result (S3 §5.1) — present iff the request supplied output_schema; see each field's description for the exact presence matrix.
Cost-plus usage for one metered request. total_cost_usd is always present
(the total quoted charge). compute / data are the additive breakdown and
appear only where they apply. See module docstring for the quote-vs-drawdown
caveat and the total == compute + data invariant.
Request body for POST /v1/agent/search/runs.