Skip to main content
POST
Ask the retrieval sub-agent

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

database
string
required

Target database.

Body

application/json

POST /v1/sub_agent/{database}: a question about the database's data, and how to scope and bound the retrieval that answers it. An unknown field is refused.

question
string
required

The question, in natural language, about the database's data. What the question names (its numbers, names, quoted terms and identifiers) is what a validated result must contain, so put only the question here.

answer
boolean

Compose a written answer from the facts as well: once the facts are final, a model is shown them with every line numbered as it is in the source and writes the answer for a developer, citing the facts' lines. The facts still come back beside it, and the answer's citations are checked against them, repaired where the facts say where a citation belongs, and, on a deployment that runs a grading model, graded against the lines they cite (coverage.answer reports all of it). A caller that writes its own prose leaves this off and reads the facts.

context
string | null

Text shown to the model beside the question and not part of it: a description of the data, a hint, a convention. Nothing in it is required of the result.

facts
object[] | null

The rows to write the answer from, when the caller already holds them from its earlier calls: the retrieval does not run, the writer is shown these rows and no others, and the answer's citations are checked against them. A row given by its place alone (path and a line inside it, start_line, on a code table, or a table's key cells) is read back from the table, so the writer sees its lines as the index holds them; a row given with other cells is shown as given. Requires answer: true and table; more rows than the deployment's facts limit is refused.

include_transcript
boolean

Return the whole conversation, every model reply and tool result, as transcript beside the facts.

k
integer | null

Facts returned at most: 10 when omitted, as many as asked otherwise, up to the deployment's limit (1,000 by default; above it the request is refused). The sub-agent's searches fetch a multiple of this many rows (10 times by default) as the candidates ranked against the question before the top k go back.

Required range: x >= 0
max_turns
integer | null

Fewer turns than the deployment allows, when the caller wants a cheaper answer; a value above the deployment's cap is lowered to it.

Required range: x >= 0
max_wall_secs
integer<int64> | null

A shorter wall-clock budget than the deployment allows, in seconds; a value above the deployment's cap is lowered to it.

Required range: x >= 0
playbook
string | null

A playbook of learned notes for the sub-agent to read beside its instructions: the label the notes were stored under, the session_id of the database's memory rows of kind playbook. The notes nearest the question are recalled once per call. Omitted, no playbook is read.

projection
string[] | null

The columns a search or find fact carries beside the text and the score, for a caller who knows which columns place a row (a code table's path, start_line, end_line), each applied to the tables that have it. Omitted, a fact carries the table's key columns, or the engine's row id when it has none. A list naming no column of any table is refused.

table
string | null

The one table the question is about, when the database holds several. The sub-agent is then shown that table's card alone, so it cannot wander to a sibling. A name that is not a described table of the database is refused with 404. Omitted (and with no tables), every table's card is shown.

tables
string[]

The tables the question is about, when it is about more than one and less than all: the sub-agent is shown their cards alone and may join them. With table too, the scope is both. A table named here with no card yet (or no such table) is left out of the scope and listed in the response's left_out; the request is refused with 404 only when none of the named tables has a card and no table is given.

Response

The facts: the rows of the query that validated (it ran on the database, returned rows, and the rows contain what the question asked for: its numbers, names, quoted terms and identifiers; the statement's text counts for nothing; or, for an aggregate (a GROUP BY, a COUNT, SUM, AVG, MIN or MAX), it returned a non-zero number), the top k of them (10 by default, up to the deployment's limit), ranked against the question by the deployment's embedding model when the query left their order to the engine (coverage.ranker names it; absent when the query's own order stands), each with the table it came from, plus the statement they came from and how many rows it returned in all. A question whose queries retrieved nothing still returns 200: after three failed attempts terminate is escalated and error carries the sub-agent's account of the problem for the caller to act on; a turn or wall cap is named the same way, with facts empty. inference_tokens is the one figure for the model work: the tokens the sub-agent's calls consumed, prompt and completion together, the count this call's inference was billed on. What the inference was billed is in the x-infino-inference-nanodollars response header.

The answer as the caller receives it (POST /v1/sub_agent/{database}): the facts and what produced them, and one figure for the model work. inference_tokens is the count the call's inference was billed on, so a bill can be checked against the responses. Always 200 once the sub-agent ran: a run that hit its turn or wall cap, or lost its model, reports that in terminate and error rather than as an HTTP failure, so a client can tell "nothing retrieved" from "the request was wrong".

coverage
object
required

How much of what the query returned facts holds, and what ordered them.

facts
object[]
required

The facts: the top k of the rows the validated query returned, ranked against the question when the query left their order to the engine (coverage.ranker names what ranked them), in the query's own order when it chose one. Every row is the database's; empty when the sub-agent ended with nothing retrieved.

inference_tokens
integer<int64>
required

Tokens the sub-agent's model calls consumed over the whole run, prompt and completion together, the composed answer's included: the count this call's inference was billed on.

Required range: x >= 0
retries
integer
required

Times a query or an answer was sent back to the model.

Required range: x >= 0
terminate
enum<string>
required

How the sub-agent's run ended.

Available options:
answered,
turn_cap,
wall_cap,
error,
escalated
turns
integer
required

Model turns the run took.

Required range: x >= 0
answer
string | null

The written answer, when the request asked for one (answer: true) and facts were there to write from: what the facts show, for a developer, citing their lines. Absent otherwise.

error
string | null

Why the run ended without facts, when it did: the model's failure; or, after three attempts validated no query (terminate: escalated), the sub-agent's own account of the problem, for the caller to act on. Absent otherwise.

left_out
string[]

Tables of the question's scope the sub-agent was not shown, because no card describes them yet: nothing of theirs is in the facts, so an empty or partial answer says nothing about them. Absent when every table in scope was consulted.

statement
string | null

The query the facts came from: SQL, or a search call written as the SQL it equals, or a find call. It is how to get every row again. Absent when the sub-agent ended with nothing retrieved.

transcript
object[] | null

The conversation, when the request asked for it (include_transcript: true): every model reply and tool result, in order, each a JSON object. Absent otherwise.