Skip to main content
POST
/
v1
/
agent
/
search
/
runs
Dispatch a search agent run
curl --request POST \
  --url https://tako.com/api/v1/agent/search/runs \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "query": "<string>",
  "thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "effort": "medium",
  "source_indexes": [],
  "cards": true,
  "output_schema": {},
  "locale": "en-US",
  "timezone": "<string>",
  "output_settings": {
    "image_dark_mode": true
  }
}
'
import requests

url = "https://tako.com/api/v1/agent/search/runs"

payload = {
"query": "<string>",
"thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"effort": "medium",
"source_indexes": [],
"cards": True,
"output_schema": {},
"locale": "en-US",
"timezone": "<string>",
"output_settings": { "image_dark_mode": True }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
query: '<string>',
thread_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
effort: 'medium',
source_indexes: [],
cards: true,
output_schema: {},
locale: 'en-US',
timezone: '<string>',
output_settings: {image_dark_mode: true}
})
};

fetch('https://tako.com/api/v1/agent/search/runs', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://tako.com/api/v1/agent/search/runs",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'query' => '<string>',
'thread_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'effort' => 'medium',
'source_indexes' => [

],
'cards' => true,
'output_schema' => [

],
'locale' => 'en-US',
'timezone' => '<string>',
'output_settings' => [
'image_dark_mode' => true
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://tako.com/api/v1/agent/search/runs"

payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"effort\": \"medium\",\n \"source_indexes\": [],\n \"cards\": true,\n \"output_schema\": {},\n \"locale\": \"en-US\",\n \"timezone\": \"<string>\",\n \"output_settings\": {\n \"image_dark_mode\": true\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://tako.com/api/v1/agent/search/runs")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"effort\": \"medium\",\n \"source_indexes\": [],\n \"cards\": true,\n \"output_schema\": {},\n \"locale\": \"en-US\",\n \"timezone\": \"<string>\",\n \"output_settings\": {\n \"image_dark_mode\": true\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://tako.com/api/v1/agent/search/runs")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"thread_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"effort\": \"medium\",\n \"source_indexes\": [],\n \"cards\": true,\n \"output_schema\": {},\n \"locale\": \"en-US\",\n \"timezone\": \"<string>\",\n \"output_settings\": {\n \"image_dark_mode\": true\n }\n}"

response = http.request(request)
puts response.read_body
{
  "run_id": "<string>",
  "created_at": "<string>",
  "object": "agent.search.run",
  "thread_id": "<string>",
  "completed_at": "<string>",
  "result": {
    "answer": "<string>",
    "cards": [
      {
        "card_id": "<string>",
        "title": "<string>",
        "description": "<string>",
        "semantic_description": "<string>",
        "webpage_url": "<string>",
        "image_url": "<string>",
        "embed_url": "<string>",
        "sources": [
          {
            "source_name": "S&P Global",
            "source_description": "<string>",
            "url": "https://xignite.com",
            "source_text": "<string>"
          }
        ],
        "methodologies": [
          {
            "methodology_name": "Where the Data Comes From - S&P Global",
            "methodology_description": "The financial metrics are collected from S&P Global, where information is sourced from original regulatory filings, press releases, and subsequent restatements. Data points, including over 5,000 financial, supplemental, segment, ratio, and industry-specific items, are standardized across over 180,000 companies to ensure consistency and comparability across different reporting formats. This comprehensive and methodical process enables robust historical analysis and back-testing by seamlessly integrating diverse financial datasets while preserving the granularity of the original reports."
          }
        ],
        "source_indexes": [],
        "card_type": "<string>",
        "content": {
          "cost": 0,
          "data": "<string>",
          "records": [
            {}
          ],
          "dataset": {
            "columns": [
              {
                "name": "<string>"
              }
            ],
            "rows": [
              [
                "<string>"
              ]
            ],
            "total_rows": 123,
            "truncated": true,
            "ref": "<string>",
            "sources": [
              {
                "name": "<string>",
                "index": "data"
              }
            ],
            "provenance": "query"
          },
          "url": "<string>",
          "expires_at": "<string>",
          "total_rows": 123,
          "truncated": false,
          "export_pricing": {
            "baseline_usd": 123,
            "row_cpm_usd": 123,
            "free_rows": 123,
            "max_rows_ceiling": 123
          }
        },
        "relevance_score": 123,
        "nodes": [
          {
            "id": "<string>",
            "name": "<string>",
            "description": "<string>"
          }
        ]
      }
    ],
    "citations": [
      {
        "index": 123,
        "title": "<string>",
        "url": "<string>",
        "source_name": "<string>",
        "excerpt": "<string>",
        "publish_date": "<string>",
        "content": {
          "cost": 0,
          "data": "<string>",
          "records": [
            {}
          ],
          "dataset": {
            "columns": [
              {
                "name": "<string>"
              }
            ],
            "rows": [
              [
                "<string>"
              ]
            ],
            "total_rows": 123,
            "truncated": true,
            "ref": "<string>",
            "sources": [
              {
                "name": "<string>",
                "index": "data"
              }
            ],
            "provenance": "query"
          },
          "url": "<string>",
          "expires_at": "<string>",
          "total_rows": 123,
          "truncated": false,
          "export_pricing": {
            "baseline_usd": 123,
            "row_cpm_usd": 123,
            "free_rows": 123,
            "max_rows_ceiling": 123
          }
        }
      }
    ],
    "metadata": {
      "citations": [
        {
          "index": 123,
          "title": "<string>",
          "url": "<string>",
          "source_name": "<string>",
          "excerpt": "<string>",
          "publish_date": "<string>",
          "content": {
            "cost": 0,
            "data": "<string>",
            "records": [
              {}
            ],
            "dataset": {
              "columns": [
                {
                  "name": "<string>"
                }
              ],
              "rows": [
                [
                  "<string>"
                ]
              ],
              "total_rows": 123,
              "truncated": true,
              "ref": "<string>",
              "sources": [
                {
                  "name": "<string>",
                  "index": "data"
                }
              ],
              "provenance": "query"
            },
            "url": "<string>",
            "expires_at": "<string>",
            "total_rows": 123,
            "truncated": false,
            "export_pricing": {
              "baseline_usd": 123,
              "row_cpm_usd": 123,
              "free_rows": 123,
              "max_rows_ceiling": 123
            }
          }
        }
      ],
      "definitions": [
        {
          "term": "<string>",
          "definition": "<string>",
          "source_ref": 123
        }
      ],
      "assumptions": [
        {
          "title": "<string>",
          "description": "<string>",
          "category": "<string>",
          "source_ref": 123
        }
      ],
      "methodology": [
        {
          "title": "<string>",
          "description": "<string>"
        }
      ]
    },
    "structured_output": {},
    "structured_output_citations": {},
    "unfilled_fields": [
      "<string>"
    ],
    "structured_output_error": {
      "code": "<string>",
      "message": "<string>"
    },
    "request_id": "<string>"
  },
  "error": {
    "code": "<string>",
    "message": "<string>"
  },
  "usage": {
    "total_cost_usd": 123,
    "compute": {
      "cost_usd": 123
    },
    "data": {
      "cost_usd": 123,
      "datasets": 123
    }
  },
  "request": {
    "query": "<string>",
    "thread_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
    "effort": "medium",
    "source_indexes": [],
    "cards": true,
    "output_schema": {},
    "locale": "en-US",
    "timezone": "<string>",
    "output_settings": {
      "image_dark_mode": true
    }
  }
}
{
"code": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}
The Search 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 Search 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 SearchAgentRun whose status is queued. Poll Poll a Search 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 SearchAgentStreamEnvelope 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 Search Agent and to one set of source_indexes.

Authorizations

X-API-Key
string
header
required

Body

application/json

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

query
string
required

Natural-language data-retrieval request for the search 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

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

Available options:
medium
source_indexes
enum<string>[]

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'.

Available options:
data,
web
Examples:
["data"]
["web"]
["data", "web"]
cards
boolean
default:true

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.

output_schema
Output Schema · object | null

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.

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 (e.g. 'America/New_York') used to render dates/times in card preview images. Does not affect the returned data.

output_settings
AgentOutputSettings · object | null

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).

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

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.

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

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
SearchAgentRunRequest · object | null

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