Skip to main content

Worked sequences — Orby assistant chains

Eight operations cover the Orby surface most integrations actually run: grounding search, thread pre-allocation, streamed assistant turns, the tool-action approval gate, the “where do I configure X” settings lookup, thread replay on reload, knowledge-base reindex, and index health. Each sequence below shows the body you send and the body the API returns. All Orby routes are operator-session only: authenticate with a dashboard Bearer token (Authorization: Bearer $ORBIT_OPERATOR_JWT), not an X-API-Key. Key-authenticated requests are rejected with 403 ORBY_SESSION_REQUIRED. Reindex and index status additionally require the super-admin role.

1. Search the Orbit knowledge base

Hybrid search over the Orbit product-docs index. Send query and an optional limit (default 10, max 50). Returns ranked data.results, each with doc_id, title, section, category, url, snippet, score, and last_updated_at. While the index is cold or reindexing the endpoint degrades to an empty result set with a kb_outage_hint instead of erroring.
cURL
Node.js
200

2. Create an Orby thread

Pre-allocates a new Orby conversation thread before the first user message (the dashboard pre-allocation flow). Accepts an optional title and page context; returns the new thread’s id, title, and created_at / updated_at timestamps.
cURL
Node.js
200

3. Start an Orby assistant turn (SSE stream)

Runs one Orby turn and streams the result as Server-Sent Events (text/event-stream): router, status, token, tool_start, tool_pending, tool_end, refusal, clarify, response, and error frames. Send { message, thread_id?, page? } — omit thread_id to start a new thread. Rate-limited to 60 turns/min per operator.
cURL
Node.js
SSE 200
Distinguish a tool_pending event (paused on a confirmation gate — approve it with POST /api/v1/orby/tool-actions/{id}/approve) from token deltas (the answer, safe to render in UI). The response frame closes the turn with turn_id + thread_id; feed thread_id back on the next turn to continue the thread.

4. Get a pending Orby tool action and approve it

Poll the pending action the turn paused on. Returns the action’s tool, args, cost_estimate_cents, status, result, error_code / error_message, and created_at / expires_at / executed_at / cancelled_at timestamps. A pending row past its five-minute window is lazily flipped to cancelled. Poll:
cURL
Node.js
200
Approve:
cURL
Node.js
200
The approval window expires five minutes after the gate was raised — a 409 returns error.details.id plus the current status when the row is already terminal.

5. Find the dashboard setting for a described task

“Where do I configure X” helper — resolves a natural-language description to the dashboard settings that control it. Returns ranked data.matches, each with setting_path, dashboard_url, label, description, doc_url, snippet, and score. Degrades to an empty result with a kb_outage_hint while the knowledge base is initialising.
cURL
Node.js
200

6. List the operator’s Orby threads and a thread’s messages

List up to the 50 most recent threads (the dashboard Past-chats panel) — each with id, title, metadata, and created_at / updated_at / archived_at timestamps — then replay one thread’s persisted message log (oldest-first) so the dashboard can re-render history on reload. List threads:
cURL
Node.js
200
Replay messages:
cURL
Node.js
200

7. Trigger an Orby knowledge-base reindex

Super-admin only. Triggers a manual reindex of the Orbit docs corpus. Runs inline when the docs source is mounted on the pod, otherwise schedules the reindex for the background worker. Returns { scheduled, ran_inline, error }.
cURL
Node.js
200

8. Read index status

Super-admin only. Health snapshot of the Orby docs index: collection name and shape, total and stale chunk counts, last reindex timestamp, current version, and in-process cache statistics.
cURL
Node.js
200

Errors worth branching on

These failures cover the assistant turn (POST /api/v1/orby/assistant), the heartbeat of every copilot chat. Each block below is a full { error, meta } envelope as the API returns it, and the matrix at the bottom answers retry vs surface. For the platform-wide decision table these branches plug into, see the error handling guide.

401 — Unauthorized

A 401 on this page is the session token failing before the route ran — it never means the resource is wrong. Re-mint the dashboard session or rotate the scoped token; retrying the same request changes nothing.

403 — Forbidden

A 403 on Orby usually means the request arrived with an X-API-Key instead of a session Bearer token — Orby routes are operator-session only. Super-admin-only routes (/kb/reindex, /kb/status) also return 403 with INSUFFICIENT_PERMISSIONS for non-admin roles.

422 — Schema

A 422 means the payload did not match the request schema — branch on error.details.field and open a new thread and re-fire the same prompt against the fresh thread id instead of blind-retrying the same body.

429 — Rate

The Retry-After header and error.details.retry_after are both set on every 429 — resend the SAME request after the lower of the two.

402 — Feature gate

Rotate the session or return control to the operator; do not re-fire immediately.

60-second retry matrix