Build with AI agents
Everything in these docs is available in a form a model reads well, from the same sources as the pages you’re reading. Point your agent at one of the entry points below, or install the skill.
Entry points
Section titled “Entry points”| URL | What it is |
|---|---|
/llms.txt |
The index: every page, as a link to its Markdown, with a one-line summary. Start here. |
/llms-small.txt |
What it takes to build an integration, in one Markdown file: getting started, these rules, the Switchboard guides, both SDK guides and the Account API. |
/llms-full.txt |
Everything except the TypeScript symbol pages in one file, adding the SDK specification, the Python reference and changelogs. Large; prefer fetching pages from llms.txt. |
<page>.md |
Any page as Markdown: drop the trailing slash and add .md, so /docs/guides/credentials/ is /docs/guides/credentials.md. Every page links to it with <link rel="alternate" type="text/markdown">. |
/reference/http/account.md |
The Account API as Markdown: every operation, parameter and schema. Also relay.md. |
/openapi/account.yaml |
The Account API’s OpenAPI 3.1 spec, unchanged from its source. Also as JSON, and the Relay plane API. Use these to generate a client. |
/raw/spec/protocol.json |
The SDKs’ machine-readable protocol pins: MOQT draft, default endpoint, authentication convention, object size limit. |
/docs/agents/SKILL.md |
A skill for coding agents: the rules below, and where to look things up. |
/sources.json |
The exact commits of the source repositories this build of the docs came from. |
Every page also has Copy as Markdown, Open in Claude and Open in ChatGPT under its title.
Give your coding agent the docs
Section titled “Give your coding agent the docs”Claude Code, and agents that read skills. Install the skill in your project:
mkdir -p .claude/skills/capridcurl -fsSL https://www.caprid.com/docs/agents/SKILL.md -o .claude/skills/caprid/SKILL.mdAny agent that reads AGENTS.md or CLAUDE.md. Add a pointer:
## Caprid (Relay and Switchboard)
Docs index: https://www.caprid.com/llms.txt. Fetch the `.md` pages it links to before writingcode against Relay, Switchboard, `@caprid/relay` or `caprid-relay`, and follow the integrationrules in https://www.caprid.com/docs/agents.md.Cursor, and editors with a docs index. Add https://www.caprid.com/llms-small.txt as a docs
source.
Letting an agent sign itself up. An agent doesn’t need you to create an API key first. Point it
at https://www.caprid.com/auth.md (the same steps are at https://app.caprid.com/auth.md): it
registers through WorkOS AuthKit and starts a Trial Organization with one Namespace, for 7 days.
Claim the agent to keep what it built. AI agents walks through it.
Generating an API client. Feed /openapi/account.yaml to your OpenAPI
generator. Every operation has a stable operationId, like mintClientToken.
Integration rules
Section titled “Integration rules”These are the facts an agent most often gets wrong. Each links to where it’s specified.
- Only a Client token goes to a browser or app. API keys (
sb_...) and Signing keys stay on the server. A leaked API key or Signing key lets anyone mint tokens. (Credentials) - Mint tokens on the backend, per Client, short-lived. Grant the least you can: a viewer gets
subscribe(get) only, under its own room. There is no way to revoke a single Client token; deleting the Signing key revokes every token it signed. (Client tokens) - Sign tokens yourself in production. A Client token is an HS256 JWT with the Signing key’s
kidin its header androot,put,getandexpclaims.rootis the full path, starting with the Namespace. The API’spathis relative to the Namespace; a token’srootis not. (Sign your own) - A token’s grants must fit the Signing key’s scope, or a relay refuses it when a Client uses it.
Check one with
POST /v1/namespaces/{namespace}/tokens/verify. (verifyClientToken) - The token travels as
?jwt=on the relay URL. Browsers can log that URL on a failed handshake, so scrubjwtvalues from diagnostics and error reports. (Browser token exposure) - Root the endpoint at the token’s root. Use
roomEndpoint(root)(room_endpoint(root)in Python), which roots the hosted Relay,DEFAULT_ENDPOINT. Name namespaces relative to it. (Room-rooted endpoints) - Retry request error 16 on a fresh namespace. A subscription can be rejected with
unroutablefor about a round trip while the publisher’s announce propagates; a publisher’sannouncedsays its announce reached the wire. (Subscription lifecycle) - A write waits for demand.
writedoesn’t send until a subscriber wants the track, and a completed write means the transport accepted it, not that anyone received it. (Publishing lifecycle) - Never replay a failed write automatically. Delivery may have been partial; decide on fresh data or an explicit replay policy. (Errors and recovery)
- Plain connections never reconnect. For anything long-lived use
connectSupervisedPublisher/connectSupervisedSubscriber(connect_supervised_*in Python), which also rotate before the credential expires. (Supervised connections) - Branch on
RelayErrorcodes, not messages. Codes and phases are stable. (Error identities) - An API key can’t manage Members or Invitations, or delete a Namespace. Those need a person signed in to the dashboard. (Members and Owners)
- Install matching versions. The packages are
@caprid/relayon npm (add@caprid/relay-quicfor Node) andcaprid-relayon PyPI. Each SDK’s packages release together, so pin them to one version. Before 1.0, a minor version can break the API. (TypeScript, Python)
Where things are specified
Section titled “Where things are specified”These docs are generated from two repositories, which stay the source of truth. Every page made from one has a Source link under its title.
- Switchboard (
docs/public/,openapi/): the guides and both HTTP APIs. - Relay SDKs (
ts/,python/,spec/): the SDK guides, the package READMEs, the API reference (generated from the code’s doc comments and docstrings) and the SDK specification.
When a guide and the behavior contract seem to disagree, the behavior contract says what an SDK must do.