Claim-level citations
Answers carry GIST and CIT markers that resolve to claims and references with durable IDs.
Developers · Cortex SDK
Uthereal Cortex turns your documents into an AI agent that answers with claim-level citations — every claim opens the exact PDF page with the passage highlighted. Create an agent, download a generated TypeScript SDK, and let your AI coding tool wire it in — no vector database, no chunking pipeline, no citation UI to build.
Works with Lovable · Codex · Claude Code · Cursor · Windsurf · GitHub Copilot
const id = await cortex.createConversation();
for await (const u of cortex.ask(id, { message })) render(u);
<CitedAnswer answer={saved.answer} loadPdf={cortex.pdf} … />“Seedlings grew toward the window. [7]”
[7] Garden Guide · page 3 · passage highlighted
When to use Uthereal Cortex
Choose Cortex when your application needs answers grounded in a specific body of knowledge — and users need to see where every answer came from.
Not for open-web search or tasks that don't need grounding in your own knowledge base.
How it works
Upload your documents. Cortex ingests, indexes and structures them into a knowledge agent.
Choose ask (cited answers + PDFs) and/or rag (retrieval). Store it in your server secrets.
Generated for your agent: AGENTS.md, typed SDK, OpenAPI spec, React components, tests and fixtures.
Lovable, Codex, Claude Code or Cursor reads AGENTS.md and wires Cortex into your app.
Step 4
Attach your downloaded integration kit, paste this prompt, and let your coding agent do the wiring. The kit's AGENTS.md tells it exactly what to reuse.
Integrate Uthereal Cortex into this application using the attached Cortex integration kit.
1. Read AGENTS.md first, then README.md, integration.json and examples/README.md.
2. Preserve this repository's existing instructions, auth, history, quotas and UI conventions.
Merge the kit guidance into our root AGENTS.md instead of overwriting it.
3. Copy the sdk/ directory intact. Use createCortexHandler (sdk/server.ts) on the server,
createCortexBrowserClient (sdk/browser.ts) in the frontend, and CitedAnswer (sdk/react.ts) to render answers.
4. Keep CORTEX_SHARED_API_KEY in server secrets only. Never in VITE_* variables or browser code.
5. Map our existing user/session storage through the CortexStore interface.
6. Run pnpm test, pnpm check:edge and pnpm build, replay the fixtures, and report which checks passed.Code
One authenticated endpoint. Your key stays on the server.
import { createCortexHandler, type CortexStore } from "./sdk/server.ts";
const handler = createCortexHandler({
config: {
baseUrl: process.env.CORTEX_API_BASE_URL!,
assistantId: process.env.CORTEX_ASSISTANT_ID!,
apiKey: process.env.CORTEX_SHARED_API_KEY!, // server secret only
},
allowedOrigin: "https://your-app.example",
authenticate: async (request) => {
const user = await verifyYourApplicationSession(request);
return user ? { id: user.id, externalUserId: user.cortexIdentity } : null;
},
store: yourStoreAdapter satisfies CortexStore,
});
// Mount at /cortex — Supabase Edge Functions, Deno, Node or Workers.import { createCortexBrowserClient } from "./sdk/browser.ts";
import { CitedAnswer } from "./sdk/react.ts";
const cortex = createCortexBrowserClient({
endpoint: "https://your-app.example/cortex",
fetch: yourAuthenticatedFetch, // the browser never sees the Cortex key
});
const conversationId = await cortex.createConversation(signal);
for await (const update of cortex.ask(conversationId, { message }, signal)) {
if (update.type === "answer") showPreview(update.answer);
else reloadSavedAnswer(update.messageId);
}
<CitedAnswer answer={saved.answer} messageId={saved.id}
authScope={`${backendId}:${tenantId}:${accountId}`} loadPdf={cortex.pdf} />;const { results } = await cortex.rag({
query: "What is our refund policy?",
max_results: 5,
});
// [{ id_element, id_datasource, content, rank, metadata }]curl -N -X POST \
"https://agent.uthereal.ai/api/functions/v1/api-server-proxy/external/v1/assistants/$ASSISTANT_ID/sessions/$SESSION_UUID/ask" \
-H "Authorization: Bearer $CORTEX_SHARED_API_KEY" \
-H "X-App-Code: selfserve" \
-H "Content-Type: application/json" \
-d '{"id_user":"user-123","message":"What does the guide say about onboarding?"}'What you get
Answers carry GIST and CIT markers that resolve to claims and references with durable IDs.
References include page, coordinates and dimensions. PdfEvidence renders the passage highlighted.
PDF highlights, images, video intervals, YouTube snippets, tables with chart hints and catalogue records.
Session-aware answers with adjustable detail (succinct → detailed) and technicality (simple → technical).
Generated OpenAPI 3.1, TypeScript types and Zod runtime validators. No guessing at payloads.
Stream parser, citation reducer, token refresh and ownership checks — with replay fixtures that need no key.
Scoped, revocable server keys. The browser only talks to your backend. Per-user checks before any PDF.
Built in Zurich by Uthereal AG on Swiss sovereign infrastructure with zero data retention.
Compare
| Capability | Uthereal Cortex | DIY RAG on a cloud AI stack | Basic vector-search API |
|---|---|---|---|
| Time to first cited answer in your app | Download kit, paste into AI tool | Design ingestion, index, prompts, API, UI | Build prompting, answers and UI |
| Ingestion, chunking, indexing | Managed | You build and tune | Partly — you chunk and embed |
| Generated answers with session memory | Included | You build | Not included |
| Claim-level citations with durable IDs | Included | You design the format | Not included |
| Open cited PDF page with highlight | Included (React) | Custom build | Not included |
| Retrieval-only JSON endpoint | Included | You build | Core feature |
| Typed SDK, OpenAPI, runtime validators | Generated per agent | You write | Varies |
| Instructions for AI coding agents | AGENTS.md in every kit | None | Rare |
| Test fixtures without API keys | Included | You write | Rare |
Reference
Base URL: https://agent.uthereal.ai/api/functions/v1/api-server-proxy · Headers: Authorization: Bearer <assistant key>, X-App-Code: selfserve
| Operation | Method and path | Body and scope |
|---|---|---|
| Ask | POST /external/v1/assistants/{assistant}/sessions/{external_session}/ask | { id_user, message, detail_level?, technicality_level? } → NDJSON stream. Scope: ask |
| RAG | POST /external/v1/assistants/{assistant}/rag | { query, id_user?, max_results? (1–20), datasource_ids? (≤50) } → JSON. Scope: rag |
| GET /chat/reference/pdf/{token}?page={page} | Cited page slice with X-External-User-Id. Scope: ask | |
| Refresh | POST /chat/reference/pdf/refresh | Renews an expired PDF reference once from saved IDs. Scope: ask |
Generated OpenAPI types, Zod validators, readAnswers, mergeAnswer, resolveMarker, pdfLocation.
createCortexHandler, CortexStore, CortexClient — server only, holds the API key.
createCortexBrowserClient — create, ask, rag, pdf against your own endpoint.
CitedAnswer and PdfEvidence components for React 18 and 19.
Supabase auth + storage adapter for Edge Functions.
Supabase browser adapter for authenticated fetch.
Requirements: TypeScript; React 18 or 19 for the components; Zod, TanStack Query 5, React-PDF 9. The runnable example uses Node 22, pnpm 10, Deno 2 and the Supabase CLI.
Errors: 400/422 input · 401 invalid or revoked key · 403 missing scope · 404 not found · 502/503/504 transient. Keep X-Request-ID for support. Full guide for AI tools: cortex.md · llms.txt
FAQ
A platform that turns an organisation's knowledge base into an AI agent that answers with verifiable citations, callable from any application through an API and a TypeScript SDK.
Yes. Download the integration kit for your agent and give it to Lovable. It includes a Supabase Edge Function handler, a Supabase auth adapter and React components that match the Lovable stack.
Yes. Every kit ships an AGENTS.md that tells coding agents what to reuse and what not to rewrite, plus tests they can run to verify the integration.
Both an answer API and a RAG API. Use ask for streamed, cited answers, or rag for ranked retrieval results to feed your own model.
Only in your server secrets, for example Supabase Edge Function secrets. The browser calls your backend, which calls Cortex.
Yes. Run pnpm dev and open localhost:5173/?replay to render synthetic answers, citations and a highlighted PDF.
No. Supabase is an optional adapter. Implement authenticate and CortexStore for any backend that runs a Fetch API handler.
Create your agent, download the kit, paste it into your AI coding tool.
Machine-readable versions: /developers/cortex.md · /llms.txt