Skip to content

Torq AI context pack

What the context pack contains

torq-context.json is generated from the governed OpenAPI contract and Developer Platform capability catalogue on every docs build. It provides:

  • release status and API version;
  • every GET, POST, PATCH, and DELETE operation in the public OpenAPI contract;
  • authentication alternatives, request schema, and success response schemas;
  • every implemented, exported typed workflow and its SDK method;
  • canonical machine-readable source URLs;
  • the rules an AI must preserve before it recommends or prepares an action.

The pack is a routing index, not a substitute for current resource data. An AI must still call the relevant API and inspect canonical Postgres/API state and freshness evidence.

Source hierarchy

/ai/torq-context.json
Compact routing, safety, operation, and workflow index
/developers.llms.txt
Developer-guide map with source-backed summaries
/llms.txt
Complete public documentation map
/openapi/torq-v1.openapi.json
Exact HTTP contract and schemas
/developer-platform/capabilities.json
Availability, access class, and runtime status
/api
Human-readable endpoint reference and exact samples
/sdk
SDK method and execution-boundary reference

Validate before indexing

Pin the fetched bytes for a single answer or run, record the retrieval time, and reject malformed JSON. Re-fetch on a release change. Never silently merge two different versions of the OpenAPI contract, context pack, and capability catalogue.

const response = await fetch('https://docs.torq.finance/ai/torq-context.json', {
  headers: { accept: 'application/json' },
});
if (!response.ok) throw new Error('Torq context is unavailable');

const context = await response.json();
if (context.schemaVersion !== 1) throw new Error('Unsupported Torq context schema');
if (context.release.status !== 'private_preview') {
  throw new Error(`Review release policy: ${context.release.status}`);
}

Do not train away freshness

Static context explains fields; it cannot prove current balances, liquidity, eligibility, prices, allocations, or workflow state. For those questions, the AI must use the relevant canonical API response and quote its freshness evidence.