API & MCP
Structured query (v1)
POST /api/v1/query is the machine-readable front door to the semantic ↔ data layer: a third-party system sends a question and receives the full grounded result as one JSON document — the answer, its atomic claims, the document-source registry ([Sn]), the live data-call registry ([Dn]), the entities detected in the question, a groundedness verdict, the answer-policy block, and token usage. No screen scraping, no prose parsing. The authoritative schema is the OpenAPI document — browse it in the interactive API reference or fetch GET /api/v1/openapi.json directly.
/api/v1/queryBearer · agents:runRuns the structured query pipeline: retrieval over the workspace's documents, deterministic entity detection, optional governed live-data lookups, one chat-model generation, and a best-effort groundedness check. The workspace is resolved from the API key — it never appears in the URL or payload.
Request body
Response fields
Trust signals ride along
entities[].authority is the human-vetting tier from concept governance — certified is the only tier an assistant states without hedging — and retrieval tells you how strong the evidence pass was. The policy block distills both (plus groundedness) into one calibrated verdict, so a consumer can branch on policy.verdict instead of re-deriving trust from the raw signals.Enforce-mode short-circuits
When the workspace (or the per-call policyMode) is enforce and the pre-gate returns clarify or abstain_with_pointers, no generation happens. The response is still a complete StructuredAnswer: answer is a deterministic template (the clarifying question, or a short abstention), claims is empty and cites nothing, usage reports zero model tokens, and the policy block carries the verdict — clarify includes clarify.question + options (disambiguated entities as Name (type)), and abstain_with_pointers includes pointers to the closest documents (also mirrored into sources), never a bare refusal. In shadow mode the same verdicts are computed and logged as policy decisions but the answer is generated exactly as if the policy were off.
How the pipeline runs
- Model resolution first — a workspace without an enabled chat model gets
409 no-model-configuredbefore any retrieval work happens. - Semantic layer — the retrieval pipeline (query understanding, graph-fused hybrid retrieval, cross-encoder rerank, token-budget assembly) produces up to
maxSourceschunks, and deterministic entity detection runs alongside it. Entity detection never calls a model; the pipeline's understanding and rerank stages are network calls made outside any transaction, and each degrades to raw hybrid retrieval when unavailable — so this step is byte-identical to the old direct-retrieve path when no pipeline stage is active. TheretrievalDebugblock reports which stages ran. - Policy pre-gate — the answer policy checks the retrieval floor, runs the deterministic entity-ambiguity check, and (when enabled) one judge-slot call for chunk relevance, ambiguity, and source disagreement. In enforce mode a non-proceed verdict short-circuits here; on proceed, a detected disagreement is threaded into the generation prompt as a conflict hint so the answer presents both accounts.
- Data layer (opt-in) — with
includeData: true, the detected entities' bindings execute as governed read-only calls (at most 3). Bindings whose parameters need amodelsource are skipped — this pipeline supplies only entity-name and constant params. - Generation — one chat-model call with the sources and data rows wrapped in untrusted-content delimiters. Models with native structured output return the claims directly; models that reject JSON-schema output still produce a cited plain-text answer, and claims are then derived deterministically from its [Sn]/[Dn] markers.
- Groundedness— the judge model checks the claims against the evidence, best-effort. The same judge batch elicits the model's verbalized confidence (a policy feature, never the score).
- Policy post-gate — retrieval, verification, and groundedness features merge into one calibrated confidence; multi-document claims are checked for evidence conflicts; the resulting verdict, caveats, and conflicts ship as the
policyblock, and both gate decisions are recorded to the decision log.
A broken data source never fails the request
dataCallseither. If a binding's execution errors, times out, or is blocked, that call is skipped and the answer still ships grounded in whatever succeeded (worst case: documents only). Every failed execution still writes its data_calls provenance row (status error · timeout · blocked), auditable in the workspace Data page's call history — dataCalls[] in the response lists only the lookups that actually grounded the answer.Errors
Standard conventions from Errors & rate limits apply:
400— malformed JSON or a body that fails validation (zodissues[]included).401 unauthorized— missing/invalid/revoked key.403 insufficient_scope— key lacksagents:run(this call invokes the workspace's chat model).409 no-model-configured— the chat model slot has no enabled provider.
There is no rate limiting on /api/v1 yet — 429is not currently returned. Treat your key's scopes and your own client-side throttling as the guard rails.
Prefer tools? Use MCP
eli_query tool — the policy block rides along automatically — plus the finer-grained KB and data-layer tools for agents that want to orchestrate retrieval themselves.