Watch a live simulation of what happens when an AI agent calls Ctx — from the question to the correct answer, milliseconds later.
{ "query": "refund policy annual plans", "agentId": "agent_support_7f2a", "topK": 3, "minScore": 0.7 }
{ "results": [ { "source": "billing-policies.md", "score": 0.94, "text": "Annual plan subscribers may request a full refund within 14 days of renewal…" } ], "latencyMs": 43 }
One call. Your agent gets exactly what it needs — no prompt stuffing, no manual retrieval logic.
import { Ctx } from '@ctx-ai/sdk'; const ctx = new Ctx({ apiKey: process.env.CTX_API_KEY }); // In your agent tool handler: const { results } = await ctx.getContext({ query: "refund policy for annual plans", agentId: "agent_support_7f2a", topK: 3, }); // results[0].text → the relevant policy excerpt // results[0].score → 0.94 (semantic relevance) // results[0].source → "billing-policies.md"