Skip to content

AbstractGateway — API overview

The HTTP API is implemented with FastAPI under the /api prefix: - Health: GET /api/health (unauthenticated; status, runner (each row with mode: split or combined, and process: api, runner or combined; in a split API process also runner_process), watchdog: {enabled, limit_s, last_tick_age_s} — see troubleshooting.md, pools (light, heavy, watchers: {size, threads, queued} each), run_index (mode: verify or trusted, planes, and the summed counters of every plane's run store) and gc_tuning (what serve --gc-tuning applied); the flags are in configuration.md and split mode in configuration.md). The previous process's last watchdog incident is admin-only: GET /api/gateway/host/runner → last_hang: {at, blocked_s, reason, top_frame, dump_path, file, line} or null - Gateway surface: /api/gateway/* (durable runs + operator tooling)

The API is documented at runtime: - OpenAPI JSON: GET /openapi.json - Swagger UI: GET /docs (use Authorize to paste the bearer token)

Context: - In the AbstractFramework ecosystem, UIs and automations call this API to operate AbstractRuntime runs. - Architecture diagram and core concepts: architecture.md

Route families

This page covers the run contract, artifacts, discovery, media, models and host state. Other route families are documented next to the feature they serve:

Routes Purpose Reference
/api/gateway/session/login ({user_id, password} or {user_id, token}), /session/logout, /session/claim, /session/onboarding, /me, /me/password, /admin/accounts/{id}/password browser sessions, password sign-in, first-run onboarding ("Set up your gateway"), one-time sign-in links, the current principal, passwords security.md, first-run.md
/api/gateway/admin/users, /admin/runtime-reservations user accounts and retained runtimes (admin) security.md
/api/gateway/admin/accounts, /admin/accounts/{id}/active, /admin/accounts/{id}/activity, /me/accounts, /me/accounts/{id}/activity, /me/activity the Accounts page: users and entities in one list (admin), your own account and your entities (everyone), the Active switch, activity from the audit log below
/api/gateway/admin/runtime-config runtime settings (admin) configuration.md
/api/gateway/accounts/{me\|account}/preferences one account's client preferences: the default workflow per app and the time zone (the account itself, an admin, an entity's creator) below
/api/gateway/workspace/policy, /workspace/policy/{account}, /sessions/{id}/workspaces, /workspace/effective/{account} (GET and dry-run POST), POST /workspace/path-check workspaces, three levels: the gateway policy = the eligible set (read: everyone; write: admin), one account's default subset (admin, the account itself, an entity's creator; me = the caller), one conversation's subset (its owner, or an admin), the effective set the gateway enforces, and the path check run before saving a row ({path} → {path, normalized, absolute, exists, is_dir, valid, sentence}; any signed-in principal) below, security.md
/api/gateway/admin/runtimes, ?account=<id>[&tenant_id=<t>] the runtime inventory (admin); account keeps only the planes that account owns and echoes filter console.md
/api/gateway/network, /network/restart network exposure, addresses, reverse proxy configuration.md
/api/gateway/apps/*, /apps/handover/{code}, /apps/tui-handover, /api/gateway/apps/desktop-handover browser apps, terminal apps, the Assistant and its sign-in apps.md
/api/gateway/runs/{run_id}/workspace, /workspace/files, /workspace/content browse and preview a run's folder (the run's owner) below
/api/gateway/skills, /admin/skills/reseed the skills shelf below, configuration.md
/api/gateway/about versions this gateway runs (no sign-in) below
/api/gateway/engines/* local engine installs engines.md
/api/gateway/models/download*, /models/downloads* model download jobs and their event stream model-downloads.md
/api/gateway/host/* host state, pause, restart, update, tray Host state, Host control
/api/gateway/backlog/*, /reports/*, /triage/*, /processes operator tooling maintenance.md
/api/gateway/entities/* summoned entities entities.md
POST /api/gateway/sessions/{session_id}/mentions ({entity, text, mention_index, mention_id?, repeat_of?}) @entity in any conversation: a visit turn in the entity's home, its reply recorded as a turn of the session with author (repeat_of folds a repeated prompt; mention_id makes a resend return the first answer); 404 entity_not_found (unknown, hidden or invalid name, identical answers), 409 in_another_conversation / stopped_use_resume, 422 repeat_of_unknown, 503 entity_cannot_answer (a plain sentence). mentions on POST /runs/start and on POST /entities/{name}/summon decides who answers: entities only, no agent run (agent: "not_addressed", the turn's agent_addressed: false); with the reserved chip agent, the agent too entities.md
/api/gateway/entities/{name}/track-record, /reputation, /acquaintances; /api/gateway/sessions/{session_id}/track-record, /reputation, /acquaintances what an entity (or a regular agent's session) has done, how far it can be trusted per kind of task, and whom it met; read-only, derived from its records below
/api/gateway/automations*, /api/gateway/trigger-sources automations: recurring workflows, their occurrences and attention automations.md
/api/gateway/runs/{run_id}/decisions one calibrated decision about a text (yes/no, choice and score answers with confidence), as a durable child run below
/api/gateway/runs/{run_id}/view, /view/stream the replay view of a run tree: status, the interaction to answer, messages, activities, artifacts, usage (one reconstruction, every client) below
/api/gateway/me/events, /me/events/stream, /me/events/notifications your own event stream: what happened for you outside the steps of a run (catch-up, SSE) below
/api/gateway/me/push/devices the watches and iPhones that get your alerts while their app is closed (Apple push) below, push.md
/api/gateway/push/settings the gateway's Push forwarder address (admins) below, push.md

OpenAI API

The OpenAI-compatible API is served at /v1 on this Gateway listener (/v1/models, /v1/chat/completions, /v1/embeddings, ...); callers use one of their account's named API keys (valid at /v1 only; the gateway token is still accepted there). /core/v1 answers 308 to /v1 (deprecated). API keys: GET/POST /api/gateway/me/openai-keys, POST /api/gateway/me/openai-keys/{fingerprint}/reveal (the key's owner only, audited; off when an admin turns off owner reveal), DELETE /api/gateway/me/openai-keys/{fingerprint}; admins GET /api/gateway/admin/accounts/{id}/openai-keys and DELETE /api/gateway/admin/accounts/{id}/openai-keys/{fingerprint}. A named key sent to any /api/gateway/ route answers 401 {"detail": "This is an API key for /v1; sign in with your gateway token.", "reason_code": "openai_api_key"}. Status and logs: GET /api/gateway/openai-api[/logs]; admin changes: /api/gateway/admin/core-endpoint. See openai-api.md for the supported surface, access settings and errors.

The same admin settings route accepts direct_enabled (JSON boolean, default false) for a direct Core HTTP listener. It does not change Gateway /v1's enabled setting. Admin status includes http_services: legacy and direct rows with {state, url, error}. The direct listener uses Core's server bind and token; it receives inference requests directly without Gateway run APIs or Runtime orchestration. Native run clients use neither HTTP inference surface. See endpoint configuration.

Auth

By default, /api/gateway/* is protected by GatewaySecurityMiddleware (bearer token + origin allowlist).
See: security.md.

While the gateway builds an account's service (the first request of that account after a start, or a restart of its runner), requests for that account wait for it without blocking anyone else. A request that reaches a service still being built answers 503 with {"detail": {"reason_code": "service_starting", …}} and Retry-After: 1: retry after a second.

All examples below assume:

export BASE_URL="http://127.0.0.1:8080"
export AUTH="Authorization: Bearer $(cat "$ABSTRACTGATEWAY_DATA_DIR/auth/bootstrap-admin-token")"

Provider connections

Gateway-owned provider connections let users create reusable cloud, local, or OpenAI-compatible endpoints without putting raw API keys in workflow JSON or browser storage. The API route is named provider-endpoint-profiles; the console presents them as provider connections.

  • GET /api/gateway/config/provider-endpoint-profiles: list visible profiles.
  • POST /api/gateway/config/provider-endpoint-profiles: create a user- or admin-owned profile.
  • POST /api/gateway/config/provider-endpoint-profiles/discover-models: discover models for a draft or saved profile by calling the configured provider family and base URL with the entered or server-side key. The raw key is never returned. A server-side key goes only to the address it was saved for: a saved connection's key to its saved base URL, the configured provider key (AbstractCore store or OPENAI_API_KEY) only with no base URL or its own; any other typed address is checked without a key.
  • PUT or DELETE /api/gateway/config/provider-endpoint-profiles/{profile_id}: update or delete a profile.

Enabled profiles appear in GET /api/gateway/discovery/providers as virtual providers such as endpoint:office-vllm. Each such row carries provider_endpoint_profile (the profile, key as a fingerprint only) and its provider_family, also when AbstractCore lists the same profile (profiles live in Core's provider_profiles); a registry provider row (anthropic, openai, ...) never carries it. That marker is how a client tells a saved connection from a provider: the console's cloud provider cards show one card per provider, never a second card for its connection. Model discovery through GET /api/gateway/discovery/providers/{provider_name}/models returns either the fixed profile allowlist or the live endpoint model catalog.

Core workflow lifecycle

1) List bundles (bundle mode)

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/bundles"

Each item also says where the bundle came from and what it does:

  • source: shipped (a file the gateway package ships), published (published from AbstractFlow through this gateway: the publish route's stamp in the manifest metadata) or imported (anything else: an uploaded .flow, or a file copied into the folder);
  • description: the default entrypoint's description ("" when it has none).

Upload a bundle:

curl -sS -H "$AUTH" \
  -F "file=@./my-bundle@0.1.0.flow" \
  -F "overwrite=false" \
  -F "reload=true" \
  "$BASE_URL/api/gateway/bundles/upload"

What a publish reloads

Upload, POST /visualflows/{flow_id}/publish and the admin catalog upload and promote serve the new workflow by swapping the compiled workflow registry on the running runtime: loaded models, session prompt caches and runs in flight are not touched (see architecture.md). Each response carries what it did:

"reload": {
  "ok": true,
  "kind": "registry_swap",
  "services": [{"service": "default:default", "kind": "registry_swap", "duration_ms": 14, "ok": true, "bundle_count": 6}],
  "unchanged_services": 0,
  "duration_ms": 15,
  "sentence": "Workflows updated in place on 1 service in 15 ms. Nothing was restarted: loaded models, prompt caches and running runs were not touched."
}
  • kind: registry_swap (the normal case), service_reload (a service's runtime was rebuilt because its workflows now need a language model, tool execution or the memory store it was started without; its reason says which, and its models and prompt caches start empty) or full_rebuild (only POST /api/gateway/bundles/reload?full=true).
  • services: the services the reload touched, named <tenant>:<runtime>; a service whose workflows did not change is only counted in unchanged_services. Writing the shared workflow folder reloads every running service; a user's own folder reloads only that user's.
  • pinned_runs on a service: runs in flight that keep the workflow they started with because their version was replaced in place.
  • A service that failed to reload is listed with ok: false and error; the publish route then answers 503, the upload route reports it in gateway_reload_error.

POST /api/gateway/bundles/reload answers the host's reload result (bundle_ids, count, skipped) with the same reload object. The request's audit log line (<data dir>/audit_log.jsonl) records reload: {kind, duration_ms, services} next to the request's own duration_ms.

2) Start a run

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"bundle_id":"my-bundle","input_data":{"prompt":"Hello"}}' \
  "$BASE_URL/api/gateway/runs/start"

If you need a specific entrypoint:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"bundle_id":"my-bundle","flow_id":"ac-echo","input_data":{"prompt":"Hello"}}' \
  "$BASE_URL/api/gateway/runs/start"

Every start answers {run_id, runner_warning, resolved_workflow}. resolved_workflow names the workflow the run really runs: {workflow_id, bundle_id, bundle_version, flow_id, registry_scope, name, source: "gateway_default" | "client", interface}. The same object is kept in the run's inputs as input_data.workflow_selection (written by the gateway; a value sent by the client is replaced), so GET /runs/{run_id}/input_data tells a restored conversation how its workflow was chosen.

limits is the iteration budget the start applied: {max_iterations, source: "request" | "gateway_default" | "workflow" | "builtin"}. The app's own value wins (input_data._limits.max_iterations, or the flat max_iterations older apps send); else the gateway default agents.max_iterations is written to _limits.max_iterations; else the workflow's own limit (its start pin's default, else the value its Agent and subflow nodes agree on; max_iterations: null when they disagree) with source: "workflow"; else source: "builtin", the framework default 50. The same receipt is kept on the run as input_data._gateway_limits (written by the gateway; a value sent by the client is replaced). Every app reads the default from GET /api/gateway/discovery/capabilities → capabilities.agent_limits.max_iterations {default: int | null, source: "stored" | "default", run_field: "_limits.max_iterations", min: 1, warn_above: 200}. The backlog helpers POST /backlog/maintain and POST /backlog/advisor follow the same ladder with their built-in 12 and 10 and return the same limits.

Every run also records who started it, in the run's inputs as input_data._meta.origin and on GET /runs/{run_id} as origin: {kind, actor, client, ref}. A run started through POST /runs/start is kind: "person" with actor = the calling account, "<tenant>:<user>", and client = the request's interface (null when it names none); the wrapper run of POST /runs/schedule is kind: "system" with the same actor. The gateway writes it; an origin sent by the client is replaced. Runs started before this field existed answer origin: null. The run's actor_id stays "gateway" (it marks the runs this gateway's runner ticks); the person is origin.actor.

mentions says who the message is for: a list of entity names or slugs, the composer's chips (never parsed from the text), plus the reserved chip agent for the conversation's own agent (no entity can be named agent: creating one answers 409 name_reserved). A name that is not an entity the caller can see answers 404 entity_not_found. Every start answers agent and turn_id, the session turn row's id (a session turn is keyed by its root run, so it equals run_id): a mention of the same words sends it as repeat_of. The routing is structural:

  • Entities, without agent: the agent's run is not started. The person's turn is recorded on the session (a completed turn with the person's words, prompt_author the person, no answer) and the answer is {"run_id": "<that turn>", "turn_id": "<the same id>", "agent": "not_addressed"}. The turn carries agent_addressed: false on its GET /runs row, GET /runs/{run_id}, the session history bloc (GET /sessions/{session_id}/history/bloc) and its replay view (GET /runs/{run_id}/view), so a reload renders it as it was sent; the field is absent on every other turn. A session_id is required (400 without one). Each entity answers through POST /sessions/{session_id}/mentions with repeat_of = that turn_id (repeat_of takes the turn id or the run id, the same id; the words are checked against the recorded turn's).
  • agent with entities: the agent's run starts (agent: "started") and the entities answer through the mention door as above. The gateway writes input_data._runtime.mentions itself ({entities: [{entity_id, name}], line}; a client copy is dropped), and the agent reads, as the last instruction before the person's words, that the mentioned entities answer the message themselves and that, unless the user addressed it directly, it replies with an empty message (an empty reply shows no answer; staying silent is still the model's judgment).
  • agent alone, or no mentions: a plain agent turn (agent: "started").

POST /entities/{name}/summon takes the same mentions and answers agent the same way: the summoned entity answers when the chips name it, name agent, or name nobody; chips that name only other entities start no summon run (no seat, no wake, no prelude), and the person's turn is recorded as above (agent: "not_addressed" with its turn_id). See entities.md.

The recorded turn is an ordinary session turn: GET /runs/{run_id}, GET /runs/{run_id}/input_data and its replay view read it like any turn. Known limit: the rule applies where a message starts a turn (POST /runs/start, the summon door); while a reply is running, an entity-only message still steers the agent (the steer path).

A conversation can carry a temporary identity (framework ADR 0052 §9, a regular agent's look and voice): identity: {avatar: {style, color}, voice: {provider, model, voice, speed?, quality_preset?}} on POST /runs/start, with a session_id (400 without one). It is checked like an entity's PUT /entities/{name}/identity (the design in this gateway's avatar catalog and drawable on the Watch, the voice offered, its model downloaded; 400 / 409 with the same sentences) and kept on the session (<data dir>/session_identities.json, never in an entity home). Every run of the session carries it: the record at input_data._runtime.identity and its reference at input_data._runtime.identity_ref ({"of": "session:<sid>", "rev": n}). A later turn without identity inherits it; a turn with another one changes it (rev + 1). A session that names none records none (no Assistant identity exists on the gateway): its runs carry no reference and speak as before. _runtime.identity and _runtime.identity_ref sent by a client are dropped. GET /api/gateway/sessions/{session_id}/identity[?rev=N] (the session's owner or an admin) resolves a session reference to its look: {session_id, identity: {rev, avatar: {style, color, source, watch_code}, voice, set_at, set_by}, identity_ref} (the entity shape), identity: null when the session has none, 404 session_not_found / identity_rev_not_found. GET /runs/{run_id} carries the run's identity_ref when it has one (read from its inputs, never stored apart); the index-backed GET /runs listing does not (its rows load no inputs).

Evidence: request/response models live in src/abstractgateway/routes/gateway.py (StartRunRequest, start_run).

The gateway default agent workflow (flow_id: "@default")

An agent client (AbstractCode, the Assistant, the Telegram bridge) can let the gateway choose the workflow for an agent interface:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"flow_id":"@default","interface":"abstractcode.agent.v1","input_data":{"prompt":"Hello"}}' \
  "$BASE_URL/api/gateway/runs/start"
  • interface is required with @default (400 without it); bundle_id and bundle_version are not accepted with it.
  • The default is resolved at every start, so a change applies to the next new turn of any conversation that sends @default.
  • When the default cannot run (its workflow is gone, deprecated, or does not declare the interface), the start is refused with 409 and a message naming the setting (agents.default_workflow.<interface>) and where its value comes from. The gateway never quietly runs another workflow instead.
  • POST /runs/schedule accepts the same flow_id: "@default" + interface (the schedule then targets the version resolved at that moment).

What the default is for each interface (readable without admin rights): GET /bundles and GET /workflow-catalog carry

"default_agent_workflows": {
  "abstractcode.agent.v1": {"workflow_id": "basic-agent@0.0.5:81795ea9", "bundle_id": "basic-agent",
                            "bundle_version": "0.0.5", "flow_id": "81795ea9", "registry_scope": "private",
                            "name": "basic-agent", "source": "default"}
},
"default_agent_workflows_unavailable": {
  "abstractassistant.agent.v1": {"source": "default", "value": null,
    "reason": "no host workflow declares abstractassistant.agent.v1; the Assistant uses its built-in orchestrator"}
}

and every entrypoint row carries is_agent_default and agent_default_interfaces, and triggerable (the flow publishes automation defaults with a trigger: a picker that runs automations lists it even when it declares no interface). These are different from default_bundle_id (the bundle a bare flow_id falls back to), from a catalog record's is_default (its default version) and from a bundle's default_entrypoint.

The setting itself is agents.default_workflow.<interface> (see Configuration). In GET /admin/runtime-config, each agents.default_workflow.<interface> row also carries the plain words the consoles show, from one table in agent_defaults.py (INTERFACE_TABLE):

Field Meaning
interface, label, app, help the interface id, its plain name ("AbstractCode — chat agent"), the app that asks for it (null when none does) and one sentence of help
group apps (an app asks the gateway for it as its default agent) or other (declared by a workflow; no app asks for it by default)
state builtin (nothing saved; the gateway default runs: the shipped bundle, else the newest available workflow), none (nothing saved and no workflow declares the interface; reason says so), set (a saved value that runs) or broken (a saved value that no longer resolves)
value the saved value, else the gateway default, else null
reason for broken: "Broken: workflow bundle 'coding-agent' is not on this gateway — pick another workflow or the gateway default."; for none: "no workflow on this gateway declares "

For VisualFlow bundles, Gateway runs the packed JSON through AbstractRuntime. Structured LLM/Agent schemas are Runtime/Core-owned: response remains textual, and schema-conformant object values are available through the node data output for data edges such as Break Object and Switch.

Durable session replay (use_session_history)

Thin clients do not need to carry conversation transcripts. Passing "input_data": {"use_session_history": true} together with a session_id makes the gateway seed the run's context.messages from the session's prior COMPLETED root runs before the run starts: the run store is the durable transcript.

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"bundle_id":"my-bundle","session_id":"sess-1","input_data":{"prompt":"and what did I say before?","use_session_history":true}}' \
  "$BASE_URL/api/gateway/runs/start"

Rules (the model-vs-display divergence contract — what the model replays is deliberately narrower than what history views display):

  • Client-provided non-empty context.messages always win; the seed never overwrites them. An EMPTY client context.messages list does not count as a transcript — the seed still runs (leave out use_session_history to start without history).
  • Only COMPLETED root runs of the session contribute, as strictly alternating user/assistant pairs. FAILED and CANCELLED turns are invisible to replay by design (a promptless answer or answerless prompt would seed a dangling message and invite re-answering a stale ask); history views still show them.
  • Steering/operator guidance injected mid-run is not replayed.
  • The history window: replay keeps the most recent turns that fit 50,000 estimated tokens (AbstractRuntime HISTORY_REPLAY_MAX_TOKENS), as whole messages, newest first. No message is cut, and there is no message-count or character cap. The model can use the rest of its context window. When older turns are dropped, the oldest replayed message starts with a labeled [#TRUNCATION: ...] line. A newest turn that alone exceeds 50,000 tokens is kept whole (oversize_turn_kept: true).
  • The retired caps input_data.session_history_max_messages and input_data.session_history_max_chars are ignored and listed in _runtime.session_history.ignored_inputs. The environment variables ABSTRACTGATEWAY_SESSION_HISTORY_MAX_MESSAGES and ABSTRACTGATEWAY_SESSION_HISTORY_MAX_CHARS are not read.
  • Failures degrade to a labeled _runtime.session_history #FALLBACK note and an unseeded start — never a blocked run. Success records the window on the run as _runtime.session_history: {seeded, policy, max_tokens, token_estimator, replayed_messages, replayed_tokens, dropped_messages, dropped_tokens, dropped_counts_complete, oversize_turn_kept}. dropped_counts_complete: false means replay stopped reading once the window was full: older turns were dropped too, and they are not counted.
  • Entity lanes never ride this: their transcript authority is the entity home (_visit.history / the chat driver), not the run store.

Evidence: _seed_session_history in src/abstractgateway/hosts/bundle_host.py and abstractruntime.session_history.session_chat_messages.

2b) Schedule a run (bundle mode)

POST /api/gateway/runs/schedule starts a scheduled parent run that launches the target workflow as child runs over time.

Example (run 3 times, every hour, starting now):

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"bundle_id":"my-bundle","flow_id":"ac-echo","input_data":{"prompt":"Ping"},"start_at":"now","interval":"1h","repeat_count":3,"share_context":true,"session_id":"sess-1"}' \
  "$BASE_URL/api/gateway/runs/schedule"

Notes: - start_at: ISO 8601 timestamp (recommended) or "now". - interval: e.g. "15m", "1h", "2d". If omitted, runs once. - repeat_count: if omitted and interval is set, repeats forever. Alternatively use repeat_until (ISO 8601). - To stop a schedule, cancel the scheduled parent run via POST /api/gateway/commands with type cancel.

Evidence: ScheduleRunRequest, start_scheduled_run in src/abstractgateway/routes/gateway.py.

2c) Shared workflow catalog

Private /api/gateway/bundles routes are scoped to the signed-in user's routed runtime, and you may change the registry you own. The gateway's own bundle directory is shared by every user, so writing it — upload, delete, reload, deprecate, and POST /visualflows/{flow_id}/publish — requires an admin principal and otherwise returns 403. Listing and running are unaffected. See security.md for the full rule.

Shared/default workflows use the Gateway workflow catalog instead:

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/workflow-catalog"

Admin-only catalog operations live under /api/gateway/admin/workflow-catalog/*:

  • upload or promote immutable .flow versions;
  • move a bundle's default pointer;
  • set ACLs;
  • deprecate, block, or tombstone a version without deleting bundle bytes.

Start a catalog workflow in the requesting user's runtime by setting registry_scope:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"registry_scope":"tenant_catalog","bundle_id":"basic-agent","flow_id":"root","input_data":{"prompt":"Hello"}}' \
  "$BASE_URL/api/gateway/runs/start"

If bundle_version is omitted, Gateway uses the admin-managed catalog default pointer. Exact older versions keep working until that specific version is deprecated, blocked, or tombstoned.

Catalog scope is explicit: omitting registry_scope starts only private runtime bundles. Flow/schema inspection for catalog workflows should use the ACL-aware catalog endpoints:

  • GET /api/gateway/workflow-catalog/{bundle_id}/versions/{bundle_version}/flows/{flow_id}
  • GET /api/gateway/workflow-catalog/{bundle_id}/versions/{bundle_version}/flows/{flow_id}/input_schema

framework_catalog is reserved but not loadable yet; use tenant_catalog.

2d) Docs Q&A (docs-qa catalog bundle)

docs-qa is the shared transport for docs-grounded assistant panels (the unified top-bar drawers). The contract: the CALLER supplies its own corpus (typically its llms.txt text) — the bundle never guesses one, so answers are never silently grounded on another app's docs.

Fresh installs need no manual publish: the gateway ships docs-qa in the wheel and boot idempotently publishes it into the tenant catalog (publish-if-absent by exact version; an admin's default pointer, tombstones, and publisher attribution are never touched; publisher system:gateway-boot). The publish is skipped on custom-bundle deployments whose private registry carries no LLM-bearing flow (it would add a boot requirement they never had) and can be disabled with ABSTRACTGATEWAY_AUTO_PUBLISH_SHIPPED=0 — the manual upload below then remains the path.

curl -sS -H "$AUTH" -H "Content-Type: application/json" -d '{
  "registry_scope": "tenant_catalog",
  "bundle_id": "docs-qa",
  "bundle_version": "0.1.1",
  "flow_id": "docsqa001",
  "session_id": "myapp-docs-assistant:<one id per conversation>",
  "input_data": {
    "prompt": "How do I publish a workflow bundle?",
    "docs": "<your llms.txt text>",
    "app": "MyApp",
    "use_session_history": true
  }
}' "$BASE_URL/api/gateway/runs/start"

Conversation history comes from the run's session, never from the caller (0.1.1): start every question of one conversation with the same session_id and use_session_history: true. The gateway replays the session's earlier turns through the runtime's history window (the newest whole turns up to 50,000 tokens) and the bundle's LLM call includes them; a new conversation is a new session_id. 0.1.0's question + history inputs (last 12 messages kept) are gone.

Then poll GET /runs/{run_id} (or stream the ledger); the answer is output.response, and session_history is the window's receipt (replayed_messages, dropped_messages, ...) to show when earlier messages were not replayed. provider/model/temperature may ride input_data to override gateway defaults. Answers cite section headings and say plainly when the docs do not answer — the bundle refuses to invent endpoints or behavior. Docs Q&A must never route through entity chat (a visit is billable and forms memories).

Run-level skills selection

input_data.skills (a list of skill NAMES) attaches curated skills to any run started through /runs/start:

curl -sS -H "$AUTH" -H "Content-Type: application/json" -d '{
  "bundle_id": "basic-agent",
  "input_data": {"prompt": "…", "skills": ["agora-collaboration"]}
}' "$BASE_URL/api/gateway/runs/start"

Trust semantics (the same abstractskill gate as GET /skills and the workforce spawn lane — one gate, never a second resolver): VALIDATED skills activate and their index lands in the run's _runtime.skills_block (byte-stable for the whole run) with the read_skill tool made reachable; UNVERIFIED skills are held; advisory-BLOCKED skills never ride. Every outcome is recorded as a labeled verdict in _runtime.skills_resolution (requested/active/verdicts/resolved_tree_hashes) — nothing is silently dropped. Agent-node subruns inherit the block verbatim with read_skill appended to explicit child allowlists (empty allowlists keep registry defaults). A caller-supplied _runtime.skills_block or _runtime.skills_resolution is dropped, and of a skills mapping only the requested skill names are kept: the gateway's trust-gated resolver alone writes the block, and only folders under the gateway's own skill roots are readable.

The gateway serves the corpus every Docs assistant grounds on (the kit's DocsAssistantDrawer in the console and the apps):

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/docs/corpus"            # the gateway's own llms.txt
curl -sS -H "$AUTH" "$BASE_URL/api/gateway/docs/corpus?app=code"   # an app's llms.txt

Returns {app, source, chars, text}. With app=<id> (code, flow, observer, continuum, entity) the text is the llms.txt the running app serves from its own build (GET /llms.txt on its loopback port, text/plain only; source app:<id>:llms.txt); an app that is not running, an unknown id, or an app that does not serve one is a 404 that says which. Without app (or app=gateway): Resolution order: the ABSTRACTGATEWAY_DOCS_CORPUS env override first (set-but-missing is an honest 404 naming the checked candidates, never a silent fallback), then the repo llms.txt in dev checkouts, then the corpus packaged with the wheel.

Skills shelf

GET /api/gateway/skills lists the skills of the gateway's shelf: {skills: [...], shelf, shelf_source, bundled_version, warnings}. shelf_source says where the shelf comes from: stored (the saved setting skills.shelf), env (a legacy launch environment value), seeded (the gateway's own copy in <data dir>/skills/registry, kept up to date from the curated shelf that ships with AbstractSkill at each start), checkout (a framework checkout, used only when the gateway's own copy is missing) or none. An empty list always comes with a warning that says why and what to do; warnings are plain sentences meant to be shown as they are.

POST /api/gateway/admin/skills/reseed (admin) refreshes the gateway's own copy now and answers the seed report (added, updated, unchanged, the kept_* lists with what was kept and why, bundled_version, previous_version). An edit made in that folder is never overwritten.

3) Replay the ledger (cursor-based)

Ledger pages are replayed using after as “number of items already consumed”.

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/runs/<run_id>/ledger?after=0&limit=200"

Response shape: - items: list of durable ledger records - next_after: the next cursor to use

Evidence: src/abstractgateway/routes/gateway.py (get_ledger).

3b) Replay ledgers for multiple runs (batch)

Use POST /api/gateway/runs/ledger/batch to reduce request fanout when observing many runs/subflows.

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"limit":200,"runs":[{"run_id":"<run_id_1>","after":0},{"run_id":"<run_id_2>","after":0}]}' \
  "$BASE_URL/api/gateway/runs/ledger/batch"

Evidence: src/abstractgateway/routes/gateway.py (get_ledger_batch).

4) Stream ledger updates (SSE)

SSE is an optimization; clients should always be able to reconnect by replaying from the last next_after.

curl -N -H "$AUTH" "$BASE_URL/api/gateway/runs/<run_id>/ledger/stream?after=0"

Each ledger record arrives as event: step with an id: line (the records consumed so far, which is also the record's seq: every ledger store numbers a run's records 1, 2, 3, …); a reconnect sends Last-Event-ID (or ?after=) and resumes there. event: done closes the stream once the run is finished and everything was sent.

Evidence: src/abstractgateway/routes/gateway.py (stream_ledger).

4b) Live replies: token deltas on the same stream

A run started with input_data._runtime.stream: true also sends the model's reply while it is being written, on the same SSE stream:

event: llm.delta
data: {"kind":"llm.delta","run_id":"…","root_run_id":"…","parent_run_id":null,"node_id":"llm","call_id":"<step id>","seq":3,"text":" a natural","channel":"content","snapshot":false}

event: llm.delta_end
data: {"kind":"llm.delta_end","run_id":"…","root_run_id":"…","parent_run_id":null,"node_id":"llm","call_id":"<step id>","seq":24,"reason":"completed","snapshot":false}
  • call_id is the step id of the LLM call; the durable llm_call record with the same step_id carries the final answer and replaces the live text.
  • channel is content (the answer) or reasoning (thinking text, already separated on the server; clients do not parse <think> themselves).
  • seq counts the events of one call (deltas and end).
  • Delta frames have NO id: line: they are not ledger records, and Last-Event-ID never moves because of them.
  • Snapshots. When a client connects (or reconnects) while a call is still being written, it first receives one frame per open call and channel with snapshot: true and the text so far, then the live frames. A client drops its live bubbles on every (re)connect and applies the snapshots.
  • Order. A call's llm.delta_end is sent after its durable record; the last short batch of text can arrive just after the record, so a client ignores deltas of a call whose record it already holds. done comes after every live frame.
  • Sub-runs. A stream of a run also carries the deltas of every run below it (a coding agent's delegated calls); a stream of a child run carries that child's subtree only. run_id names the run that wrote the text, root_run_id its root.
  • Endings. reason is completed, failed, cancelled or unavailable. unavailable comes with a detail saying why that call did not stream (structured_output, remote_core, provider_cannot_stream, usage_unavailable, prompt_cache_unavailable, node_stream_off, sink_error); the answer is complete either way. When a run ends (stopped, failed) while a call is still open, the gateway closes that call with reason: "cancelled" or "failed" and synthetic: true.
  • Nothing is capped: a call's text is kept whole until it ends, and a slow client catches up from it.
  • Another user's run answers 404, and no delta of it ever reaches anyone else.

The switch is input_data._runtime.stream (true or false; anything else is refused with 400). When a POST /runs/start request does not say, the gateway setting agents.streaming_default decides (off unless saved); it is never applied to POST /runs/schedule, the bridges or the entity loop. A flow node whose LLM call sets stream: false is never streamed (its end says detail: "node_stream_off"). GET /api/gateway/discovery/capabilities advertises the feature to every client:

"streaming": {"deltas": true, "default": false, "run_field": "_runtime.stream",
              "events": ["llm.delta", "llm.delta_end"], "subtree": true,
              "endpoint": "/api/gateway/runs/{run_id}/ledger/stream",
              "end_reasons": ["completed", "failed", "cancelled", "unavailable"]}

With serve --no-runner plus abstractgateway runner, the runner writes a run's deltas to <data dir>/live/<root run id>.deltas.jsonl (readable by the gateway's user only) and the API process reads them from there; the file is deleted when the run ends (however it ends: completed, failed, stopped, or stopped by the kill switch), and files of finished runs are removed at start. Disk use: the file holds every delta of every call of the run and of its sub-runs, and grows until the ROOT run ends; nothing is capped, so a long agent run that makes many calls (a coding agent working for an hour) can leave a file of several megabytes in <data dir>/live while it runs.

Evidence: src/abstractgateway/live_deltas.py, src/abstractgateway/routes/gateway.py (stream_ledger, _apply_run_stream_switch, discovery_capabilities), src/abstractgateway/hosts/bundle_host.py (install_live_delta_sink).

Replay view (/runs/{run_id}/view)

The replay view is what a client shows for a run: its status, the approval or question it is waiting on, the replies, the tool calls and the steps. AbstractRuntime computes it once, server side (abstractruntime.replay, its ADR 0009), and every client renders the same thing. The view covers the run tree, meaning the run and the runs it delegated to. An approval asked by a delegated child run is the view's interaction, wherever it waits. Storage encodings never reach the client: $slim pointers are resolved, and a windowed history is named in warnings. A client acts through POST /api/gateway/commands and /runs/start, and the view stream shows the result. A client never derives run state from raw ledger records.

Read: GET /api/gateway/runs/{run_id}/view

curl -sS -H "$AUTH" -i "$BASE_URL/api/gateway/runs/<run_id>/view"
# ETag: "9d79f0a7:5.23a34aeb:6.ce182561:1131"
curl -sS -H "$AUTH" -H 'If-None-Match: "9d79f0a7:5.23a34aeb:6.ce182561:1131"' -i "$BASE_URL/api/gateway/runs/<run_id>/view"
# 304 Not Modified while nothing was appended

The body is the view, replay_view_v1:

Field Meaning
version "replay_view_v1"
root_run_id, session_id the run asked for, and its session
workflow what the run executes: {id, bundle_id, bundle_version, flow_id, entrypoint} (basic-agent@0.0.5:81795ea9 gives bundle basic-agent, version 0.0.5, entrypoint flow 81795ea9); bundle_id is null for a workflow that is not bundled
status, display_status running, waiting, completed, failed, cancelled; the run's own status line (abstract.status)
cursor {token, records, runs}: the last folded seq of each run of the tree (runs: run id → seq); token is the ETag and the SSE event id
runs[] the tree, root first: run_id, parent_run_id, depth, workflow, status, waiting (kind, wait key, child run), holds_interaction, records, first_seq, last_seq
interaction the person-facing wait or null: kind (tool_approval, ask_user, event), run_id (the run that waits, often a child), wait_key, prompt, choices, tool_calls (resolved), and command, the resume to send through /commands
open_waits[] every open wait of the tree, person_facing or not (a delegation, a timer, a pause)
messages[] verbatim turns (role, kind: prompt, answer, question, final, event; text) with their provenance: run_id, step_ids, seqs, artifact_ids, source
activities[] one row per node execution (an Agent node's phases are one row): kind (llm, tool, subworkflow, timer, ask_user, tool_policy (a call a conversation's tool policy allowed or denied without asking; never an interaction), …), name, status, tool_calls[] (each call with its status and output), wait.ended_by (resume, later_step, terminal), usage, child_run_id
artifacts[] every $artifact reference, with the run, step and seq that produced it
usage tokens and LLM calls, summed over the tree
warnings[] what could not be shown (a $slim pointer to a record that was not folded, records before a window)

GET /api/gateway/runs/{run_id}/view?at=<cursor token> returns the view as the ledger stood at that cursor. Use it to open a push or a link at the event it names. An unknown token returns 404.

Follow: GET /api/gateway/runs/{run_id}/view/stream

curl -N -H "$AUTH" "$BASE_URL/api/gateway/runs/<run_id>/view/stream"

Server-sent events:

  • event: view: the whole view, with id: set to its cursor token.
  • event: delta: one per fold, with id: set to the new token. A delta carries the scalars whole (status, display_status, interaction, open_waits, usage, warnings, cursor, workflow, session_id). It also carries the items that changed in runs, messages, activities and artifacts, keyed by id (run_id for runs). An item is never removed, only updated. changes[] names each change with its kind, id, run and seq, which is enough for a push dispatcher to subscribe to it. Applying a delta means: replace the scalars, upsert the items by id, and re-sort each list by its order. That is abstractruntime.replay.apply_delta, about 40 lines to port.
  • : keep-alive comments, every heartbeat_s seconds (default 5).
  • event: done once the tree is terminal and every record was sent.

To open a run, read the view with a GET, then follow the stream from its token: GET /view (gzip-compressed, cacheable with its ETag), then GET /view/stream?after=<cursor.token>. A stream joined this way sends nothing until the next change. A stream opened without a token starts with the whole view as its first event, and SSE frames are not compressed. On a 3,000-record run that frame is about 1 MB, against about 60 KB for the compressed GET.

To reconnect, send Last-Event-ID (or ?after=) with the last id you received:

  • the current token: nothing is sent until the next change;
  • an older token of this view: one delta from there to now;
  • anything else: a new view.

Every client following a run tree shares one cached view. The gateway folds each appended record once and sends the same delta to every subscriber. The stream wakes on the ledger append itself. The ledger is never re-parsed on a timer. Two periodic checks remain, each run once per view however many streams follow it: - a list_after check every 0.25 s when the runner is another process (split mode), which reads no bytes while nothing was appended; - a re-read of the open runs' snapshots every 5 s. A pause, for instance, changes a snapshot without writing a record.

A change that comes only from a snapshot also changes the cursor token: the token ends with a ~<digest> of the snapshots' contribution, so the ETag and a reconnect see it.

Authorization follows GET /runs/{run_id}. A run outside the caller's own plane returns 404.

Evidence: src/abstractgateway/routes/replay_view.py, src/abstractgateway/replay_view.py; AbstractRuntime abstractruntime.replay and its docs/replay.md.

A run's workspace folder (browse and preview)

A run works in a folder on the gateway computer: the conversation's own folder the gateway made (<data dir>/workspaces/session-…), or the folder the client was started from. A run started without workspace_root gets the conversation's folder (a run without a session gets its own <data dir>/workspaces/<run>), and its file tools resolve relative paths there, never in another workspace. This private workspace is always read & write for its run and is never listed. The agent's workspace context lists the run's allowed workspaces with their paths and modes (security.md). Three routes let the person who started the run see it; another user's run id answers 404.

GET /api/gateway/runs/{run_id}/workspace:

{"run_id": "…", "workspace_root": "/Users/me/Library/Application Support/abstractgateway/workspaces/session-chat-1-3f2a…",
 "kind": "session", "session_id": "chat-1", "exists": true,
 "host": {"hostname": "studio.local", "caller_is_this_machine": true},
 "open_supported": true}

kind is session, run or launch_folder. open_supported is true only for an admin sitting at the gateway computer, the only caller for whom POST /runs/{run_id}/workspace/open can open the folder; elsewhere show the path and the host name.

GET /api/gateway/runs/{run_id}/workspace/files?path=<folder>&recursive=false&limit=<n>:

{"path": "src", "entries": [{"name": "a.py", "path": "src/a.py", "type": "file", "size_bytes": 11, "mtime": "2026-09-25T10:00:00Z"}],
 "truncated": false, "limit": null, "recursive": false,
 "hidden": {"outside_links": 0, "blocked": 0, "other": 0}}

Folders come first, then files, by name. limit is optional; when the listing stops there, truncated is true. hidden counts what is not shown: links that lead outside the folder, and entries the workspace deny list blocks.

GET /api/gateway/runs/{run_id}/workspace/content?path=<file> streams the whole file with its content type, Content-Disposition: inline, X-Content-Type-Options: nosniff and Content-Security-Policy: sandbox, and honours Range (206; 416 outside the file).

Paths are relative to the folder: absolute paths and .. are refused (400), a link that leads outside is refused (403), the gateway's own marker file is never listed nor served. The built-in deny list (credential folders such as ~/.ssh, and the gateway's data folder; see Configuration) is never listed, and reading inside it answers 404, even when the run's folder contains it. The run's effective workspaces are applied again at every call, and nothing else in the gateway's data folder is ever served. A run cannot be started with a workspace_root inside the gateway's data folder either, except the conversation folder the gateway made for the same user.

Workspaces

Three levels, the same shape at each: a posture (allowed_only = "Deny everything, allow listed workspaces", any_except_denied = "Allow everything, refuse listed workspaces"), a default_mode (ro | rw, the mode of every unlisted directory under "Allow everything…") and rows {path, mode: "ro" | "rw" | "deny"} (Read-only, Read & write, Refused). There is no shared workspace. Full model and enforcement: security.md.

Refusals. Every workspace write, the dry run and every run start refuse with HTTP 400 and one shape:

{"detail": {"reason": "workspace_refused", "message": "The gateway allows this workspace read-only: /archive.", "path": "/archive"}}

path names the offending path, or is null. Clients show message (plus "Not saved." after a write). A permission refusal is a 403 whose detail is a sentence.

Gateway: the eligible set (admin)

GET /api/gateway/workspace/policy (any signed-in principal) → {ok, policy} with policy = {posture, default_mode, folders: [{path, mode}], builtin_refused[] (read-only), max_attachment_bytes (read-only), summary}. Each row's mode is the CAP: no level below may reach outside the set or raise a cap. A fresh gateway answers any_except_denied, rw, no rows. The built-in refusals (the gateway's data folder, credential folders) always apply; a non-admin gets builtin_refused: [] and builtin_refused_hidden: true (those paths name the gateway's home and data folder).

PUT /api/gateway/workspace/policy (admin): any subset of {posture, default_mode, folders}. Named fields replace and the others are kept, so one control is one request. Every path is checked like POST /workspace/path-check (absolute, existing). Every row states its mode. These are refused:

  • a duplicate row;
  • a read & write or read-only row inside a built-in refusal (the data folder, except a conversation folder <data>/workspaces/<name> or <data>/users/<tenant>/<runtime>/runtime/workspaces/<name>, and the credential directories): Workspaces: '<path>' is inside the built-in refused workspace '<built-in>'. (the account, session and run levels and the dry run answer the same sentence);
  • an unknown posture or mode;
  • shared_workspace: "shared_workspace no longer exists: list it as a workspace (folders: [{path, mode: "rw"}]). Nothing was saved.";
  • any other field: the earlier allowed_folders, never_allowed, allow_any_folder, launch_folder_trust, mode, client_workspace_scope_overrides, … are all refused by name.

Rows may nest in any combination: the most specific row wins (the longest real-path prefix, refused rows included). A refused /Users/me with an allowed /Users/me/projects (rw) is valid, and so is a refused row inside an allowed one.

The PUT answers like the GET. The GET also carries command_sandbox (round 12), the host's command sandbox state: {state: "sandboxed"|"partial"|"unsandboxed"|"refused", kind, line, sentence, unsandboxed_commands_allowed, configured, flag}. line is shown verbatim (for example "Commands sandboxed: macOS sandbox-exec") and sentence is its tooltip. state is partial on a host whose sandbox expresses one posture only (Windows, Linux Landlock): line names the posture it sandboxes and what happens to the other; see security.md.

Account: the account's default subset

GET /api/gateway/workspace/policy/{account} ({account} = name, tenant:name, an entity's slug, or me) → {ok, policy: {account, configured, posture, default_mode, folders}, gateway: <gateway policy>, effective: <effective at the account level>, can_edit}. configured: false means "follow the gateway policy"; the policy block then carries the gateway's posture and default with no rows. 404 for an account that does not exist.

PUT /api/gateway/workspace/policy/{account}: {configured: false} follows the gateway policy again; any of {posture, default_mode, folders} configures the account (unnamed fields keep the stored value, else start from the gateway's posture and default with no rows). A read-only or read & write row must lie inside the eligible set (under "Deny everything…", under a listed row; under "Allow everything…", outside every refused row and built-in refusal) at most at its cap; otherwise the PUT is refused with " is outside the workspaces the gateway allows ()." or "The gateway allows this workspace read-only: .". A Refused row only needs an existing directory: a refusal never widens. Who: an admin for any account; a person for their own; an entity's workspaces by an admin or the entity's creator ("Only an admin or 's creator can change its workspaces." otherwise). The PUT answers like the GET. /workspace/policy/self answers 410 naming /workspace/policy/me.

Session: one conversation's subset

GET /api/gateway/sessions/{session_id}/workspaces → {ok, policy: {session_id, account, configured, posture, default_mode, folders}, gateway, account_default: <effective at the account level>, effective: <effective at the session level>}. It works before the session's first run (nothing stored = configured: false, "Use my default", whose display base is the account default). PUT takes the account level's body and checks: {configured: false} resets; rows are checked against the GATEWAY's eligible set, not the account default (a conversation may use a workspace the account default does not list). The gateway stores the choice in the owner's plane (<plane data dir>/session_workspaces.json), so every app opening the conversation sees it and it survives restarts. Only the session's owner, or an admin with ?account=<tenant:name>, reads or changes it. Audited (workspace_policy_changed, scope session).

Effective set

GET /api/gateway/workspace/effective/{account}[?session=<id>] → {ok, account, session_id, level: "run" | "session" | "account" | "gateway", posture, default_mode, folders: [{path, mode, cap, source: "gateway" | "account" | "session" | "run"}], summary, gateway_summary}. level is the level that applies (session > account > gateway); each mode is the lower of the gateway's cap and the level's rule; default_mode is always ro or rw (under "Deny everything…" it applies to nothing). summary and gateway_summary are the lines every surface shows verbatim:

Deny everything, allow listed workspaces · /Users/me/Pictures (rw) · /Users/me/Documents (ro)
Allow everything, refuse listed workspaces (rw) · /secrets (refused) · /archive (ro)

The default mode appears in parentheses only under "Allow everything…".

POST /api/gateway/workspace/effective/{account} is a dry run: body {workspace: {posture, default_mode, folders} | null, session?: <id>} → the same shape (level: "run" for a payload; null = what a run would get). Nothing is stored; a payload a run start would refuse is refused the same way.

Run start

Every door (POST /runs/start, schedules, host.start_run for bridges and entities, automation occurrences) resolves a one-off workspace > the session's choice > the account default > the gateway policy, clamps it to the eligible set and caps, and sets the run's workspace arguments (workspace_access_mode, allowed, read-only, writable and ignored paths). The one-off is input_data.workspace (POST /runs/start also takes a top-level workspace, moved there). With a session_id it wins for that run and is saved onto the session when the session has no choice yet. At the HTTP doors a row outside the eligible set or above its cap is refused (400 workspace_refused); the in-process doors drop or lower it, never widen, and record each such row on the run as _gateway_workspace.clamped: [{path, asked, got, sentence}] (got null = dropped; the sentence is the HTTP door's). GET /runs/{run_id}/workspace also answers workspace_level, workspace_summary and workspace_clamped. A legacy workspace_allowed_paths list may only narrow; a workspace_root (a launch folder, for example) must be reachable; a client workspace_access_mode: "all_except_ignored" is refused. The run records the level under its vars _gateway_workspace.{level, summary}. An automation keeps its choice in target.input_data.workspace; a definition that sends the older workspace_allowed_paths list gets it converted ("Deny everything, allow listed workspaces", each workspace at its gateway cap). An automation saved with Use my default (no payload) stores workspace: {"configured": false} and follows its owner's default: each occurrence resolves session > account > gateway when it is admitted (its run start), so a wider default applies from the next run, with no revision. Nothing of the default is stored in the definition (only a fail-closed fallback: the built-in denies and workspace_access_mode: "workspace_only"); derived keys a client echoes back with configured: false (an old snapshot) are ignored, never a narrowing. Every automation's workspaces, an explicit choice included, are guarded again at each occurrence against the policy as it is then: a workspace the admin refused or capped since is dropped or lowered for that run and recorded with its sentence (_gateway_workspace.clamped); the keys derived when the definition was saved are never used.

Artifacts and filesystem handoff

Gateway artifacts are the cross-package representation for files, media, and large payloads. Thin clients should pass artifact refs across runs instead of raw bytes or local paths:

{
  "$artifact": "abc123",
  "artifact_id": "abc123",
  "run_id": "session_memory_sess-1",
  "content_type": "image/png",
  "filename": "input.png"
}

Streamed read-aloud recordings use the logical voice/ artifact space, and so does the recording of a spoken question: an upload whose client path is under the reserved voice/dictation/ prefix is tagged purpose: voice_dictation and artifact_space: voice. Voice transport is how the conversation travelled, not an attachment of it: normal GET /runs/{run_id}/artifacts and GET /sessions/{session_id}/artifacts listings exclude read-aloud audio and dictation recordings; include_voice=true includes them. AbstractRuntime's history bundle applies the same rule to session turns. Filtering occurs before pagination and totals. Other uploaded recordings and explicitly generated audio files remain in the normal listing. Existing streamed recordings are classified from their producer metadata without rewriting their saved artifact references.

GET /sessions/{session_id}/artifacts reads only that session's artifacts through the artifact store's indexes. It and the other artifact listings (GET /runs/{run_id}/artifacts, /artifacts/search, /artifacts/stats) build and render their page off the event loop.

GET /artifacts/search retains the complete archive. Use tags=artifact_space=voice to list the voice space, including historical streamed recordings. Playback and downloads continue to use the original artifact IDs. The voice/ paths are logical artifact paths; bytes remain in the content-addressed artifact store rather than being copied into the user's workspace.

Gateway uses three distinct file-like source terms:

  • Artifact: a durable runtime-owned payload reference.
  • Local File: a browser/client upload source. Hosted clients should upload bytes; browser-local paths are never interpreted as server paths.
  • Server File / Server Folder: user-facing wording for a workspace-scoped server path under Gateway policy. The engineering contract is the canonical WorkspacePath string returned by /files/*, artifact import/export, and Runtime file nodes.

Hosted local uploads stay artifact-backed:

  • one local file upload creates one artifact ref;
  • multiple local files create an ordered list of artifact refs in Flow;
  • a local folder uploads one artifact per file and may send source_path (for example reports/2026/summary.md) so relative member paths survive in artifact provenance without exposing browser-local absolute paths.

Upload a local file or folder member:

curl -sS -H "$AUTH" \
  -F "session_id=sess-1" \
  -F "source_path=reports/summary.md" \
  -F "file=@./summary.md" \
  "$BASE_URL/api/gateway/attachments/upload"

List run artifacts:

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/runs/<run_id>/artifacts"

List artifacts visible to a session:

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/sessions/sess-1/artifacts"

Browse server workspace files/folders:

curl -sS -H "$AUTH" \
  "$BASE_URL/api/gateway/files/list?path=&include_directories=true&limit=200"

Optional filters: - path: browse a specific workspace folder or mount alias. - recursive=true - family=image|video|audio|document|text|code|json|archive|other - extensions=png,jpg or newline-separated values - query=substring - max_depth=<n>

Search artifacts across Gateway storage:

curl -sS -H "$AUTH" \
  "$BASE_URL/api/gateway/artifacts/search?scope=all&artifact_kind=image&query=logo&tags=pin_id=image&include_stats=true&limit=500"

scope can be all, session, or run. Use session_id with scope=session and run_id with scope=run; omit both for scope=all. Search responses carry the row fields and also include artifact_envelope_v1, a normalized projection of Runtime-owned descriptors, access stats, and Gateway action links.

Useful query parameters: - artifact_kind: UI-oriented kind filter. Comma-separated values match semantic_kind, render_kind, or modality; generic audio means unclassified audio and does not match canonical voice, music, or sound. Single canonical kinds such as music, voice, image, markdown, or json map to Runtime catalog filters. Multi-kind unions are supported, but may be Gateway post-filters until Runtime exposes OR filters. - semantic_kind / render_kind: canonical descriptor filters when the caller wants the two dimensions separately. - modality, content_type, workflow_id, node_id, created_after, created_before, and tags: server filters for indexed descriptor fields. - query: case-insensitive metadata search. Gateway may post-filter this field when Runtime cannot index it directly. - include_stats=true: include exact stats.total, byte totals, and facet counts for the selected server-side filter set, independent of limit. - limit, offset, and cursor: bounded paging. The default Runtime Explorer page size is 500; limit<=0 is bounded unless debug_unlimited=true is used by an admin/debug caller.

artifact_envelope_v1 contains normalized fields such as semantic_kind, render_kind, workflow_id, node_id, turn_id, ledger_cursor, generation, producer, media, source_refs, access, and links. Sparse producer metadata is represented as missing fields; Gateway does not invent provider/model provenance from filenames.

Generated-media artifacts created by child runs and projected into the parent run preserve Runtime descriptors and structured metadata. Direct transcription routes store transcript artifacts with source-audio refs, language/prompt hints, provider/model when available, and bounded route parameters. Descriptor-provided action links are sanitized to relative Gateway/UI links before they appear in envelopes; raw external provider URLs should be represented as trace availability or Gateway-owned trace records.

Content reads can label the access type for Runtime access stats:

curl -sS -H "$AUTH" \
  "$BASE_URL/api/gateway/runs/<run_id>/artifacts/<artifact_id>/content?access_action=preview"

Supported access actions are content, preview, and download. The shorter access=preview alias is also accepted.

Import a server workspace path into a session artifact:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"session_id":"sess-1","source":{"kind":"workspace_path","path":"inputs/photo.png"},"pin_id":"image"}' \
  "$BASE_URL/api/gateway/artifacts/import"

Export an artifact back into the server workspace:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"path":"outputs/photo.png","create_parent_dirs":true,"overwrite":false}' \
  "$BASE_URL/api/gateway/runs/<run_id>/artifacts/<artifact_id>/export"

Import and export use the same Gateway workspace policy as file helpers: workspace roots, mounted roots, ignored paths, and size limits are enforced on the server. Browser-local files should be uploaded through POST /api/gateway/attachments/upload; browser-local file paths are not interpreted as Gateway workspace paths. An upload belongs to the conversation it was uploaded in: a run of another session that references it (any shape — context.attachments, context.media, attachments, media, a bare id or one naming its owner run_id) is refused at the start door with 400 artifact_not_in_session (and by the host for in-process callers), so one conversation's attachment can never reach another's model, whatever a client sends. Artifacts a run produced keep the hand-off below: a later run, in any session of the same user, may name them by run_id. An artifact tagged shared: user is visible to every session of its owner. In hosted user-auth mode, server workspace import/export and /files/* helpers require an admin principal. They never list, read or write the gateway data folder or the account's credential folders (.ssh, .aws, Library/Keychains, ...), even when the workspace root contains them (403). Ordinary users can still upload browser-local files and list/search artifacts in their own routed runtime.

Canonical Gateway server paths use rel/path for the main workspace root and mount_alias/rel/path for approved mounts. When two allowed mounts share the same basename, Gateway emits deterministic digest-suffixed aliases so the same public path string can round-trip through /files/*, artifact import/export, and Runtime file nodes.

Conversational updates, questions and corrections

POST /api/gateway/runs/start accepts an optional strict JSON boolean conversation. true enables the actor's public updates and conversational questions before the first tick; absent or false preserves the existing presentation. It normalizes to input_data._runtime.conversation: {enabled: true|false} and inherits through supported agent/subworkflow composition. The equivalent input-data config must contain exactly enabled with a boolean value. POST /entities/{name}/summon accepts the same option for the ordinary Flow work-session lane.

Render /runs/{root}/view messages with kind: "public_update" as actor-authored updates. They retain id, text, run_id, optional session_id, iteration, source_call_ids, update_kind ("finding" for a fact or piece of evidence the actor established, otherwise "progress", as typed by the actor) and ledger provenance. Raw reasoning, tool output and diary/thinking fences are excluded. An actor's wording remains its statement, not independently verified evidence of completion.

Conversational questions retain waiting.prompt and expose waiting.details.question: {id, purpose: "conversation", importance, published_at, deadline, fallback}. importance: "essential" has null deadline/fallback and waits indefinitely. A clarification carries its original absolute deadline and a safe fallback declared when the question was issued (120–300 seconds). Answer the actual run shown by the replay interaction, using its exact question:<id> wait key:

{"command_id":"<new UUID>","run_id":"<question run>","type":"resume","payload":{"wait_key":"question:<id>","payload":{"response":"Inside, please."}}}

Empty responses and approval payloads answer HTTP 422. At or after the server cutoff, expiry wins even before the due scan runs. The continuation contains timed_out, fallback and question: {id, outcome: "expired"} with no human response. Late recognized replies are durably retained and do not answer another question. Pause suppresses continuation while preserving the original deadline; after explicit resume an overdue question resolves first. Cancellation does not apply a fallback. This uses the existing runner and Runtime's single-writer/process-local arbitration, not a new scheduling service. Legacy ASK_USER, EVENT deadlines and tool approvals retain their existing behavior. Time passing grants no approval or permission. These facts do not implicitly request afterflow notifications.

During ordinary task work, submit inject_guidance with payload: {guidance: "context and the correction", display_text: "the person's original words"}. display_text is optional, nonblank and at most 65,536 characters; only explicit display text becomes public human history. The server stamps its authenticated speaker. Replay exposes role: "user", kind: "guidance", guidance_status: "accepted" from reserved host receipts. Operational guidance without display text remains outside public human history. Acceptance means durably queued; the actor's later response is the evidence it considered or adopted the correction. Already performed work is not undone. If only the public-receipt append fails, the accepted sidecar source is retained and retried before consumption; the host reports a repair warning rather than a false refusal. Entity driver visits use their canonical owned visit routes described in entities.md.

The runner copies the authoritative command envelope's command_id to the optional client_message_id on the public human receipt and replay message. Use that field to reconcile pending task speech. The /commands acknowledgment sequence belongs to the command inbox; it is not the guidance sidecar sequence in <run_id>:guidance:<seq>. Distinct commands with identical words remain distinct messages. Payload-claimed correlation ids are ignored.

Durable commands (POST /api/gateway/commands)

Commands are appended to a durable inbox and applied asynchronously by the runner.

Request fields (see SubmitCommandRequest in src/abstractgateway/routes/gateway.py): - command_id: client-supplied idempotency key (UUID recommended) - run_id: target run id (or session id for some event use-cases) - type: pause|resume|cancel|conclude|emit_event|update_schedule|compact_memory|inject_guidance, or an automation.* type with run_id = the automation id (automations.md). Run commands aimed at an automation id answer 409 invalid_state. - payload: command-specific object

Pause / cancel

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"command_id":"'"$(python -c 'import uuid; print(uuid.uuid4())')"'", "run_id":"<run_id>", "type":"pause", "payload":{"reason":"operator_pause"}}' \
  "$BASE_URL/api/gateway/commands"

Resume a paused run

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"command_id":"'"$(python -c 'import uuid; print(uuid.uuid4())')"'", "run_id":"<run_id>", "type":"resume", "payload":{}}' \
  "$BASE_URL/api/gateway/commands"

Resume a WAITING run with a payload (WAIT resume)

When payload.payload is present, the runner interprets this as “resume a WAITING run with a durable payload”:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"command_id":"'"$(python -c 'import uuid; print(uuid.uuid4())')"'", "run_id":"<run_id>", "type":"resume", "payload":{"wait_key":"<optional_wait_key>", "payload":{"approved":true}}}' \
  "$BASE_URL/api/gateway/commands"

Evidence: src/abstractgateway/runner.py (_apply_command, _apply_run_control).

Emit an external event

Minimal form:

curl -sS -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"command_id":"'"$(python -c 'import uuid; print(uuid.uuid4())')"'", "run_id":"<session_id>", "type":"emit_event", "payload":{"name":"chat.message","payload":{"text":"hi"}}}' \
  "$BASE_URL/api/gateway/commands"

With "durable": true in the payload the envelope is also appended (with a per-run seq, deduplicated by event_id) to the events_inbox of every running or waiting run that declares the event name as its events_mailbox, however many runs are parked: the lookup goes through the run store's mailbox index, never through a window of the newest runs. The answer counts both: {"resumed": n, "appended": m}.

Evidence: src/abstractgateway/runner.py (_apply_emit_event, _deliver_durable_event).

Automations

An automation runs a workflow on a trigger (a fixed UTC interval, or only when asked) as a durable controller run whose occurrences are ordinary child runs. The full contract, with request and response shapes, the error envelope, typed waits, attention and operations, is in automations.md.

Route Answer
GET /api/gateway/trigger-sources {items: [{id, version, label, capabilities, config_schema, event_schema, available, unavailable_reason?}]}
GET /api/gateway/automations/defaults {growing_max_tokens}: the gateway's default history budget of a growing automation (50,000 tokens), used when a definition sets no context.growing.max_tokens; the one value clients show for "the default"
POST /api/gateway/automations/schedule-preview {trigger, time_zone, schedule_rule_text, schedule_text, next_run_at, next_run_local, first_run_sentence} (automations.md)
POST /api/gateway/automations {request_id, title?, target, trigger?, context?, policy?} → {automation_id, revision, summary}; context = {mode, growing?: {max_tokens}}
GET /api/gateway/automations?status=&archived_only=&kind=&cursor=&limit= {items: [AutomationSummary], next_cursor, paused_automations_count, archived_automations_count, archived_automations}, active automations first, then paused ones, each by last_activity_at (newest first); every row carries section (active/paused/archived) and last_activity_at, and older scheduled runs (legacy: true) are placed by the same rule; a row that changes between two page reads may be served twice or not at all in that walk, so refresh from the first page (see Listing order). A summary carries target {workflow_id, bundle_ref, flow_id} and flow_name (the entrypoint's name), see automations.md; status takes a comma-separated list (active,paused). Archived automations are left out unless archived_only=true (only them) or status names archived. kind is what they are for: user (the default, the automations a person creates and manages), notes (AbstractNote's own processing: the automations whose target is an abstractnote workflow, which AbstractNote reads by id) or all; every row carries kind, and the counts count the listed kind; paused_automations_count and archived_automations_count count yours (archived_automations is the same count). Its cost follows the number of automations, not their history; identical concurrent requests share one computation, and the answer is kept up to 3 s (dropped at once by any change this gateway records: a run step, a command, a seen cursor)
GET /api/gateway/automations/{automation_id} {definition, active_revision, summary}
PATCH /api/gateway/automations/{automation_id} {command_id, expected_revision?, changes} → {command_id, accepted, duplicate, seq}
POST /api/gateway/automations/{automation_id}/commands {command_id, type: automation.pause|resume|run_now|stop_current|archive|unarchive|revise, payload?} → the same receipt. unarchive brings an archived automation back paused with its history (409 invalid_state when it is not archived); an archived automation accepts only unarchive
GET /api/gateway/automations/{automation_id}/occurrences?cursor=&limit= {items: [occurrence], next_cursor}, newest first
GET /api/gateway/automations/{automation_id}/attention?cursor=&limit= {items: [attention item], next_cursor}: your unseen items, oldest first
POST /api/gateway/automations/{automation_id}/seen {attention_cursor} → {attention_cursor} (moves forward only)
POST /api/gateway/automations/{automation_id}/discuss {request_id, occurrence_index, prompt} → {session_id, run_id, session_kind: "discussion"}

Errors on these routes, 401 and 403 included, always have the shape {"detail": {"reason_code", "message", "field"?, "command_id"?}} (automations.md). An occurrence's wait is answered with the resume command above; the answer's shape depends on the wait's kind (automations.md). Listing behaviour. Identical GET /api/gateway/runs asks that arrive while one is being computed share that one computation (keyed by the caller's runtime folder and the exact query string, so two accounts or two filters never share a page); a page is never reused once it has landed, so a listing right after an archive, a cancel or a start shows it. status=running and status=waiting listings are served from the runtime's active-run index (AbstractRuntime 0.10.1 or later; the file-backed store), so they cost milliseconds on a store of ten thousand runs; a listing with archived_only=true answers the empty page at once when you have archived no session.

GET /api/gateway/runs rows carry session_kind, automation_id, role, occurrence_index and legacy, plus workspace_root on turn rows (the folder the run works in; absent on sub-runs), accept session_kind=chat,discussion, and root_only=true returns conversation turns, one per occurrence (automations.md). With include_metrics=true each row also carries steps, llm_calls, tool_calls and tokens_total: the totals of that run and every sub-run below it, read from the ledger on either store backend (null when the gateway has no ledger store). AbstractCode's conversation card shows the sum of its turns' tool_calls. A page also carries session_totals: for each session_id on the page, {turns, runs} for the whole session — turns is what a turn listing shows for it (parent-less runs that are not automation controllers, plus occurrences), runs its runs; the session's internal session_memory_<id> bookkeeping run counts in neither, so a one-turn conversation reads as 1 — under the page's session_kind filter, read from the file store's session index (a page of three turns can say the session has twelve). The key is absent when the page names no session or the run store is not the file-backed one.

Archived sessions

A conversation can be archived to take it out of the list. Archiving deletes nothing: the session's runs, ledgers and artifacts stay, and GET /api/gateway/runs?session_id=<id> still reads it (its rows then carry archived: true and archived_at).

Route Answer
POST /api/gateway/sessions/{session_id}/archive {session_id, archived: true, archived_at, archived_by, changed}; a repeat answers changed: false
POST /api/gateway/sessions/{session_id}/unarchive {session_id, archived: false, archived_at: null, archived_by: null, changed}
GET /api/gateway/runs?root_only=true leaves archived sessions out; every listing carries archived_sessions (how many sessions of the listed kind you have archived)
GET /api/gateway/runs?root_only=true&archived_only=true only the turns of archived sessions, each with archived: true

Order. Turn listings come most recently updated first, so an app that folds the rows by session_id lists the session with the latest activity first, and a new turn in an older session moves it to the top. Apps show that order as served, with archived sessions in their own Archived section (the framework's ADR 0048; automations follow the same rule, see Listing order).

Session purpose (kind). A session is a conversation (the default; an entity visit is a conversation with an entity), a docs chat (a Docs assistant conversation), notes (AbstractNote's captures and drains), automation (an occurrence of an automation a person created: the controller's and its occurrences' sessions) or process (work the framework runs for its own treatments: AbstractNote's note-process, note-reflect and note-consolidate occurrences, the phone and watch voice probes, model-host verifications). POST /api/gateway/runs/start takes kind with a session_id (the kit's Docs assistant sends docs, the Assistant's probes send process); any other value, or a non-conversation kind without a session, is a 400. Turn listings (GET /runs?root_only=true or archived_only=true, without session_id / parent_run_id) take kind=conversation (the default), one kind, a comma list (kind=conversation,automation) or kind=all, so a docs chat, a note session, an automation's occurrence or a process never appears in a conversation list while staying in the same pool: readable by session_id, ledgered, archivable. A listing that asks for the automation attribution (session_kind=automation,occurrence) lists those sessions whatever kind says — that attribution is what makes them automation sessions. Every row carries kind and session_kind. The mark lives in the plane's session_kinds.json; a session without one is classified by its own workflow and attribution, else it is a conversation.

The purpose follows the workflow's bundle id and the run's attribution (matched exactly, whatever client starts the run). A run of the shipped docs-qa workflow marks its session docs even without kind; a run of an AbstractNote workflow (abstractnote@<version>:<flow>) marks its session notes, or process for the three process flows. The first turn listing runs the one-time migrations docs_qa_bundle_v1, abstractnote_bundle_v1, process_sessions_v1 and automation_sessions_v1, which mark the existing sessions once. The sessions automations open (one per occurrence) are never started through POST /runs/start: a listed turn is automation, notes or process by its own workflow and attribution, without a mark.

The session's owner or an admin may archive it. Each account works in its own runtime plane, so a session that belongs to another account answers 404 {"detail": {"reason_code": "session_not_found"}}. The mark and its history (every archive and unarchive) are kept in the plane's session_archive.json; each call writes a session.archived / session.unarchived audit event. Automations are archived with the automation.archive command and brought back with automation.unarchive.

Search conversations

GET /api/gateway/sessions/search?q=<words> finds the caller's conversations by keyword: what was asked, what was answered, and the artifacts of each turn (generated images, recordings, videos and music by their generation prompt, attachments by their file name). Words and parts of words match, case and accents are ignored, and a fuzzy pass forgives a typo. Tool usage, tool outputs and intermediate thinking are not indexed.

Query parameter Meaning
q the words to find (1–200 characters, every word required)
limit sessions per answer, 1–50 (default 20)
archived true searches archived conversations only; default false leaves them out, like GET /runs?root_only=true
session_kind as in GET /runs (default chat,discussion, the kinds indexed; automation sessions are not)
kind conversation (default), docs or all, the session purpose as in GET /runs

The answer is {query, items, count, fuzzy, kinds, indexing}. One item per session, best first: {session_id, run_id, prompt, snippet, highlights, matched_in, score, created_at, updated_at, session_kind, archived, fuzzy, artifact}; run_id is the turn that matched best, snippet is the text around the first match with highlights as [start, length] pairs, and matched_in says where it matched (question, answer or artifact). When an artifact matched, artifact is {artifact_id, run_id, kind, content_type, name, prompt} and its bytes are at GET /api/gateway/runs/{artifact.run_id}/artifacts/{artifact_id}/content. fuzzy on the answer says whether the index has SQLite's trigram tokenizer (without it, whole words with prefixes match); fuzzy on an item marks a hit found by the fuzzy pass. indexing is {complete, pending_sessions, turns, errors}: the index catches up on every call within a short time budget, and complete: false means older conversations are still being read (a first search on a large plane), never a silent partial list.

The index is one SQLite file per runtime plane, conversation_search.sqlite3 in that plane's data folder, next to the plane's stores: an account can only ever search its own conversations, exactly like GET /runs. The file is disposable: delete it and the next search rebuilds it, and a schema change rebuilds it on its own.

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/sessions/search?q=survival%20curve&limit=10"

Triggers

A trigger connection is one account's instance of a trigger source: a webhook endpoint with its signing secret, a feed URL. Automations bind it by id (trigger.config.connection_id); each connection has one inbox stream, trigger:<connection_id>, that its events are appended to and its automations read.

Trigger connections

The caller's own connections, in the caller's own runtime plane (another account's connection answers 404 like an unknown one). An administrator also lists every account's with all=true and may read, test and revoke any by id.

Route Answer
GET /api/gateway/triggers/connections?source_id=&all= {connections: [row]}, oldest first; all=true is admin only (403 admin_required)
POST /api/gateway/triggers/connections {source_id, source_version, label?, config} → 201: the row at top level, plus the one-time secret (a webhook's signing secret whsec_…, generated when config gives none; never shown again) and, for a webhook, ingress_url. 422 unknown_trigger_source / invalid_connection (a source that takes no trigger connection, a mailbox source, a config its connection_schema refuses)
GET /api/gateway/triggers/connections/{id} the row
PUT /api/gateway/triggers/connections/{id} {label?, config?, status?: active \| disabled, paused?: bool, always_listen?: bool} → the row (a new config is validated whole; secret fields left out keep their sealed value)
DELETE /api/gateway/triggers/connections/{id} {deleted: true, connection_id} (its past events stay until the inbox retention removes them)
GET /api/gateway/triggers/connections/{id}/events?after=&limit= {events: [CloudEvents JSON + sequence + recordedtime], next_after}; without after the newest limit (default 50, at most 500), oldest first; with after the next limit after that sequence
POST /api/gateway/triggers/connections/{id}/test-fire {event_id, sequence, woken}: a synthetic {data: {test: true}} event appended to the connection's stream like a real one (bound automations admit it)

A connection is fed only while something listens: listening is "listening" when an active automation reads it (used_by > 0) or always_listen is on, "idle" otherwise, "paused" when paused is on (or the status is disabled). Feed connections (feed.item@1) are polled by the gateway itself from each account's worker loop (every 15 seconds it fetches the LISTENING connections whose every has elapsed; 15 minutes by default; the first poll after an idle spell is a baseline). A webhook call is accepted and stored whether or not something listens yet; only a paused (or disabled) connection refuses it. listening and used_by come from AbstractRuntime's active-consumers index (one snapshot per account for the whole listing, no run file read), updated as soon as an automation is created, changed or ends; a change another process makes to the same data folder shows within 30 seconds.

A row: {connection_id, principal ("<tenant>:<user>"), source_id, source_version (integer), label, status ("active" | "disabled" | "error"), listening ("listening" | "idle" | "paused"), used_by (integer: the active automations reading it), paused, always_listen, created_at, updated_at, last_event_at (string or null), last_error (object or null), config_public (object; never a secret), secret_fields, stream ("trigger:<id>"), ingress_url (webhooks)}. Errors: {"detail": {"reason_code", "message", "field"?}}. Request and response models are in the OpenAPI schema (/openapi.json, tag triggers).

curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"source_id":"webhook.received","source_version":1,"label":"Shop orders","config":{}}' \
  "$BASE_URL/api/gateway/triggers/connections"     # -> connection_id, secret (once), ingress_url

Feed catalogue

GET /api/gateway/triggers/feeds/catalog (any signed-in account) lists the well-known public feeds the console proposes for a new feed connection: the catalogue shipped with the gateway merged with <data dir>/catalog/feeds.json when that file exists (an entry with a shipped id replaces it, a new id adds a feed, "disabled": true hides a shipped one).

{"version": 1, "feeds": [
  {"id": "bbc-world", "name": "BBC News · World", "url": "https://feeds.bbci.co.uk/news/world/rss.xml",
   "site": "https://www.bbc.co.uk/news", "category": "World news", "language": "en",
   "description": "World headlines from the BBC.", "source": "shipped"},
  {"id": "github-releases", "name": "GitHub · Releases of a repository",
   "url": "https://github.com/{repository}/releases.atom", "template": true,
   "name_template": "GitHub · {repository} releases",
   "placeholder": {"key": "repository", "label": "Repository (owner/name)", "example": "python/cpython",
                   "pattern": "^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$"},
   "site": "https://github.com", "category": "Fill in your own", "language": "en",
   "description": "New releases of one public GitHub repository.", "source": "shipped"}]}

source is shipped or custom. A template (template: true) holds {<placeholder.key>} once in its url: the client asks for that value (checked against pattern when given) and creates the connection with the built address. An administrator also gets custom_path (where the custom file lives) and problems (custom entries that were skipped, and why). Creating the connection is the ordinary POST /api/gateway/triggers/connections with the chosen url.

Sample inputs (POST /api/gateway/triggers/sample)

What a triggered flow would receive, from your own real data, so Run on a flow that an automation triggers behaves as if the trigger fired (Flow's Run dialog calls it, then starts a normal run with inputs).

  • Body: {trigger: {source_id, source_version, config}, count?: 1..500 (default 100)}: the binding an automation would use (trigger.connection_id accepted as at creation).
  • Answer: {inputs, truncated, count, source, summary}. inputs are the flat named inputs plus event a real occurrence receives (messages + mailbox, items + feed, calls, scheduled_at + occurrence), bodies included; the event carries abstracttest: true. summary is one sentence: "Last 100 messages of me@example.com", "Latest 20 items of Python Insider", "Last 3 calls received by this webhook", "A sample call (this connection has not received one yet)".
  • Read-only: the newest messages of the bound mailbox (its filters applied; nothing marked read, no watcher cursor moved), the latest items of the feed connection, the last calls stored for the webhook connection; nothing is stored except the artifacts holding message bodies. A mailbox is read for at most 20 seconds (truncated: true then). Your own test reads your mailbox whether or not "Agent email tools" is on.
  • Errors ({"detail": {"reason_code", "message"}}): 404 email_account_not_found / connection_not_found (not one of yours), 409 email_not_configured (no usable mailbox), 422 invalid_sample (unknown source, bad config, bad count), 503 sample_unavailable (the feed could not be read), 504 sample_timeout.
curl -sS -X POST -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"trigger":{"source_id":"email.received","source_version":1,"config":{"account":"self"}},"count":20}' \
  "$BASE_URL/api/gateway/triggers/sample"

Webhook ingress (POST /api/gateway/triggers/webhooks/{connection_id})

The one public route of the family: it carries no bearer token. The Standard Webhooks signature with the connection's secret is the auth, so any external system (n8n, Zapier, GitHub, Stripe, a script) can call it once it knows the address and the secret.

  • Headers: webhook-id (unique per message), webhook-timestamp (Unix seconds), webhook-signature = v1,<base64 HMAC-SHA256(secret, "<webhook-id>.<webhook-timestamp>.<body>")> (several space-separated signatures are accepted; the secret is whsec_<base64 key>).
  • Verification and the append are AbstractRuntime's webhook.received@1 (abstractruntime.triggers.append_webhook_event).
  • 202 {accepted: true, connection_id, webhook_id, event_id, seq, woken}: one event appended to the connection's stream (CloudEvents names: subject and dedupekey = the webhook id, data = {webhook_id, content_type, body} with the parsed JSON body, or {webhook_id, content_type, body_text} for UTF-8 text; abstracttrust: "untrusted"), the automations bound to it woken. An occurrence reads it as input_data.event.data.events[i].data.body (one occurrence per batch of events that arrived together).
  • Refusals, each with {"detail": {"reason_code", "message"}}, recorded on the connection (last_error) and on the request's audit line (webhook {connection_id, outcome, reason_code}, never the body): 401 webhook_unsigned (a header missing), 401 webhook_signature_invalid, 404 connection_not_found (unknown id, or not a webhook connection), 409 connection_disabled (disabled or paused; an idle connection accepts the call), 409 webhook_stale (timestamp outside the connection's window: 5 minutes by default, tolerance_s 60..3600), 409 webhook_replayed (this webhook-id was already accepted: nothing is appended twice; senders should treat it as delivered, a Standard Webhooks retry reuses the id), 413 webhook_too_large (body over 512 KiB), 415 webhook_unsupported_body (neither JSON nor UTF-8 text), 429 webhook_rate_limited (60 calls a minute per connection, 120 per client address; Retry-After).
  • The origin allowlist does not apply (the signature decides). Making the gateway reachable from the internet (Tailscale Funnel, a reverse proxy) is the operator's choice.
SECRET='whsec_...'           # shown once when the connection is created
CID='tc_...'                 # the connection id
BODY='{"event":"order.paid","order":42}'
WID="msg_$(openssl rand -hex 8)"; TS="$(date +%s)"
KEY_HEX="$(printf '%s' "${SECRET#whsec_}" | base64 -d | xxd -p -c 256)"
SIG="$(printf '%s' "$WID.$TS.$BODY" | openssl dgst -sha256 -mac HMAC -macopt "hexkey:$KEY_HEX" -binary | base64)"
curl -sS -H "Content-Type: application/json" \
  -H "webhook-id: $WID" -H "webhook-timestamp: $TS" -H "webhook-signature: v1,$SIG" \
  -d "$BODY" "$BASE_URL/api/gateway/triggers/webhooks/$CID"
# 202: delivered. 409 webhook_replayed on a retry with the same webhook-id: also delivered.

Senders: the Standard Webhooks headers (webhook-id, webhook-timestamp, webhook-signature) are the only ones read. Services that sign with other headers (GitHub's X-Hub-Signature-256, Svix's svix-* names) need a relay that re-signs or renames. The step-by-step setup (console, Flow, the automation) and a copy-paste signed call are in events-examples.md.

Evidence: src/abstractgateway/routes/triggers.py (receive_webhook), src/abstractgateway/trigger_connections.py (lookup across accounts, rate limit), AbstractRuntime triggers/webhook.py (verification, event mapping).

Conversation read receipts (/api/gateway/me/session-reads)

Read receipts are scoped to the signed-in account and runtime. GET returns {items, next_after, more} in sequence order; use after for replay and limit (1–1000, default 200) for pagination. Repeated run_id parameters filter up to 100 visible turns.

POST accepts {receipts: [{session_id, run_id, status}]} (1–100 items), validates the entire batch, and returns its committed items. Status is request, completed, failed or cancelled. Only conversation turn roots in the caller's runtime are accepted; a terminal receipt must match the stored outcome (409 otherwise). Duplicate receipts return the original immutable event. Reading a request never acknowledges its later answer. Automation results continue to use their separate attention cursor.

The append-only read ledger persists independently of execution ledgers and personal-event retention. An idempotent delivery projection emits session.read into the existing personal event stream. Clients refresh canonical receipts after this event and after reconnecting. Mark a revision only when the user consumes the loaded content, not when listing or replaying it. Clients must retain unread state on write failure; browser-local baselines are not read evidence.

Your event stream (/api/gateway/me/events)

One ordered stream per person, user:<tenant>:<user>, holding what happened for you that is not a step of a run (a step stays in its run's ledger). Every client reads the same stream: a page to catch up, an SSE tail to stay live. Each event uses the CloudEvents 1.0 attribute names:

{"specversion": "1.0", "id": "run.started:9f2c…", "type": "run.started",
 "source": "/abstractgateway/runs", "subject": "9f2c…", "time": "2026-10-25T12:00:00+00:00",
 "data": {"run_id": "9f2c…", "session_id": "s1", "origin": {"kind": "person", "actor": "alice", "client": null, "ref": {}}},
 "sequence": 12}

sequence is your stream's own gapless counter (1, 2, …): it is the cursor. id is stable: an event written twice (a retry, a repair after a crash) is stored once.

type data written when
run.started {run_id, session_id, origin} a run of a session (a person's run, an automation occurrence) is saved running; never a child run or an automation's controller
session.read {sequence, session_id, run_id, status, at, event_id} a conversation revision was consumed; canonical receipt remains after event-stream pruning
run.finished {run_id, session_id, origin, status} that run is saved completed, failed or cancelled
trigger.event {automation_id, occurrence_index, event_id, source_id, source_version, fired_at, run_id, session_id} an automation's occurrence starts (before its run.started)
attention.raised {record_key, automation_id, run_id, index, kind, seq, channels} an automation records an attention item (notify or final failure); record_key names the ledger record, no title or body is copied
attention.seen {automation_id, seq} your seen cursor of an automation moves (POST /automations/{id}/seen)
attention.raised (a wait) {kind: "approval" \| "question", wait_kind, run_id, session_id, wait_key, step_id, record_key, prompt_ref} a run parks on a person: a tool call awaiting approval, a question (ask_user, or an event wait with a prompt or choices); prompt_ref is the run (GET /api/gateway/runs/{run_id} carries the prompt and the calls awaiting approval) — nothing is copied. A flow editor's draft test run (hidden from the run listings) never raises one, and an open wait of one is closed when the gateway starts
attention.seen (a wait) {kind, run_id, wait_key, step_id, outcome} that wait ends: answered, approved, denied, timed_out, cancelled or failed
notification.sent, notification.failed {channel, notice, …} a notice reached a channel or could not: console (the item is listed), email (the outbox sent it, or failed with code, cause), tray (the desktop tray showed it), watch / phone with via: "push" (Apple accepted the push, or an approval or question could not be pushed within an hour; see push.md)
wake.scheduled {automation_id, session_id, origin_run_id, at \| on} a run asked for work later (schedule_run, the SCHEDULE_RUN effect): the gateway created a one-shot automation that will run in the caller's session
wake.cancelled {automation_id, session_id, origin_run_id} that automation was archived before it fired: nothing runs
your own type (orders.paid, default <channel>.message), with channel {title, body?, …your data} a flow published it to you (the PUBLISH_EVENT effect, {channel, type?, title, body?, subject?, data?, alert?, recipient?, channels?}); id publish:<run_id>:<step_id>
attention.raised (a published alert) {kind: "notify", record_key: "publish:<run_id>:<step_id>", channel, run_id, title, published_sequence, recipient, channels?} that publication had alert: true: recipient is "me" (another account is refused for now); channels the deliverers it asked for, from tray, watch, phone, email, console (Notify me's "Where"; absent = every channel). The tray shows and counts it only when tray is listed, push rings only the listed apps (watch first among them), the email outbox mails it (kind: notify_me) only when email is listed and a mailbox is usable; the console item is this record, always written. channels without alert is refused
attention.seen (a published alert) {record_key} you saw it (POST /api/gateway/me/events/seen)

What needs you = the attention.raised items without their attention.seen: an automation item is seen once a attention.seen of its automation has a seq at or above it; a wait is seen by the attention.seen with the same run_id, wait_key and step_id; a published alert by the attention.seen with the same record_key.

Channels. A published event carries a channel (lowercase letters, digits, ., _, -, at most 64). Every attention.* event is on the channel attention; the other gateway events have none. Both read routes take channel=<name>[,<name>…] to receive only those channels; without it you receive everything.

Older events go after 90 days or beyond the newest 10,000 (their sequence is never reused).

Catch up: GET /api/gateway/me/events?after=<sequence>&limit=<n>

Events with sequence > after, oldest first (limit 1–1000, default 100), optionally only on some channels (&channel=orders,attention). Answer: {stream, events: [...], next_after, head, more, channels?}: send next_after as the next after (with a channel filter it is past the events of other channels too); head is the newest sequence; more says a further page may exist.

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/me/events?after=0&limit=100"

Stay live: GET /api/gateway/me/events/stream?after=<sequence>&heartbeat_s=15

Server-sent events, the same after semantics as /runs/{run_id}/ledger/stream: the catch-up from after, then each new event as it is written. Each frame is id: <sequence> / event: <type> / data: <event JSON>; a : keep-alive comment every heartbeat_s seconds (0.1–60, default 15). A reconnecting client sends Last-Event-ID (browsers do it on their own) and receives exactly the events after it; an explicit after wins over the header. The stream does not end on its own. &channel=<name>[,…] sends only those channels; the id stays the stream's sequence, so Last-Event-ID resumes past the other channels' events.

Your channels: GET /api/gateway/me/events/channels

{stream, channels: [{channel, count, last_time, last_sequence}]} over your retained stream, most recently used first (attention included when you have attention events).

Mark a published alert seen: POST /api/gateway/me/events/seen

{record_key: "publish:<run_id>:<step_id>"} writes attention.seen {record_key} in your stream ({ok, created}; another kind of key is 422). Automation items are marked seen with POST /api/gateway/automations/{id}/seen; a wait ends when it is answered.

curl -sS -N -H "$AUTH" -H "Last-Event-ID: 12" "$BASE_URL/api/gateway/me/events/stream"

Report a notice a client showed: POST /api/gateway/me/events/notifications

{channel: "tray" | "assistant" | "code" | "watch" | "phone", outcome: "sent" | "failed", record_key, device?, error?} records notification.sent|failed {channel, notice: "attention:<record_key>", record_key, device?} in your stream (once per channel and record; any other channel is 422). The desktop tray, the Assistant, the Code apps, the watch and the phone call it after each notification they show. device is an opaque id of the machine (the tray sends the first 16 hex characters of the sha256 of the lower-cased host name; an app on the same machine sends the same value).

One notification per machine. Before an app shows an OS notification for an attention item, it reads the recent stream and stays silent when it holds a notification.sent for the same record_key from another client channel with the same device, less than 60 seconds old. The gateway tray is the default notifier (it notifies at once); the Assistant and Code notify only when no tray, or other app, reported on that machine. A watch and a phone each have their own device, so they always notify. Reference implementation: events_stream.already_notified(events, record_key=, channel=, device=).

There is no parameter naming a person: every route reads and writes the caller's own stream in the caller's own plane, so two accounts never see each other's events.

Evidence: src/abstractgateway/events_stream.py (vocabulary, writers, boot repair), src/abstractgateway/routes/me_events.py, src/abstractgateway/runner.py (_stream_run, _drain_user_stream).

A closed app on a watch or an iPhone learns about new attention items through Apple push: see Push devices and push.md.

After the run: GET /api/gateway/runs/{run_id}/after

What happened after a run, in one read (framework ADR-0041 "No hidden effects after a flow"): what arrived, when it ran, the note its On Flow End recorded, the alert it raised (or why nothing rang) and every recorded delivery. Flow's run view and Observer's run card show it as After the run.

{
  "run_id": "ce98246c-…",
  "trigger": {
    "automation_id": "da8bc2b9-…", "automation_title": "Gmail watch", "occurrence_index": 15,
    "source": "email.received", "text": "When mail arrives in me@example.org", "connection": "me@example.org",
    "fired_at": "2026-10-26T00:15:59+00:00",
    "arrived": {"count": 4, "noun": "new emails", "line": "“O” from codex@athena.ovh and 3 more"}
  },
  "run": {"run_id": "ce98246c-…", "status": "completed", "started": "…", "ended": "…",
          "response_excerpt": "…", "note": "4 mails judged; 4 suspicious."},
  "attention": {"record_key": "automation:completed:da8bc2b9-…:15", "kind": "notify",
                "title": "Suspicious credential emails received", "raised_at": "…", "from": "flow_end"},
  "alerts": ["… every alert, the same shape …"],
  "deliveries": [
    {"record_key": "automation:completed:…:15", "channel": "tray", "via": "stream", "device": "a5e2…", "time": "…", "state": "sent"},
    {"record_key": "automation:completed:…:15", "channel": "watch", "via": "push", "device": "506b…", "device_name": "Watch", "time": "…", "state": "sent"}
  ],
  "tree": ["ce98246c-…"]
}
  • trigger: null for a run no automation started. arrived is null for a schedule or a run by hand.
  • run.note: On Flow End's note pin (a short line of what happened and why); response_excerpt its response, at most 280 characters.
  • alerts (and attention, the first of them): from says where each came from: flow_end (the notify pin of flows saved before ADR-0041), failure (the automation's failure item), notify_me (a Notify me node), publish (Publish to channel with Alert on), wait (the run or a sub-run parked on you: kind approval or question, with run_id, prompt_ref and open until it was answered, cancelled or timed out; an open wait comes first) and email_when_done. A published alert (notify_me, publish) also carries recipient ("me") and asked: the channels it chose (["watch", "phone"]) or "all", shown as "asked: watch, phone" beside the deliveries; its email delivery, when asked, is found by its outbox key.
  • deliveries: one row per notification.sent|failed recorded for those alerts. via is push (the gateway's push dispatcher), outbox (email) or stream (an app read your stream and showed it; the console lists the item). device_name when the device registered one; reason on a failure.
  • quiet_reason (only when there is no alert): empty title (On Flow End's notify object had a blank title), no notify (the run reached no Notify me step; a null notify counts as none), still running, not recorded yet (the run ended, the automation has not recorded its decision yet). Deliveries are recorded after the run ends: clients read again for a few seconds.
  • tree: the runs looked at, the run and its sub-runs (parent_run_id links, at most 200).

Built from exact reads, never a scan of your stream: the automation's decision by its ledger key automation:completed:<automation_id>:<index>, then each alert and delivery by its deterministic event id through the stream's index. The run is looked up in your own plane (404 otherwise) and the deliveries in your own stream.

Evidence: src/abstractgateway/run_after.py, src/abstractgateway/routes/me_events.py (get_run_after), tests/test_run_after.py.

Push devices (/api/gateway/me/push/devices)

The AbstractAssistant apps register here so they get your alerts while closed (push.md). Like /me/events, every route acts on the caller's own account; a browser session's PUT and DELETE carry the CSRF header.

Register or refresh: PUT /api/gateway/me/push/devices/{device_id}

{"token": "<APNs device token, 64-200 hex>", "topic": "ai.abstractframework.assistant.watch",
 "env": "production", "app": "watch", "reg": "<16-32 hex, new at every sign-in>", "name": "Wrist"}

device_id is the app's own opaque id (letters, digits, ., _, :, -, at most 200); env is production or sandbox; app is watch or phone; name (optional, at most 60) is shown in the console. Any other field is 422. topic must be one of the packaged apps (ai.abstractframework.assistant.watch, ai.abstractframework.assistant.iphone) or a topic the relay lists at GET <relay>/v1/info. Answer: {ok: true, relay: "on" | "off" | "unreachable"} (off: no push forwarder address is in effect). The apps call it at every sign-in, when their token changes and at most daily; a registration expires 7 days after its last refresh. The same token registered by another account on this gateway moves to the caller.

Sign out: DELETE /api/gateway/me/push/devices/{device_id}

{ok: true, deleted: true | false} (your own registrations only; deleting twice is not an error).

Your devices: GET /api/gateway/me/push/devices

[{"device_id": "4f1c9a0b2d3e4f56", "app": "watch", "name": "Wrist",
  "refreshed_at": "2026-10-25T12:00:00+00:00", "last_sent_at": "2026-10-25T12:05:00+00:00",
  "last_error": null}]

Oldest registration first; tokens are never returned.

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/me/push/devices"

Evidence: src/abstractgateway/routes/push.py, src/abstractgateway/push/store.py.

Push forwarder (/api/gateway/push/settings)

Where this gateway sends its push requests, gateway-wide; admins only (read and write). The address in use is the --push-relay flag of this run, else the saved setting, else the packaged default (none in this release, so off). See push.md.

Read: GET /api/gateway/push/settings

{"forwarder": {"mode": "url", "url": "http://127.0.0.1:8095", "effective": "http://127.0.0.1:8095",
               "source": "setting", "packaged": null}}

mode is the saved choice: default (the packaged address), off, or url with url. effective is the address pushes go to (null: off); source says where it comes from: flag (the launch flag wins for this run; the saved choice applies at the next start without it), setting or packaged. packaged is the built-in address (null until the publisher's forwarder is live).

Save: PUT /api/gateway/push/settings

{"mode": "url", "url": "http://127.0.0.1:8095"}

mode is default, off or url; url goes with url only. The address is https://, or http:// for a loopback host (127.0.0.1, ::1, localhost); no user name, query or fragment. Anything else is 422 with the reason. The setting takes effect at once, without a restart: the dispatchers of this process are started or woken, and every dispatcher re-reads the address at each pass (a split runner sees the file move within 2 seconds). The answer is the GET body; when an address is in effect it also carries one probe of GET <address>/v1/info: "probe": {"reachable": true, "topics": ["ai.abstractframework.assistant"], "reason": null}, or {"reachable": false, "topics": [], "reason": "Could not reach it (ConnectError: …)."}. The setting is saved either way.

curl -sS -X PUT -H "$AUTH" -H 'Content-Type: application/json' \
  -d '{"mode": "url", "url": "http://127.0.0.1:8095"}' "$BASE_URL/api/gateway/push/settings"

Evidence: src/abstractgateway/routes/push.py, src/abstractgateway/push/settings.py, src/abstractgateway/push/dispatcher.py.

Conversation tool choices

Assistant clients use GET /api/gateway/discovery/tools and the established POST /api/gateway/runs/start contract. Send enabled names in both input_data.tools and input_data._runtime.allowed_tools; put named auto_approve_tools and require_approval_tools lists in input_data._runtime.tool_policy. Omitted restrictions inherit defaults; explicit empty allowed-tool lists disable every tool. No additional capability probe is required for this contract. GET /api/gateway/tool-policy/capabilities answers {supported, modes: [off, auto, approve], runtime_floor} and GET /api/gateway/automations/defaults answers {growing_max_tokens} (the history window a growing-context automation keeps). GET /api/gateway/runs/{run_id}/message-stats gives one of the caller's runs its {wall_time_seconds, input_tokens, output_tokens, tool_calls}, read from the run's ledger (completed effects only; a count the ledger does not carry is null).

Entity clients discover visit-scoped controls with GET /api/gateway/entities/{name}/session-tools (visit_routes: true advertises the canonical open/close extensions; when absent, use the compatibility aliases). Open through POST /api/gateway/entities/{name}/visit/open with a stable session_id and tool_policy: {"modes": {"read_memory": "approve"}}. Modes are off, auto and approve; an explicit empty map disables all tools and modes: null inherits the home's grants. Omit tool_policy to retain legacy visit behavior. These choices apply only to this visit and cannot widen the home's grants.

Use the visit's /state, /tool-policy and /decision routes to read progress, change choices between turns and answer the exact pending approval. Optional conversational updates, live correction and question answers use the separate /guidance and /answer routes in entities.md. End through POST .../visit/{run_id}/close with {"closed_by":"pause"}; pending approval is cancelled without executing its tools. Managed visits are bound to their authenticated owner. /entities/{name}/sessions and /visit/{run_id}/end remain deprecated compatibility aliases. Gateways without entity session-tool support still support the established Assistant tool-control contract.

Session tool policy (approve or deny for the whole conversation)

A person's standing tool decision for one conversation ("approve all", "approve all web tools", "deny execute_command", reset) is held by the gateway, not by the client. The runtime reads it before it decides whether a tool batch waits: a covered call runs with no approval wait and no interaction, a denied call is refused with no wait, and each decision is an abstract.tool_policy_decision record in the run's ledger. It applies to every run of the session (the run tree's root session): each turn's root run, delegated agent child runs, runs resumed after a restart. Approvals do not reach automation runs, runs that read text other people wrote (untrusted input), entity visits or runs started without a session_id; a deny reaches every run of the session, and also wins over an approval that was shown before the deny and answered after it. Every answer carries scope, which says so in words.

Method Path Meaning
GET /api/gateway/sessions/{session_id}/tool-policy {session_id, policy, revision} (policy: null when none)
PUT same replace the policy
POST same merge: adds the new selectors' tools to the stored ones (never narrows, never re-expands an earlier all/kinds); guarded by the revision it read, so a concurrent reset or deny is never undone
DELETE same (?if_revision=) reset: later calls follow the normal defaults

Body (PUT, POST):

{"approve": {"tools": ["fetch_url"], "kinds": ["web"], "all": false, "max_risk_rank": 3},
 "deny": {"tools": ["execute_command"], "kinds": []},
 "ask": ["send_email"], "client": "panel-chat", "if_revision": 4}
  • kinds are the toolset values of GET /api/gateway/discovery/tools rows (files, web, system, email, mcp:<server>…); all means every tool the gateway authorizes for the caller; max_risk_rank (1–4) limits what kinds and all expand to by the row's risk_rank.
  • The gateway clamps: approve selectors expand, at write time, to the enabled rows GET /discovery/tools serves the caller (email tools only when the account's agent email tools are on, MCP tools only for servers offered to agents). Anything else is listed in clamped (not_authorized, unknown_kind). A tool enabled later is not covered by an earlier all. The run's own allowed_tools still blocks any tool outside it.
  • deny wins over approve; ask keeps names asking under approve.
  • all and kinds include the tools whose destination the model chooses (fetch_url, browser_probe, send_email when email is on): "allow all" is the person's explicit word for this conversation, unlike the gateway's default tier ceiling, which never auto-approves them. A client that wants them to keep asking lists them in ask (or narrows with max_risk_rank).
  • if_revision (body of PUT/POST; query ?if_revision= on DELETE): a mismatch answers 409 {"detail": {"reason_code": "revision_conflict", "message", "revision": <current>}}. The gateway never retries a client-sent if_revision. Without one, a POST guards itself with the revision it read and re-reads and re-merges on a conflict (up to 5 tries, then the same 409 without revision); a PUT without one is last-writer-wins.
  • Malformed body or session id: 422 {"detail": {"reason_code": "invalid_request", "message"}}. When the caller's tool inventory cannot be built, writes answer 503 {"detail": {"reason_code": "tool_inventory_unavailable", "message"}} (no policy is written that the gateway cannot clamp).

Answers. PUT and POST: {session_id, policy, scope}, where policy is {version, session_id, revision, approve: {name: selector}, deny: {name: selector}, ask, request, clamped, set_by: {tenant_id, user_id, client}, set_at}. GET: {session_id, policy, revision, scope}; the top-level revision is the session's current revision also when policy is null (0 for a session never written, the reset's revision after a DELETE), the value to send as if_revision. DELETE: {session_id, policy: null, revision, scope}. scope is on all four answers, an object of two sentences:

{"approve": "every run of this conversation (turns and their delegated child runs), except automation runs, runs that read text other people wrote, and entity visits",
 "deny": "every run of this conversation, automation runs and untrusted-input runs included"}

Writes and resets are audited (session.tool_policy_set, session.tool_policy_reset).

Ledger record (an activity; there is no wait, waiting record or resume for these calls):

{"effect": {"type": "emit_event", "payload": {"name": "abstract.tool_policy_decision", "scope": "run",
  "payload": {"decision": "auto_approved", "source": "session_policy", "session_id": "s-123",
              "node_id": "agent", "tool_calls": [{"call_id": "c1", "name": "fetch_url", "matched": "kind:web"}],
              "policy": {"revision": 5, "set_by": {"tenant_id": "default", "user_id": "alice", "client": "panel-chat"},
                         "set_at": "2026-10-27T10:00:00+00:00"}}}},
 "status": "completed"}

decision is auto_approved or denied. Clients feature-gate on GET /api/gateway/discovery/capabilities → capabilities.session_tool_policy.supported: true with {version, endpoint, methods, approve, deny, ask, record}, or {supported: false, reason: "abstractruntime has no session tool policy"} when the installed runtime lacks it; an older gateway has no key at all. To offer "approve all" on an approval a client is showing: write the policy first, then answer that wait (resume with {approved: true}) as a one-off; the policy does not answer waits that already exist.

Track record, reputation and acquaintances

What an entity has done, how far it can be trusted for each kind of task, and whom it met (the framework's ADR 0052, sections 5, 6 and 11). AbstractRuntime computes all three from records that already exist (runs, their ledgers, the home's task inbox and work orders); nothing new is stored. The gateway passes the runtime's answer through unchanged.

Route Answer
GET /api/gateway/entities/{name}/track-record[?since=<ISO-8601>] TrackRecord from the entity's home
GET /api/gateway/entities/{name}/reputation Reputation from the same record
GET /api/gateway/entities/{name}/acquaintances Acquaintances: the entities and humans it met
GET /api/gateway/sessions/{session_id}/track-record[?since=<ISO-8601>] TrackRecord of a regular agent's session
GET /api/gateway/sessions/{session_id}/reputation Reputation of that session
GET /api/gateway/sessions/{session_id}/acquaintances Acquaintances of that session

TrackRecord: {subject, identity_ref, fingerprint, computed_at, as_of, since, sessions, runs, successes, failures, cancelled, in_progress, assessed, tokens: {input, output, total}, by_task_kind: {<kind>: {runs, successes, failures, cancelled, tokens_total, first_at, last_at, last_outcome_at}}, recent_outcomes: [...], basis}. subject is entity:<slug> or session:<session_id>. A run counts when a person or a trigger started it (or it is an automation occurrence); sub-runs and runs another run started are never counted, their tokens count with the run above them. A task kind is <phase or role>/<workflow_id>, for example visit/visit-flow. basis is "completion-rate only": a success is a run that completed (or a task done, a work order done) until outside feedback exists, and assessed stays 0. The entity's fingerprint carries book_head, the head of its diary chain; a session has none. since keeps what started at or after that time (2026-11-04, 2026-11-04T10:00:00Z; any other value is a 400 invalid_since).

Reputation: {subject, identity_ref, computed_at, overall, by_task_kind: {<kind>: cell}, evidence: [...], basis}; a cell is {trust, support, successes, failures, last_outcome_at, text}, with trust = (successes + 1) / (successes + failures + 2) and support = successes + failures. A kind with no outcome reads trust 0.5, support 0. evidence is the last 20 outcomes, oldest first: {run_id, task_kind, outcome, at, signal, by}.

Acquaintances: {subject, identity_ref, computed_at, as_of, entities: [...], humans: [...], not_counted}; each row is {id, first_seen, last_seen, interactions, kinds}. not_counted gives, per reason, the interactions that name no entity or human (an agent in a shared room, a participant without a namespace).

An empty record is an answer like any other (runs: 0, support: 0, empty lists): the app words it ("No experience yet").

Who. The entity routes answer whoever may see the entity: its creator or an admin (on a gateway without accounts, everyone); a hidden entity answers 404 like a missing one. The session routes answer the session's owner or an admin: each account works in its own runtime plane, so another account's session answers 404 {"detail": {"reason_code": "session_not_found"}}. An entity under a maintenance hold answers 409. A record the runtime cannot read (for example an unreadable identity.json) answers 500 {"detail": {"reason_code": "record_unreadable", "message": ...}}, never an empty record.

Cost. One listing of the subject's runs and one read per turn root; nothing is cached. Measured on a home with 3000 runs: about 50 ms for a track record or a reputation, 35 ms for acquaintances (about 170 ms with 50 KB of variables in every run). Apps load these when the view opens, not on a poll.

Beyond the core

/api/gateway/* also includes optional operator/tooling endpoints (reports inbox, triage queue, backlog browsing + exec runner, process manager, file/attachment helpers, embeddings, voice, discovery, …).
See: maintenance.md.

AbstractNote (optional)

When the abstractnote Python package is installed in the gateway's environment, the gateway mounts its note read API under /api/gateway/note/ (GET /api/gateway/note/status, /notes, /search, /entities/{id}, /graph, /timeline, …). Every route resolves the caller's own notebook (abstractnote/ under the user's data plane) from the signed-in principal, with the same bearer token or app session as every other /api/gateway route; an id from another notebook is simply not found (404). The routes, their parameters and answers are documented by AbstractNote itself (its docs/api.md, "Note read API"). Without the package the prefix answers 404 like any unknown path. The same install binds the note tools to each user's notebook and loads the abstractnote workflows: see apps.md (the Note app).

Discovery endpoints (optional)

These exist to help thin clients adapt to the deployed gateway.

  • Capabilities (best-effort): GET /api/gateway/discovery/capabilities. Add ?scope=voice for only capabilities.contracts.assistant.voice (TTS, STT, listen), with the same authentication and voice descriptors but without music/image/provider discovery. The default scope=all keeps the full response. Clients must cache the scoped response separately; older Gateways may ignore the query and return the full response.
  • Providers/models discovery (best-effort): GET /api/gateway/discovery/providers, GET /api/gateway/discovery/providers/{provider}/models
  • Tools (thin-client allowlist help): GET /api/gateway/discovery/tools. Round 12: each process-spawning tool row (AbstractRuntime's SANDBOXED_TOOL_NAMES: execute_command, shell_exec, local_helper_start, execute_python) carries sandboxed: true|false and sandbox (the state sentence, for example "Sandboxed to this run's workspaces"), and the answer carries command_sandbox (as on GET /workspace/policy)
  • Skills inventory: GET /api/gateway/skills — the abstractskill shelf with trust verdicts (roster rows {name, description, trust_level, blocked, requires_review, tree_hash, source, has_scripts, reasons}); degradations are labeled warnings, never a fabricated list. The shelf is, in order: the saved setting skills.shelf, then the legacy launch environment value (reported as such), then the gateway's own copy in <data dir>/skills/registry, then a framework checkout's shelf (only when that copy is missing), else none; the response names which as shelf_source (stored, env, seeded, checkout, none). See Skills shelf.
  • MCP server inventory: GET /api/gateway/mcp/servers — the declared registry at <data_dir>/config/mcp_servers.json ({"version": 1, "servers": [{"name", "url"?, "description"?, "auth_required"?, "tags"?}]}), served with declared fields only and probed: false (connect state/tool counts require a probe lane and are never faked).
  • Dynamic capability catalogs: GET /api/gateway/voice/voices, GET /api/gateway/audio/speech/models, GET /api/gateway/audio/transcriptions/models, GET /api/gateway/audio/music/providers, GET /api/gateway/audio/music/models, GET /api/gateway/vision/provider_models

The capabilities payload includes package presence (abstractruntime, abstractcore, abstractmemory, abstractvoice, abstractvision), existing gateway helpers (tools, visualflow, media), memory-store readiness, and AbstractCore capability plugin status for voice, audio, vision, music and decision. The contracts (contracts.common, flow_editor and assistant) carry a decision descriptor beside media: the VisualFlow decide node (workflow) and the direct endpoint (direct_endpoint: endpoint, openai_endpoint, capability_route, returns), each with available; see Decisions.

The route paths and contract descriptors are the stable part of this surface. Catalog routes also include a stable Gateway-owned envelope:

  • catalog.contract = gateway_catalog_v1
  • catalog.version = 1
  • items = [...]

The lower-layer fields stay in the payload for compatibility. Thin clients should read catalog plus items; the route-specific fields (models, provider_models, profiles, voices) remain available.

Provider discovery also reports the resolved default provider/model when one is configured. The resolver follows request values, flow pins, and the execution-host input.text capability route; if no pair exists, the response includes default_error rather than a hardcoded local model.

It also includes a versioned thin-client contract:

  • capabilities.contracts.version: currently 1
  • capabilities.contracts.common: shared run start/list/summary/input/history, ledger, artifact, attachment, workspace, discovery, provider prompt-cache controls, and the host-visibility descriptors model_residency (including row_schema = "model_residency_row_v1" and the canonical modality_ui color map), host_state, and session_caches (see Host state and model residency). common.artifacts includes run listing/content, session artifact listing, artifact search with artifact_envelope_v1, exact stats/facets, artifact_kind UI filtering, workspace import, and workspace export descriptors when available. Permission-sensitive descriptors are principal-aware: ordinary users see admin-only workspace import/export and provider prompt-cache controls marked unavailable with admin_required metadata.
  • capabilities.contracts.common.readiness: compact Gateway-owned gateway_surface_readiness_v1 summary derived from the shared endpoint/media/ residency descriptors
  • capabilities.contracts.flow_editor: the AbstractFlow editor/runtime surface
  • capabilities.contracts.assistant: assistant-facing voice/audio/media/cache feature gates
  • capabilities.contracts.abstractcode: code-client run/history/workspace/cache feature gates

Contract booleans are intentionally conservative. Package installed=true is not the same thing as endpoint available=true; clients should branch on the versioned contract fields when enabling controls.

common.readiness is intentionally narrower than provider/backend health. It summarizes Gateway surface availability from existing descriptors, but it does not invent selected backend/provider/model truth or stable degraded-state reason codes.

Evidence: src/abstractgateway/routes/gateway.py (discovery_capabilities, discovery_providers).

AbstractFlow gateway-first editor contract

The browser editor can use AbstractGateway as its runtime and storage host.

Draft VisualFlow records:

  • GET /api/gateway/visualflows
  • POST /api/gateway/visualflows
  • GET /api/gateway/visualflows/{flow_id}
  • PUT /api/gateway/visualflows/{flow_id}
  • DELETE /api/gateway/visualflows/{flow_id}
  • POST /api/gateway/visualflows/{flow_id}/publish

Bundle inspection and editor run-schema helpers:

  • GET /api/gateway/bundles
  • GET /api/gateway/bundles/{bundle_id}
  • GET /api/gateway/bundles/{bundle_id}/flows/{flow_id}
  • GET /api/gateway/bundles/{bundle_id}/flows/{flow_id}/input_schema

Workflow description (the console's inline edit on the Workflows page):

Route Body → answer
PATCH /api/gateway/bundles/{bundle_id} {description} (at most 2000 characters; "" goes back to the file's own description) → {ok, bundle_id, owner, description, description_edited, updated_by, updated_at}

Only the owner may: a user for their own workflows, an admin for the gateway's. A user on a shared workflow gets 403 admin_required, another user's workflow is 404, a shipped workflow 409 workflow_shipped. The .flow file is never rewritten (Export keeps the original bytes); the text applies to every version and is kept next to the owner's archive file (config/workflow_descriptions.json). Each attempt is audited as workflow.description (lengths, never the text). GET /api/gateway/bundles items carry the effective description, description_edited and actions.can_edit_description; the envelope's interfaces ({<interface id>: {label, help, known}}) names every interface the listed workflows declare, readable by any signed-in account (the console's "Used by" column).

The input-schema endpoint returns a versioned payload with:

  • version
  • bundle_id, bundle_version, bundle_ref, flow_id, workflow_id
  • inputs: entrypoint input pins derived from the on_flow_start node
  • defaults: pin defaults from VisualFlow JSON
  • input_data_schema: a small JSON Schema object for the Run Flow modal

Example:

curl -sS -H "$AUTH" \
  "$BASE_URL/api/gateway/bundles/my-bundle/flows/ac-echo/input_schema"

Native-loop bundles (react / codeact / memact)

Some shipped bundles declare metadata.native_loop_factory instead of VisualFlow JSON (manifest.flows is empty). The gateway materializes an abstractagent loop at load time. Discovery uses the same bundle list endpoint — not /discovery/workflows.

Thin clients should:

  1. GET /api/gateway/bundles (authenticated).
  2. Filter entrypoints whose interfaces includes abstractcode.agent.v1.
  3. Read metadata.native_loop_factory (react, codeact, or memact) to distinguish native loops from VisualFlow agent bundles.
  4. Use each entrypoint's workflow_id (for example react-agent@0.1.0:react).
  5. Start runs with POST /api/gateway/runs/start and bundle_id / flow_id from the bundle listing (for example react-agent + react).

Native-loop entrypoints do not ship VisualFlow JSON. The gateway serves a versioned input-schema stub (prompt required; provider and model optional) from GET /api/gateway/bundles/{bundle_id}/flows/{flow_id}/input_schema. Headless clients may also pass those fields without fetching the schema.

The shipped react-agent@0.1.0 bundle is built by scripts/build_react_agent_bundle.py and force-included in the wheel. A running gateway process must restart (or call bundle reload) after the file lands on disk before /bundles lists it.

Run history bundle (GET /runs/{run_id}/history_bundle)

Thin clients should prefer this endpoint over stitching ledger, session, and artifact endpoints. The export is owned by AbstractRuntime; the gateway forwards query parameters and returns the bundle JSON unchanged (including in-band degradations).

Query parameters:

Parameter Default Notes
include_subruns true Descendant runs in the bundle tree
include_session false Root session turn list
session_turn_limit 200 Cap when include_session=true
ledger_mode tail tail or full
ledger_max_items 2000 Per-run ledger cap when ledger_mode=tail
detail full full (complete payloads) or replay (transcript-fold projection)

detail=replay drops request-side payloads and observability paths the transcript fold never reads; runtime marks each omission with $omitted inside ledger records. Use it for session replay and thin-client folds — it is much smaller than full (gzip helps further; send Accept-Encoding: gzip).

warnings (always present, may be empty): typed degradations the export survived instead of failing silently. Each entry is an object with at least code and detail; many include run_id. Known codes today:

Code Meaning
subtree_discovery_failed Could not list child runs; bundle covers root only
subtree_truncated Descendant discovery hit the run cap
ledger_read_failed Ledger for a run id could not be read
torn_rows_skipped Corrupt/unparseable ledger lines skipped
ledger_tail_window Ledger truncated to ledger_max_items (tail mode)
input_data_offload_failed Input-data artifact reference could not be resolved

Clients must surface non-empty warnings to the operator — a bundle that "looks complete" but carries warnings may be missing subruns, ledger tail, or offloaded input data.

Session history bloc (GET /sessions/{session_id}/history/bloc)

Returns one cursor-bounded bloc of root session turns, each with an inline history_bundle export — one round-trip instead of N per-turn bundle fetches. Resume pagination uses an ISO created_at cursor in the before query parameter (never turn-count offsets). The turns are the ones GET /api/gateway/runs?root_only=true lists for the session: parent-less runs plus automation occurrences (a retried occurrence once, as its last attempt), never automation controllers (automations.md).

Query parameters:

Parameter Default Notes
before (omit) ISO-8601 cursor; only turns strictly before this timestamp
limit 5 Max turns in this bloc (1–50)
detail replay Forwarded to each turn's bundle export (full | replay)
include_subruns true Per-turn bundle tree
ledger_mode tail tail or full
ledger_max_items 2000 Per-turn ledger cap when ledger_mode=tail
include_drafts false Include draft-test root runs

Response fields: session_id, cursor_before (echo of before), cursor_after (oldest turn returned — pass as the next before), older_remaining, warnings, and turns[] (run_id, created_at, status, prompt_author, author, repeat_of, bundle or error). author (who answered) and prompt_author (who asked) are {kind: "entity"|"agent"|"person", name, entity_id, identity_ref, avatar: {style, color}|null}, every key present; the bundle's run section carries the same two. An entity's mention (entities.md) is a turn whose author.kind is entity; an agent's turn is named by its workflow (workflow_selection.name), a person's by the account's display name. GET /runs/{run_id}, the replay view's user and assistant messages and the run.started/run.finished events of /me/events carry them too; every live reply frame (llm.delta, llm.delta_end) carries author.

The editor observes runs with the core lifecycle endpoints above: /runs/start, /runs/{run_id}, /runs/{run_id}/ledger, /runs/{run_id}/ledger/stream, /runs/ledger/batch, /runs/{run_id}/input_data, /runs/{run_id}/history_bundle, and /runs/{run_id}/artifacts.

Optional multimodal scope

Current direct Gateway endpoints: - POST /api/gateway/runs/{run_id}/voice/tts - POST /api/gateway/runs/{run_id}/voice/tts/stream - POST /api/gateway/runs/{run_id}/audio/transcribe - POST /api/gateway/runs/{run_id}/images/generate - POST /api/gateway/runs/{run_id}/images/edit - POST /api/gateway/runs/{run_id}/images/upscale - POST /api/gateway/runs/{run_id}/videos/generate - POST /api/gateway/runs/{run_id}/videos/from_image - POST /api/gateway/runs/{run_id}/music/generate - POST /api/gateway/runs/{run_id}/decisions (below) - GET /api/gateway/voice/defaults - GET /api/gateway/voice/voices - GET /api/gateway/voice/languages, GET /api/gateway/voice/clones, GET /api/gateway/voice/clones/{voice_id}, GET /api/gateway/voice/compatibility - POST /api/gateway/voice/clones, PATCH / DELETE /api/gateway/voice/clones/{voice_id}, POST /api/gateway/voice/design (an account's own voices; administrators where the store is shared) - GET /api/gateway/audio/speech/models - GET /api/gateway/audio/transcriptions/models - GET /api/gateway/audio/music/providers - GET /api/gateway/audio/music/models - GET /api/gateway/vision/provider_models - GET /api/gateway/vision/adapters

/vision/provider_models lists AbstractVision's backends and, for text_to_image and image_to_image, the enabled openai / openai-compatible endpoint profiles that serve the task (provider = endpoint:<id>, described in endpoint_providers; a profile whose endpoint could not be read is named in endpoint_provider_errors). A profile qualifies with a known OpenAI image model (gpt-image-*, dall-e-*; only those models are listed) or by declaring the task in its capabilities (all its models). ?provider=endpoint:<id> returns that profile's image models and also reads the endpoint's own catalog through the profile's connection: a model the endpoint says serves the task is listed (whatever its name), a model it says does not is left out, and a model it says nothing about is decided by its name as above; the profile's allowed_models bound the result. An endpoint that does not exist or is disabled answers 404.

/voice/defaults is the one answer to "which engines speak and listen by default":

{"tts": {"route": "output.voice", "configured": true, "provider": "supertonic", "model": "supertonic-3", "voice": "M3"},
 "stt": {"route": "input.voice", "configured": true, "provider": "faster-whisper", "model": "large-v3"},
 "source": "capability_defaults"}

A route the administrator has not set reads {"configured": false, "provider": null, "model": null, "note": "No gateway default is set for …"}. A synthesis or transcription request that names no provider and no model runs exactly these routes, so apps show "Gateway default · supertonic / supertonic-3" from here — never from the voice catalog's engine-side fields. The catalog repeats the answer (gateway_defaults; active_tts_provider / active_stt_provider = the configured routes, absent when unset). A configured speech-input route can carry AbstractCore's served hint {code, sentence, route}: on Apple silicon, a faster-whisper route runs on the processor, and the hint says that mlx-whisper runs the same model on the Apple GPU (route is what applying the recommendation writes; nothing changes by itself). The sentence names where to act and carries no timings. Apps show hint.sentence verbatim next to the engine line; the console's defaults grid shows the same sentence from the input.voice row's route_hint. /audio/transcribe returns the route that ran (provider, model) and duration_ms; a language hint skips the engine's language detection (faster-whisper large-v3 on an Apple-Silicon CPU: ~25 s → ~9 s for a 4 s clip).

Voice library

The voices the gateway can speak with, through AbstractRuntime's voice library facade (in the gateway's process, or on the AbstractCore server it is configured with):

Route What it does
GET /voice/languages?kind=&provider= {"languages": {kind: {provider: {provider, languages, open, declared}}}} for tts, stt and cloning; read without loading a model (open: a remote engine that decides its own languages)
GET /voice/clones?provider=&model=&language= {"voices": [...], "count": n}: cloned voices, designed (tags.designed) and built-in (tags.builtin) ones included; language keeps the voices that can speak it, native speakers first
GET /voice/clones/{voice_id} one voice's record (voice_id, name, engine, reference_text, meta); 404 for an unknown id
POST /voice/clones (multipart) a voice from a recording: file (up to 25 MB), optional name, reference_text, language (the recording's, ISO 639-1; identified from the transcript when omitted), provider (the cloning engine, e.g. qwen3-tts, omnivoice), model; answers the stored record with its voice_id
PATCH /voice/clones/{voice_id} {name?, reference_text?}: both checked before either is applied; built-in voices are read-only (422)
DELETE /voice/clones/{voice_id} deletes the voice and its reference audio; built-in voices are read-only (422)
POST /voice/design {description, name?, language?, text?}: a voice from a written description (Qwen3-TTS VoiceDesign, cloned with Qwen3-TTS Base), stored as a cloned voice; needs abstractvoice[qwen3-tts] and abstractvoice[stt] where the voice capability runs (501 otherwise)
POST /voice/clones/{voice_id}/deploy administrators: copy one of your voices into the library so every account lists and speaks with it (the default administrator's plane is the library: its voices are shared as created, already_shared)
GET /voice/compatibility the capability catalog: per kind, provider, model and surface, whether a feature (speed, one_shot, design…) is native, emulated, conditional or unsupported

Whose voices: with user accounts on (multi-user mode) and the voice engines running in the gateway, each account keeps the voices it clones or designs in its own store (<account data folder>/voices): it lists, speaks with, renames and deletes them, and no other account sees them. In front of that store sits the library, the machine's shared voice store: the built-in voices and every voice an administrator shares (POST /voice/clones/{voice_id}/deploy; the default administrator's account works on the library itself, so its voices are shared as created), listed and spoken by everyone, read-only to accounts (422). Each record says which in params.meta.scope (personal | library); built-in voices also carry tags.builtin. Without a personal store (single-user mode, or an AbstractCore server doing the voice work) every account shares one store, and creating, changing, designing and deleting a voice is an administrator's act (403 otherwise). A voice is used for speech with voice=<voice_id> (and the voice's provider). GET /voice/voices?language=fr filters the voice catalog the same way.

Speech options on /voice/tts: speed (a multiplier; engines without a native control time-stretch the audio, see /voice/compatibility) and one_shot: true (the whole text as one take with one voice, never segmented; refused beyond the engine's limit, e.g. 1000 characters on Qwen3-TTS). /voice/tts/stream refuses one_shot (422): a stream delivers the take in pieces.

A run carrying its conversation's identity (_runtime.identity, above) speaks with that identity's voice when the request names none of provider, model, voice, profile: /voice/tts then answers identity_ref and both routes send the X-Identity-Ref header (session:<sid>#<rev>). A request naming a voice field passes untouched, without a reference.

/voice/tts returns a durable audio artifact after synthesis. /voice/tts/stream returns JSON Lines stream events for progressive playback when discovery advertises capabilities.contracts.assistant.voice.tts.streaming=true; successful streams still finish with a Runtime-owned child-run audio artifact. The stream is real streaming: the engine splits the text at sentence boundaries (first segment one short clause), each segment is sent as soon as it is synthesised while the next one is synthesised, and the setup runs off the event loop. The terminal done event's metrics carry ttfb_s, rtf, device and, on the CPU, device_reason.

Stream lines (JSON Lines): runtime_start (run_id = the run named in the path, child_run_id = the id the outcome will be recorded under, schema: abstractruntime.tts_stream.start.v2), engine events (start, audio with sequence and audio_b64, segment_end; see Resuming a broken stream), then one terminal line: done (with audio_artifact and child_run_status), cancelled or error (error = the sentence; watchdog_timeout: true when the engine went silent past ABSTRACTGATEWAY_VOICE_TTS_TIMEOUT_S). When the engine is busy (another stream, or the model using the machine) and its setup takes more than a second, the first line is {"type": "queued", "message": "Waiting for the voice engine: …"}; speech follows when the engine is free. After 10 seconds without any other line, the stream writes {"type": "keepalive", "ok": true, "request_id": …}, so a client's idle timer measures the connection rather than the synthesis; keep-alives never reset the watchdog, which still counts engine silence only. Skip any line whose type you do not know. The request's audit log line (<data dir>/audit_log.jsonl) carries voice_stream: provider, model, voice, profile, text_chars, lines, audio_lines, audio_bytes, segments (segment_end lines sent), keepalives and ended (done, error, cancelled, watchdog or disconnected). The entity route POST /api/gateway/entities/{name}/voice/tts/stream streams the same lines. A request past the voice synthesis bound (ABSTRACTGATEWAY_VOICE_MAX_CONCURRENCY) waits one second, then gets 503 "Read aloud is busy: N voice syntheses are already running on this gateway …".

Resuming a broken stream

The engine speaks the text as a sequence of text segments, each one independent synthesis of exactly its slice of the text (AbstractVoice ADR 0009). With AbstractVoice as the voice engine:

  • every audio line carries segment (from 0) and that segment's text_start / text_end: offsets [start, end) into the request text exactly as you sent it, counted in Unicode code points (Swift text.unicodeScalars, JavaScript Array.from(text), Python str indexes). All the lines of one segment (audio is sent in slices of at most 2 s) share them;
  • after a segment's last audio comes {"type": "segment_end", "schema": "abstractvoice.tts_stream.segment_end.v1", "segment": k, "text_start": s, "text_end": e};
  • done carries segments, the number of segments ended.
{"type":"audio","sequence":0,"segment":0,"text_start":0,"text_end":61,"audio_b64":"UklGR…","sample_rate":24000}
{"type":"audio","sequence":1,"segment":0,"text_start":0,"text_end":61,"audio_b64":"UklGR…","sample_rate":24000}
{"type":"segment_end","segment":0,"text_start":0,"text_end":61}
{"type":"audio","sequence":2,"segment":1,"text_start":62,"text_end":140,"audio_b64":"UklGR…","sample_rate":24000}

When a stream breaks (the connection drops, or an error line ends it):

  1. Play audio as it arrives (never hold it until its segment_end) and keep all you received.
  2. Request the text again from text_end of the last segment_end you received (from the start when you received none). Offsets in the new stream index the new request's text: add the resume offset to map them back to yours.
  3. When the break fell inside a segment (audio arrived after the last segment_end), skip the first seconds of the new stream's audio, as many as you already received of that unfinished segment.

At a segment boundary the seam is exact: each segment is a whole synthesis of exactly its text, so no word is repeated or missed, whatever the engine samples on the second try. Inside a segment the seam is approximate: a sampling engine (Qwen3-TTS, cloned voices above all) speaks the same text with different timing, so the seam can land a few words early or late. Nothing is ever replayed whole. The seconds skip matters because a segment can be long: a segment is a base engine's sentence group, or one Qwen3-TTS clone generation, and on Apple silicon a clone reply of up to 800 characters is one generation (one voice per reply), so a 600-character piece is often a single segment. Send plain text: the voice engine removes # to ##### headers at the start of a line and **bold** / *italic* markers, and such a marker spanning two segments would leave its closing marker in the remaining text. Lines without segment (an engine that does not report segments) mean the whole request is one segment: retry it from the start and skip the seconds received.

Reading aloud never changes the run's state: no wait is created while audio streams, and the child run is recorded already completed (done, or with errors[0].code cancelled/stream_error) when the stream ends. A stream cut by a gateway restart leaves no run behind; a wait left by a gateway up to 0.13.0 is closed at startup with errors[0] = {"code": "interrupted", "message": "Read aloud was interrupted because the gateway restarted; …"}.

The catalog endpoints proxy AbstractCore Server routes when ABSTRACTCORE_SERVER_BASE_URL is configured. Gateway uses explicit Core auth settings for that hop and never reuses the Gateway bearer token as a Core/provider secret. Without a configured Core server, the voice/model routes return bounded static descriptors from Gateway and capability-package environment variables.

Each route adds:

  • catalog: Gateway-owned route metadata (contract, version, kind, scope, route_source, optional upstream_source, and route filters)
  • items: one canonical primary array for thin clients

Examples:

  • Voice provider listings (/voice/voices?providers_only=true, /audio/speech/models?providers_only=true, /audio/transcriptions/models?providers_only=true) always list the cloud providers openai and openai-compatible; their items carry needs_key, key_source (environment | providers | null), state and reason, and cloud_providers repeats them. A key counts when it is in the environment or saved through the Providers screen. Local engines are listed when AbstractVoice reports their runtime installed; unavailable_providers (per kind: {provider, code: runtime_missing|model_not_downloaded|not_configured, reason}) and unavailable_reason say why others are missing, and a listing filtered to a cloud provider without a key says where the key goes.
  • /voice/voices: items contain voice/profile records with id, label, optional provider, optional model, and voice_kind
  • /audio/*/models: items contain model records with id, label, optional provider, optional tasks, and optional parameters
  • /audio/music/providers and /discovery/providers: items contain provider records with id, label, and provider

Generated images are available through Runtime workflows when a compatible image backend is installed and configured. Gateway also exposes a direct image generation endpoint that uses the Runtime/Core output-selector contract rather than a provider-specific image client. The route creates a durable child run, stores the generated image as a run artifact, and returns event_name="abstract.progress" so thin clients can stream the child-run ledger for progress:

  • run_id, request_id, prompt
  • optional provider, model, size, width, height, format, batch count / n, seeds, and ordered lora_adapters
  • image_artifact: first generated image for compatibility
  • image_artifacts: full ordered image artifact list for batch generation

size, width, and height are optional passthrough request overrides. Do not inject a client-side default size. Different image providers/models accept different size sets; when the client leaves dimensions unset, Runtime/Core lets the configured backend use its default or auto behavior.

If the active workflow runtime already has an AbstractCore LLM client, the route uses it. For tools-only workflows, the route can create a direct Runtime/Core client from request provider/model or the execution-host capability route default. Unsupported or unconfigured deployments return a structured ok=false response instead of a failed run.

Gateway also exposes a direct image-edit sibling route:

  • POST /api/gateway/runs/{run_id}/images/edit

The request uses a source image_artifact, optional mask_artifact, the same provider/model and image backend selectors as image generation, plus optional batch count / n, seeds, and ordered lora_adapters, and returns an artifact-backed edited image. Batch responses also return image_artifacts. Thin clients should feature-detect it from capabilities.contracts.flow_editor.media.edited_image or capabilities.contracts.assistant.media.edited_image. It uses the same child-run abstract.progress progress contract as direct image generation.

Gateway also exposes a direct image-upscale sibling route:

  • POST /api/gateway/runs/{run_id}/images/upscale

The request uses a run-visible source image_artifact, optional provider/model selectors, and optional upscaler controls such as scale, resolution, softness, seed, quantize, and vae_tiling; resolution may be a shortest-edge integer or a scale factor such as 2x. Thin clients should feature-detect it from capabilities.contracts.flow_editor.media.upscaled_image or capabilities.contracts.assistant.media.upscaled_image, list models with GET /api/gateway/vision/provider_models?task=image_upscale, and stream the returned child-run ledger for abstract.progress events.

Generated music follows the same direct child-run pattern. Thin clients should discover it from capabilities.contracts.flow_editor.media.generated_music or capabilities.contracts.assistant.media.generated_music, list providers/models from the music catalog routes, and treat the returned child_run_id plus music_artifact as the durable output handle.

Generated video also follows the direct child-run pattern:

  • POST /api/gateway/runs/{run_id}/videos/generate uses the Runtime/Core output.modality=video / task=text_to_video contract and accepts optional batch count / n, seeds, ordered lora_adapters, and flow_shift.
  • POST /api/gateway/runs/{run_id}/videos/from_image accepts a run-visible source image_artifact, accepts the same optional batch/adapter/video control fields, and uses task=image_to_video.
  • Thin clients should discover these routes from capabilities.contracts.flow_editor.media.generated_video and capabilities.contracts.flow_editor.media.image_to_video (or the matching assistant.media.* entries), use GET /api/gateway/vision/provider_models?task=text_to_video|image_to_video for model catalogs, use GET /api/gateway/vision/adapters for compatible installed adapter catalogs, stream the returned child_run_id ledger for abstract.progress events, and read video_artifacts when batch generation is requested.

STT and listen contract notes:

  • POST /api/gateway/runs/{run_id}/audio/transcribe accepts a run-visible audio_artifact plus optional language, prompt, response_format, temperature, format, provider, and model hints.
  • capabilities.contracts.flow_editor.voice.stt and capabilities.contracts.assistant.voice.stt point to that upload route.
  • capabilities.contracts.flow_editor.voice.listen and capabilities.contracts.assistant.voice.listen are host-capture contracts, not a live microphone socket. They tell higher apps to capture locally and emit an event or upload the resulting audio artifact.

Decisions

A decision is text in, calibrated typed answers out: a decision model (AbstractCore's decision output modality; models, question kinds and measured quality in AbstractCore's docs/decision-models.md) reads a state and answers every named question in one pass. It generates no text and produces no artifact.

POST /api/gateway/runs/{run_id}/decisions runs one durable child run (run_facade.decide) under the run named in the path:

Field Meaning
state (required) the text the questions are about: a message, a document, a transcript
questions (required) named questions {name: {type, instructions, criteria}} with type choice, noul (yes/no) or score; shorthand: a yes/no sentence is a noul question, a list of option names a choice
model provider/model (mlx/jaredpalmer/kev-4b, huggingface/ggml-org/Kev-4B-GGUF:Q4_K_M, typesafe/jev-latest) or a bare model id; without it the output.decision capability default answers
truncate read only what fits the model's context instead of refusing an over-long state
request_id optional idempotency key

The answer carries run_id, request_id, child_run_id, decision (the System One body: model, answers, usage, latency_ms, and truncated when the state was cut) and answers, the same answers by question name: choice → {type, choice, confidence, probabilities}, noul → {type, noul} (the probability that the statement is true), score → {type, score, confidence, legend, probabilities}; plus the provider and model that answered. A refused decision answers ok: false with a code, like the media routes: decision_unavailable (the runtime exposes no decision facade), decision_error (the error sentence from the route or the model) or decision_no_answers. An empty state or no question answers 400.

Thin clients discover the route from capabilities.contracts.flow_editor.decision or capabilities.contracts.assistant.decision (direct_endpoint.available; the same descriptor names the VisualFlow decide node under workflow). The model is the output.decision capability default (configuration.md); decision models are the catalog rows tagged decision (Models and engines). Flows use the decide node (inputs state, questions, model, truncate; outputs answers, decision, model, content). The same models answer at the OpenAI door as POST /v1/decisions with the body {model, state, questions, truncate?} (openai-api.md).

KG memory

POST /api/gateway/kg/query queries the configured AbstractMemory TripleStore (opened through the AbstractRuntime memory facade). For the graph (history, sources, reconstruction) see Memory graph. Gateway resolves the store through:

  • ABSTRACTGATEWAY_MEMORY_STORE_BACKEND=lancedb|memory (sqlite when the installed AbstractMemory build exposes SQLiteTripleStore)
  • ABSTRACTGATEWAY_MEMORY_STORE_PATH
  • ABSTRACTGATEWAY_MEMORY_REQUIRE_VECTOR

Structured queries work with LanceDB and in-memory stores. SQLite also works when the installed AbstractMemory build exposes SQLiteTripleStore. Semantic query_text requires a vector-capable backend plus the execution-host embedding.text route; SQLite returns a clear 400 instead of pretending to support semantic recall.

Capability discovery reports KG memory as available when AbstractMemory is installed and the configured backend can be resolved. A fresh persistent store does not need to exist yet; empty-store structured queries return an empty result rather than making Flow authoring nodes unavailable.

Memory graph

/api/gateway/memory/* serves the plane's memory graph (AbstractMemory ADR 0003: revisions, history, ledger provenance) through AbstractRuntime's memory facade (abstractruntime.integrations.abstractmemory.memory_facade); the gateway never imports AbstractMemory (ADR 0001). Requires AbstractRuntime 0.20.0 and AbstractMemory 0.5.2.

Plane and home. Every route reads the caller's plane (its service's data folder). The graph lives in the plane's memory HOME, one SQLite file:

  • with ABSTRACTGATEWAY_MEMORY_STORE_BACKEND=sqlite the home IS the KG file /kg/query reads (<plane>/abstractmemory/kg.sqlite3). The bundle host hands that same store, its journal (same file), the plane's runtime id and artifact store to the runtime's memory effects, so a workflow's MEMORY_REVISE writes what /memory/* serves, a close is journaled (ranked recall folds it), and every ref it stamps carries the plane's runtime_id;
  • with the default lancedb (or memory) the home is <plane>/abstractmemory/memory.sqlite3, beside the LanceDB KG. Nothing in the gateway writes it yet: MEMORY_REVISE receives the LanceDB store and fails, naming AbstractMemory backlog 0057. Until the plane store default moves to the SQLite home (memory transition decision 2), /kg/query (LanceDB) and /memory/* (the home) serve two different stores; only a host writing the home through the runtime facade (MemoryFacade.open_mind) fills it.

A read never creates the home (an absent home answers empty, or 404 to a non-admin naming a memory id). The plane's service opens the home once, on the first /memory/* request that finds it, keeps it for its lifetime and closes it at shutdown, so a read never waits for another writer's lock to open the file (the first open after upgrading to AbstractMemory 0.4.0 runs its one-time vector upgrade inside that first request). Entity minds (entities/<slug>/memory.sqlite3) are not served here.

Owner rule (operator decision 5; memory_access.caller_owner_ids, the ONE rule /kg/query and every /memory/* route apply). A person owns their memory graph, an entity owns its own, and nobody reads another person's graph. The plane is a storage location, not a sharing scope.

  • An admin reads every owner. So does every caller of a gateway without user accounts (one operator, one world).
  • Any other principal reads exactly its own owners:
  • its runs: a run_id it names counts only when the run's _meta.origin.actor (stamped by the host on /runs/start, never taken from the client; read on the run or its nearest ancestor) is "<tenant>:<user>" of the principal. A run started by someone else, or with no recorded starter (a legacy run), is 403; a missing run is 404. The run gives its run and session owners;
  • its sessions: a session_id it names counts only when one of the session's runs (newest 200 in the run index) is its own by the same test;
  • the entities it created (entity -> creator delegation): the owner id (manifest.entity_id) of every entity home in its plane whose manifest created_by is the principal. An entity with no recorded creator is the admin's only;
  • its plane's global owner (global_memory, or $ABSTRACTRUNTIME_GLOBAL_MEMORY_RUN_ID). Planes are per account: the users registry refuses a second account on a runtime id and the default runtime is the operator's, so an account's global_memory is its own global memory (a ref stamped under the global owner is the account's own). The rule still checks that the plane serving the request is the principal's (its tenant and runtime id).
  • Anything else is 403 {"detail": {"reason": "owner_forbidden", "message"}}; the message never names the owner it protects. An explicit owner_id that is not the caller's, and all_owners, are admin-only: refused, never silently narrowed. scope=all expands to the caller's own owners only.
  • A memory id of another owner is 403, an unknown one 404. Every route takes the optional run_id / session_id (query parameters; in the body of sources/reconstruct) to name the caller's run or session.
  • sources?transitive=true walks the derivation lineage only through memories the caller may read; a parent of another owner is not followed and is counted in withheld.
  • history cuts the memory ids an event names (derived_from, replacement_ids) to the readable ones and counts the hidden ones in withheld.
  • sources/reconstruct: a non-admin reconstructs a ref only when a memory of one of its owners names it directly (AbstractMemory's MemoryGraph.names_ref, one index probe; 403 otherwise, also for a ref nobody names); an admin reconstructs any ref of its plane. AbstractMemory refuses a derivation across owners, so a ref is never reachable through another owner's memory.

Sharing a graph with another person, or topic-scoped access (a notebook shared with a team), is future work: today the only delegation is entity -> creator.

Limitation (today's owner ids). An owner_id is not a principal: it is session_memory_<sid>, global_memory, a run id, or an entity id, strings derived from runs and sessions. The rule above maps a principal to the ids derived from ITS OWN runs and sessions (and its entities); a memory written under a session id that none of the principal's runs carries is not the principal's, whoever wrote it. global_memory is shared by everything that runs on the plane, by construction; it is one account's only because planes are per account. Making owner_id the principal and the scope its kind is pending an operator decision; the derivation lives in one function (memory_access.caller_owner_ids) so it changes in one place.

Bounds. Every list takes limit (default 200, at most 500) and answers truncated: true when it cut; what the owner rule hides is counted in withheld (derived, sources, history).

Method and path Body / query Returns
POST /memory/query the /kg/query body (scope, run_id, session_id, owner_id, subject, predicate, object, since, until, active_at, all_owners, order), limit 1..500; query_text is refused (400: the home is structured-only) {ok, scope, owner_id, count, items: [assertion], truncated, warnings, home: {path, backend: "sqlite", exists}}
GET /memory/{memory_id}/history limit, run_id, session_id {ok, memory_id, owner_id, count, items: [{event: asserted\|closed\|narrowed, at, revision_id, cause, detail}], truncated, withheld} in record order
GET /memory/{memory_id}/sources transitive (default true: also the sources of the readable memories it was derived from), limit, run_id, session_id {ok, memory_id, transitive, count, items: [SourceRef + key], truncated, withheld}
POST /memory/sources/reconstruct {"ref": SourceRef, "run_id"?, "session_id"?, "limit"? (1..1000, default 200: ledger records of arunsource)} the facade's answer, HTTP 200 for each: {status: "ok", ref, kind, content, metadata}, {status: "partial", ref, kind, content, metadata, unresolved: [path]} (a step row with a $slim marker or an offloaded leaf whose artifact is gone: never ok with a hole), {status: "source_gone", ref, reason}, {status: "unsupported", ref, reason}; 422 invalid_source_ref for a malformed ref; 403 owner_forbidden (see the owner rule)
GET /memory/derived ref_key (required), limit, run_id, session_id {ok, ref, ref_key, count, items: [memory id], truncated, withheld}: the memories naming that source, then those derived from them

A SourceRef is a dict: {"kind": "run", "run_id"}, {"kind": "step", "run_id", "seq"(int), "step_id"?}, {"kind": "artifact", "artifact_id", "run_id"?}, {"kind": "message", "message_id"}, {"kind": "event", "event_id", "stream"?}, {"kind": "diary_entry", "entry_id", "run_id"?}, each with an optional runtime_id. Its key is run:<run_id>, step:<run_id>#<seq>, artifact:<id>, message:<id>, event:<id> or diary_entry:<id>; derived takes the key (URL-encode # as %23), not the JSON form, and answers 422 invalid_ref_key for one it cannot read. Reconstruction reads this plane's ledger, run and artifact stores: a step gives the ledger row (content) with metadata.{run_id, seq, step_id, node_id, status, effect_type} (a step ref addresses the step's STARTED row, which holds the effect payload; any other row at that seq is source_gone: the ledger was rewritten), an artifact its content (utf-8 text, else base64, metadata.encoding), a run its state and at most limit ledger records, oldest first (metadata.ledger_records, ledger_returned, ledger_left_out, truncated); message refs are unsupported (no indexed path yet), and so are event and diary_entry here (no event inbox or diary store is given to the plane facade). The facade reads the plane's runtime id (runtime_id of the plane's service): a ref naming another runtime (an entity home's) is unsupported, never resolved against this plane's ledger.

Models and engines

The gateway serves AbstractCore's models and engines payloads unchanged, under /api/gateway. The bodies and payloads are the same as AbstractCore's own /acore/* routes; abstractcore and abstractgateway render them with the same screens.

Method and path Access Body / query Returns
GET /host/profile user refresh=1 host_profile_v1
GET /engines user probe=1 gateway_engines_v2 rows (AbstractCore's detection plus the install plan and actions) with install_allowed and install_policy; see engines.md
GET /engines/{id} user probe=1 one engine row plus install_allowed; 404 for an unknown id
POST /engines/{id}/install admin {"dry_run": bool, "force": bool, "location": "auto"\|"user"\|"system"} an engine_install_job_v1 job (user-level first; pauses in needs_admin / needs_tools), see engines.md
GET /engines/jobs, GET /engines/jobs/{id} user engine install jobs
POST /engines/jobs/{id}/continue, /cancel admin {"action"?} the job
POST /engines/{id}/start, /stop admin Ollama / LM Studio server state
GET /models/catalog user q, engine, fits=1, hub=1, tag (repeatable), hub_page, hub_page_size, detail_repo, extended=1 model_catalog_v1
GET /models/installed user provider models_installed_v1
POST /models/download admin {"provider", "artifact", "dry_run", "expected_bytes"?} or {"recommended": true} {"ok": true, "job": {...}}; with recommended, {"ok": true, "recommended": true, "jobs": [...], "group": {...}}
GET /models/download/{job} user {"ok": true, "job": {...}} (a grp_... id returns the parent job)
GET /models/downloads user {"ok": true, "jobs": [...]}, newest first, parents included
POST /models/download/{job}/cancel admin none {"ok": true, "job": {...}}; stops the transfer within about a second; a grp_... id cancels every running child; 404 when unknown
GET /models/downloads/stream user job_id, until_idle=1 Server-Sent Events of the same dicts, see model-downloads.md
POST /models/delete admin {"provider", "artifact", "dry_run": bool, "force": bool} host_job_v1 (kind delete)
POST /models/delete-download admin {"provider", "artifact", "dry_run": bool} (the catalog's own names) model_download_delete_v1, see "Delete a download" below
GET /jobs user kind, status {"schema": "host_jobs_v1", "jobs": [...], "generated_at"}, newest first
GET /jobs/{id} user host_job_v1; 404 when unknown
POST /jobs/{id}/cancel admin none (an empty {} is accepted) host_job_v1; 404 when unknown

Empty query values (q=, engine=) mean "no filter". probe, fits and hub accept 1/0 and true/false. Decision models (AbstractCore's decision output modality: Kev, Lev, Laya) are the catalog rows tagged decision (tag=decision); their capability route is output.decision, and the console's Models page filters them with its Decision chip. See Decisions.

Hub discovery. hub=true with q requests bounded summary pages, without per-result metadata lookups. detail_repo=org/repo requires hub=true and reads only that selected repo; add extended=true to enumerate its verified quant variants. Search sizes can be unknown or estimates. hub.rate_limited, retry_at (Unix seconds) and retry_after_seconds report a shared Core cooldown; queries and details during it do not retry upstream. Start page 1 before later pages. Authentication still runs on every Gateway request.

Catalog artifacts. model_catalog_v1 is AbstractCore's payload, served unchanged (field reference: AbstractCore docs/models.md, "The catalog"). Besides quant (the artifact's own label, lowercased, or null) and bits (effective bits per weight), every artifact carries quant_class, one of 2bit, 3bit, 4bit, 5bit, 6bit, 8bit, 16bit, full, unknown, for filtering by quantization: q4_k_m, 4bit, mxfp4 and oq4e are 4bit; q8_0 and 8bit are 8bit; bf16 and f16 are 16bit; f32 is full. quant_class_source is stated (the reference names its quant), assumed (a bare Ollama tag such as qwen3.5:9b or LM Studio id: the class of the engine's default build, which the fit estimate assumes too) or null (no quant information; the class is unknown). options holds the route options a recommendation copies with the artifact ({} for most); companions lists repos downloaded with it (an MLX build's MTP drafter, from AbstractCore's drafter registry; [] for most), companion_bytes is their size, and download_bytes already includes it; note is one sentence about the build. On Apple silicon the text rows pre-select the memory tier's MLX build and exactly one text row is the starter.

Jobs. A host_job_v1 has schema, job_id, kind (download | delete | engine_install), status (queued | running | completed | failed | cancelled), provider, artifact, engine, percent, downloaded_bytes, total_bytes, message, log_tail, command (the exact argv), dry_run, started_at, finished_at, error (a string or null), joined, result and cli_equivalent, which names the abstractgateway command that does the same thing. A dry run finishes before the POST returns. On the /models/download routes the job also carries job (the id), events, host_status, reports queued as running, and counts joined including the first request.

Download progress. A download job also carries state (queued | resolving | downloading | verifying | installing | done | failed | cancelled | stalled), bytes_done, bytes_total, size_unknown, size_note, bytes_per_second, eta_s, updated_at, files ([{name, bytes_done, bytes_total, state}]), current_file, a one-sentence message, the tool's own detail, and transitions. "Use recommended defaults" ({"recommended": true}) returns one parent job (kind: "download_group", id grp_...) whose bytes, percent, speed and time left add up its children. The full contract, one real example per state and what each source reports: model-downloads.md.

Refusals share one body: {"ok": false, "status", "reason"?, "message", "detail", "error": {"message", "type"}, ...}.

Status When
400 invalid provider or artifact missing
403 refused / not_allowed a real engine install while allow_engine_install is off (configuration.md); install_policy says why
403 the caller is not an admin (every POST above)
404 not_found unknown job id, engine id, or a model that is not installed
409 busy an engine install is already running (job is the running one)
409 refused the engine is not supported here or has no install command (install is the plan), or a delete is blocked (delete_blockers: loaded, shared_cache:…, unknown_location, engine_not_running, remote_engine; force: true overrides the first two)
501 unsupported / abstractcore_too_old the installed AbstractCore is too old for these routes; required, installed and missing name what to upgrade
503 unavailable AbstractCore is not installed

Delete a download (POST /models/delete-download, the console's Models-page Delete). Synchronous; removes one downloaded artifact with its engine's own mechanism: Ollama's DELETE /api/delete (what ollama rm does), the Hugging Face / MLX cache folder of the repo, or, for org/repo:QUANT (a llama.cpp GGUF quant), only that quant's files (the repo goes when it was the last model file set). dry_run: true deletes nothing and answers the exact bytes for the confirmation. Answers:

Status Body
200 {"schema": "model_download_delete_v1", "ok": true, "status": "planned" \| "deleted", "provider", "artifact", "freed_bytes", "paths", "command", "also_used_by", "presence": "installed" \| "absent", "message"}
409 refused reason: resident (this gateway or the engine has it loaded: "Unload it first"), locked ("Unlock and unload it first"), downloading (its download is still running), managed_elsewhere (LM Studio: its CLI has no remove command, delete it in LM Studio), engine_not_running, unknown_location, remote_engine; message and fix are sentences to show as they are
404 not_found reason: "not_downloaded"
502 failed reason: "engine_failed": the engine did not delete; command names what ran

A build whose files AbstractCore files under the sibling engine of the shared Hugging Face cache (MLX vs Hugging Face) is deleted all the same, and also_used_by names that engine. Every real delete writes model.download_deleted (provider, artifact, actor, freed_bytes, paths) to <data_dir>/audit_log.jsonl; every refusal (a dry run's too) writes model.download_delete_refused with its reason and dry_run.

Example:

curl -s -H "Authorization: Bearer $TOKEN" "$GW/api/gateway/models/catalog?q=qwen3&fits=1" | jq '.rows[0].artifacts[0].fit'
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"dry_run": true}' "$GW/api/gateway/engines/ollama/install" | jq '.command, .cli_equivalent'

Host state and model residency

Gateway exposes a host-level view of the execution machine — memory, GPU, resident models, and session prompt caches — so consoles and agents can render an "agentic OS" panel from one API surface.

Read endpoints (any authenticated principal):

  • GET /api/gateway/host/state — one-call host snapshot
  • GET /api/gateway/host/metrics/memory — host memory snapshot
  • GET /api/gateway/host/metrics/gpu — GPU utilization probe
  • GET /api/gateway/models/loaded — model residency listing
  • GET /api/gateway/models/context_estimate — context/KV memory estimate for a provider+model
  • GET /api/gateway/sessions/prompt_cache — session prompt-cache enumeration

Mutation endpoints (admin principal required):

  • POST /api/gateway/models/load — load (and by default pin) a model runtime
  • POST /api/gateway/models/unload — unload a model runtime
  • POST /api/gateway/models/lock — lock a resident model against unload
  • POST /api/gateway/models/unlock — release a model-residency lock
  • POST /api/gateway/models/download — fetch model weights onto the host
  • POST /api/gateway/sessions/{session_id}/prompt_cache/clear_all — clear every runtime-minted prompt cache for a session

Reads are visibility every authenticated client needs; mutations spend shared host resources and stay operator acts. Anonymous requests are rejected on all of these routes, like every other /api/gateway/* path.

GET /host/state

One snapshot with memory, gpu, models, and session_caches sections:

{
  "ok": true,
  "ts": 1787857000.0,
  "memory": {"ram": {"...": "..."}, "process": {"rss_bytes": 140443648}, "device": {"backend": "metal", "allocated_bytes": 0, "...": "..."}},
  "gpu": {"supported": true, "source": "ioreg", "gpus": [{"name": "...", "utilization_gpu_pct": 0.0}]},
  "models": [{"runtime_id": "...", "provider": "...", "model": "...", "resident": true, "...": "..."}],
  "session_caches": [],
  "totals": {"models": 2, "models_resident": 1, "model_bytes": 3109915433, "session_caches": 0, "session_cache_bytes": null},
  "degraded": [],
  "row_schema": "model_residency_row_v1"
}
  • models rows use the frozen model_residency_row_v1 schema described below; session_caches relays the runtime facade's cache rows verbatim.
  • Every section is independently best-effort and the route never returns a
  • A missing facade method or a failed probe nulls that section and names it in degraded; a reasons map (present only when non-empty) says why.
  • The gpu section keeps its in-band {"supported": false, "reason": "..."} payload when the probe answers but reports no support; it still counts as degraded.
  • totals.model_bytes sums the known size_bytes values and is null when no row reports a size; totals.session_cache_bytes behaves the same over the cache rows' bytes.
  • memory.device relays AbstractCore's accelerator figures, including process_held_bytes (what this gateway process holds across its model libraries: MLX, llama.cpp, transformers, embeddings) and process_held_basis, how that figure was measured (metal_device_counter, cuda_device_counter…, or sum: of the libraries' own counts). memory.resident / memory.held name the models that hold it (backend, model, number of holders) when the runtime reports them.
  • residency_diagnostics is always present ({} when the runtime reports nothing): the dict GET /models/loaded returns as diagnostics, with pending_ejects (models that will be ejected when their in-flight call ends) and last_switch_ejects (what the last default-model switch ejected, kept or failed to eject, with the reason). The consoles and the tray show these as "Will eject X when the in-flight call ends", "X: eject failed: reason".
  • totals.models counts every known row — configured / cached rows included — while totals.models_resident (additive) counts only rows with resident: true. Clients that display "N loaded" must read models_resident: default ≠ loaded, and presenting configured capability defaults as loaded is exactly the lie this field removes.
  • When the runtime memory snapshot reports a host identity, the response also carries a top-level host object (the identity facts of the machine the snapshot describes). The block is omitted when the runtime does not report one. Together with the per-row host_id/host_name fields below, this is the seam a multi-machine resource pool would aggregate on; one gateway binds one runtime host, and the pool design is proposed in backlog 0093.

GET /host/metrics/memory

Returns {"ok": true, "supported": true, ...} plus the snapshot sections: ram (total/available/used bytes and percent), process (rss_bytes), and device (backend, allocated_bytes, total_bytes, free_bytes). When the runtime host facade does not expose a memory snapshot, the route answers 200 with {"ok": true, "supported": false, "reason": "..."} — the same degraded style as GET /host/metrics/gpu.

How to compare memory measurements: process.rss_bytes and device.allocated_bytes are different axes. In-process device backends (for example MLX on Metal) return freed buffers to the process heap and the operating system may retain those pages, so process RSS does not shrink when a model unloads. Use device.allocated_bytes to verify that an unload freed device memory; use ram and process for overall host pressure.

Model residency (/models/loaded, /models/load, /models/unload)

GET /models/loaded lists the model runtimes the host knows about, with optional task, provider, model, and base_url query filters. The response keeps the raw runtime records in models and adds a normalized rows array in the frozen model_residency_row_v1 schema (named by row_schema), so thin clients do not need per-provider alias tables.

Each model_residency_row_v1 row has exactly these fields (unknown values are null, never guessed):

runtime_id, task, provider, model, source, resident, state, pinned, default, size_bytes, size_vram_bytes, expires_at, context_length, loaded_at, last_used_at, locked, lockable, modalities, calibrated_context_length, context_calibrated, host_id, host_name, details

The schema is additive-tolerant and keeps the model_residency_row_v1 name as optional fields are added; treat fields beyond the original 16 as optional. The lock/calibration/host fields mean:

  • locked / lockable — tri-state booleans: whether the model is locked against unload, and whether this runtime supports locking it at all.
  • modalities — list of modality strings when the runtime reports one (null otherwise, including when the value is not a clean string list).
  • calibrated_context_length / context_calibrated — the measured usable context length and whether it came from calibration rather than metadata.
  • host_id / host_name — identity of the machine serving the model, stamped by the runtime that reported the row (see the host block note under GET /host/state above).

Residency truth is provider-first: provider_resident / provider_loaded booleans in the source record outrank the runtime-lease booleans resident / loaded, because a runtime can hold a lease on a model the provider has already evicted. A loaded-looking state string (provider_loaded, loaded, resident) can confirm residency, but a state string is never proof of absence — with no boolean present and no loaded-like state, resident stays null. details preserves the raw record for fields outside the schema.

POST /models/load accepts task (default text_generation), provider, model, optional provider options, pin (default true), base_url, timeout_s, and lock (default false) — with lock: true a successful load is immediately locked against unload, and the lock outcome is reported additively under lock in the response (a lock failure or a runtime without lock support never turns the successful load into a failure). POST /models/unload selects the runtime by runtime_id or by task/provider/model. Both relay Runtime's host facade and return the normalized residency response (operation, affected records, and in-band ok=false errors instead of opaque failures). A load response carries loaded_new (true when the call loaded the model, false when it was already in memory) and the matching action (loaded / already_loaded).

A local image or video model loaded with task: "image_generation" (or "video_generation") serves the following requests for that model on the loaded pipeline, in the gateway process; a model that was not loaded runs each request in an isolated worker process that loads it for that request.

One unload failure gets a real status code: when the target model is locked, POST /models/unload answers HTTP 409 with the normalized refusal payload as the body (ok: false, error: "model_locked", plus whatever detail the runtime included), so clients can offer force-unload or point at /models/unlock. Sending "force": true in the unload request unloads the model despite the lock. Every other unload outcome stays in-band at 200.

Model locks and context estimates

  • POST /models/lock and POST /models/unlock (admin) pin a resident model against unload and release that pin. The body selects the target like unload does: runtime_id, or provider + model, with optional base_url and timeout_s. Lock requires provider-verified residency: a configured or merely-warm model refuses with an error: "model_not_resident" payload (load it with lock: true instead); unlock always works, even for a since-evicted model, so locks are never stranded. Rows report lockable so clients know whether a lock can work, and locked so they can render the current state. A confirmed lock is recorded in the gateway's settings (models.kept_loaded) and set again after a gateway or model-host restart; an unlock, or an unload with force, removes the record.
  • Idle unload: rows also carry idle_unload_s (the time in effect in seconds, 0 when it is off, null when the runtime reports nothing, as for an external engine), idle_unload_at and last_used_at (ISO 8601 times in UTC with their offset, 2026-11-03T20:09:51+00:00: the runtime sends epoch seconds, which the gateway converts; an ISO string the runtime sends is passed through as is), in_use and locked_by, as the runtime reports them (idle_unload_at is null when the model is locked, in use, or idle unload is off). The time is the setting models.idle_unload_minutes (GET/POST /api/gateway/admin/runtime-config, default 60, 0 never; serve --model-idle-unload MINUTES wins for one run).
  • GET /models/context_estimate?provider=&model=&context_length= (any authenticated principal) relays the Runtime host facade's context/KV memory estimate for a provider+model. provider and model are required; context_length is optional and must be >= 1 (schema-rejected with 422 otherwise). The estimate reports its confidence in-band — calibrated, estimated, or unknown — alongside facade fields such as predicted_max_context (the context that fits beside the weights), the tri-state fits_weights / fits_requested_context split, budget_bytes, est_kv_bytes, and notes (which state the budget basis and reserve). The estimate is advisory only — no load path gates on it.

Like the other host-facade relays, these routes never 500 on capability gaps: a runtime without the method answers 200 with ok: false, available: false, and code = "model_residency_unavailable" (lock/unlock) or code = "context_estimate_unavailable" (estimate); facade exceptions use the matching *_error codes.

Session prompt-cache enumeration

  • GET /api/gateway/sessions/prompt_cache?session_id=<optional>
  • POST /api/gateway/sessions/{session_id}/prompt_cache/clear_all (admin)

The list route enumerates the prompt caches the runtime actually minted. Each cache row carries the provider/model/runtime identity, byte and token counts, and stamped attribution metadata (session_id, run_id, workflow_id, node_id). Omit session_id to list every session's caches. This enumeration lane is the recommended way to observe and reclaim session cache state: unlike the identity-derived session lifecycle endpoints described under the prompt-cache control plane below, it cannot miss caches whose keys the gateway never derived.

clear_all unloads every runtime-minted cache for one session in a single call. It requires an admin principal because it accepts any session id and clears real provider cache state; the identity-derived, caller-scoped session lifecycle endpoints remain user-level.

When the runtime facade does not expose enumeration, both routes answer 200 with ok=false, available=false, and code="session_caches_unavailable" (facade errors use code="session_caches_error"); the list route always carries a caches array and clear_all always carries cleared and count.

Discovery descriptors

GET /discovery/capabilities advertises this surface under capabilities.contracts.common:

  • model_residency: endpoints (loaded, load, unload, lock, unlock, context_estimate), the per-task support map, row_schema = "model_residency_row_v1", and modality_ui — the canonical modality color map ({version: 1, colors: {...}}, one {color, label} entry per residency task plus an unknown fallback) so every client renders the same modality palette instead of hardcoding its own. It is a rendering contract, not a runtime capability, so it is served even when the runtime facade is absent.
  • host_state: endpoints (state, memory, gpu) plus memory_available. The state route itself always answers; per-section truth lives in the payload's degraded list.
  • session_caches: endpoints (list, clear_all) plus available, reflecting whether the runtime facade supports cache enumeration.

Evidence: src/abstractgateway/routes/gateway.py (host_state, host_memory_metrics, model_residency_loaded, model_residency_lock, model_context_estimate, session_prompt_caches_list) and src/abstractgateway/security/authorization.py (route-family policy).

About (GET /api/gateway/about)

Public (no sign-in): which versions this gateway runs, for About screens.

{"abstractframework": "0.5.0", "abstractgateway": "0.7.1",
 "packages": {"abstractcore": "2.18.0", "abstractruntime": "0.7.0", "abstractskill": "0.3.0"}}

abstractframework is the AbstractFramework release the installer recorded for this gateway (FRAMEWORK_VERSION in the data directory's bootstrap.env) when there is one, else the version of the abstractframework package installed beside the gateway, else null (not installed). The installer puts only abstractgateway[...] in the gateway's environment, so its record is the one that names the release. Versions only: no paths, host names or settings.

Host control (pause, desktop tray, restart, update)

The process's own controls — the surface behind the desktop tray icon and the console's Gateway card (see tray.md). Reads are available to any authenticated principal; writes require an admin principal.

  • GET /api/gateway/host/runner — execution state:
{"ok": true, "paused": true, "paused_at": "2026-09-05T06:38:26+00:00", "paused_by": "default/admin", "reason": "meeting",
 "inflight_ticks": 0, "scope": "workflow runner", "runner_in_process": true, "step_gate_supported": true,
 "runners": [{"status": "paused", "...": "..."}], "degraded": false,
 "capabilities": {"restart": true, "shutdown": true, "reason": null, "update_job_running": false}}
  • POST /api/gateway/host/pause (body {"reason": "..."} optional) and POST /api/gateway/host/resume — both answer the payload above. A paused gateway is a kill switch (see tray.md): no automation, no entity activity and no model work until Resume. A request that would start work answers 409 {"detail": "...", "code": "gateway_paused"} (header X-Gateway-Error-Code: gateway_paused), and a POST /v1/... answers 503 with the OpenAI error envelope and code: "gateway_paused"; nothing was started, and the same request works after Resume. A run start is still accepted and queued (warnings says so). Reads, settings, unloading a model, cancelling a run and stopping an entity stay open.
  • GET /api/gateway/host/metrics/live — {gpu, memory, runner} in one call (1 s caches); gpu/memory carry the same in-band supported shape as /host/metrics/gpu and /host/metrics/memory.
  • GET /api/gateway/host/runs?limit=25&window_hours=24&kind= — the runs on this host across every data plane (admin; /runs answers only for the calling principal's plane). {ok, items: [{run_id, workflow_id, label, status, activity, role, session_kind, kind, automation_id, created_at, updated_at, ledger_len, plane, started_epoch, updated_epoch, observer_path}], count, active_count, has_more, planes, skipped_entity_planes?, warnings?}. kind is the session's purpose as in GET /runs (conversation, docs, notes): AbstractNote's own work (notes) is left out unless kind=notes (only it) or kind=all, before limit applies. session_kind is the runtime's attribution (automation / occurrence = an automation's run, chat / discussion = a conversation); the tray lists the first two under Automations, never under Conversations. Items are TURN ROOTS (the runtime's is_turn_root: parent-less runs that are not automation controllers, plus automation occurrences), in this order: every active root first — activity: "running" (the root or any run below it is running), then "waiting" (waiting for a person or an event, updated inside the window) — then roots that finished inside window_hours of their last update (activity: "done"), newest first. Active rows are never windowed and never cut by limit (active_count counts them); limit bounds the finished rows and has_more says more finished ones exist. label decodes a catalog workflow's internal id (__catalog__v2__…<base64>) to the name an operator uses; observer_path is the run's Observer page (/apps/observer/#run/<id>, open it signed in through POST /api/gateway/apps/observer/open {path: "/#run/<id>"}). The gateway's own bookkeeping runs (__-prefixed, but never a catalog id) are excluded.
  • GET /api/gateway/host/tray — {dependencies_installed, install_hint, decision: {start, reason, hint}, supervisor: {running, ready, pid, exit_code, failure, log_path}, can_control}. There is no setting: the icon is shown whenever this process and this desktop can hold it.
  • POST /api/gateway/host/tray/show — retry the helper now (409 when this process cannot). No hide counterpart, by design.
  • POST /api/gateway/host/restart, POST /api/gateway/host/shutdown — {"ok": true, "restart": true, "requested_by": "...", "reason": "..."}; 409 with a plain reason when unsupported (--reload, embedded server, an update is installing).
  • GET /api/gateway/host/start-at-login, PUT /api/gateway/host/start-at-login {enabled, replace_other?} — admin. Would this gateway start at the next login, and can it be changed from here: {enabled, state: on|off|broken|other, mechanism, mechanism_label, can_change, reason, summary, problems, location, platform, experimental[, other_data_dir]}. The mechanism is a LaunchAgent (macOS), a systemd user unit or, without a systemd user manager, a desktop autostart entry (Linux), or a HKCU\…\Run value (Windows). can_change: false carries the reason (for example a Linux server with neither a systemd user manager nor a desktop session). PUT registers for the next login without starting a second gateway, or unregisters without stopping this one, and answers the read-back under start_at_login; 409 when it cannot change here or when another gateway's registration would be replaced without replace_other: true; 500 when the change does not read back. The same switch as the tray's Start at login and abstractgateway service enable|disable.
  • GET /api/gateway/host/update, POST /api/gateway/host/update/check, POST /api/gateway/host/update/start (admin) — all three answer {current, install: {kind, path, upgradable, reason, command, display_command, extras, data_dir, framework_version}, check: {source, latest, update_available, offline, checked_at, error, release}, job: {state, command, log_tail, exit_code, error, message, restart_recommended, version_before, version_after, installer, framework_before, framework_after, changes, other_changes}, restart_pending, update}. install.kind is installer for an AbstractFramework installer install (check.source: framework-release, check.release: {version, gateway_version, installed, commit, manifest_url, installer: {url, commit_url, sha256, size}}); other kinds compare with PyPI (source: pypi). update is the rendering every client shows: {status, line, hint, offer, action: {label, confirm, command, source, installer_sha256} | null, checked_at}, status one of not_checked, available, not_possible, up_to_date, offline, error, running, installed, no_change, failed. start takes {installer_sha256} (the action's; required for an installer install, optional otherwise) and answers 409 when the install cannot be upgraded in place, the sha256 is missing ("check again first") or differs from the last check's, or a job is already running. The job is killed after 30 minutes even when it prints nothing. A version the check cannot compare is an error, never up_to_date.

GET /api/health adds "paused": true while paused; status stays "healthy".

Prompt-cache control plane (operator API)

The gateway exposes prompt-cache operator endpoints under /api/gateway/prompt_cache/*. Provider prompt-cache controls affect process-local or remote provider state and require an admin principal in hosted user-auth mode.

Core endpoints:

  • GET /api/gateway/prompt_cache/capabilities?provider=...&model=...
  • GET /api/gateway/prompt_cache/stats?provider=...&model=...
  • POST /api/gateway/prompt_cache/set
  • POST /api/gateway/prompt_cache/update
  • POST /api/gateway/prompt_cache/fork
  • POST /api/gateway/prompt_cache/clear
  • POST /api/gateway/prompt_cache/prepare_modules

Behavior:

  • These routes use the runtime's AbstractCore prompt-cache client contract rather than directly depending on provider-instance access.
  • In local mode they delegate to the in-process provider.
  • In remote/hybrid mode they follow whatever /acore/prompt_cache/* surface the configured AbstractCore server exposes.
  • All core prompt-cache responses include operation and capabilities, with structured unsupported/error cases (code="prompt_cache_unsupported" / code="prompt_cache_error" / code="prompt_cache_unavailable").
  • These endpoints remain provider/model controls, not a Gateway-owned CachedSession persistence system.

Session lifecycle endpoints:

  • GET /api/gateway/sessions/{session_id}/prompt_cache/status
  • POST /api/gateway/sessions/{session_id}/prompt_cache/prepare
  • POST /api/gateway/sessions/{session_id}/prompt_cache/rebuild
  • POST /api/gateway/sessions/{session_id}/prompt_cache/clear

These routes derive a deterministic bounded namespace/key from session_id, bundle_id, bundle_version, flow_id, provider, model, optional template_id, and version. The private hash also includes the authenticated principal scope, so two hosted users using the same session id/provider/model do not collide in a shared provider control plane; the returned identity remains portable app-level data and does not expose that private scope. These routes expose three honest modes:

  • unsupported: provider/model does not expose prompt-cache support; responses include supported=false, ok=false, and capabilities.
  • keyed: gateway returns a stable runtime_hint/prompt_cache_key for Runtime/Core injection, but does not claim module preparation occurred.
  • local_control_plane: gateway uses supported provider operations such as prepare_modules, fork, set, clear, and stats.

status is read-only. prepare accepts optional modules (system_prompt, workflow_instructions, tools, pinned_attachments) and returns either provider operation results or a key hint. rebuild is clear-plus-prepare for providers that expose clear controls.

These identity-derived endpoints only see caches whose keys the gateway derived. To enumerate or bulk-clear the caches the runtime actually minted for a session, use the recommended session prompt-cache enumeration lane.

Durable bloc exact-reuse endpoints:

  • POST /api/gateway/blocs/upsert_text
  • GET /api/gateway/blocs/record
  • GET /api/gateway/blocs
  • POST /api/gateway/blocs/delete
  • GET /api/gateway/blocs/kv/manifest
  • GET /api/gateway/blocs/kv/list
  • POST /api/gateway/blocs/kv/ensure
  • POST /api/gateway/blocs/kv/load
  • POST /api/gateway/blocs/kv/delete
  • POST /api/gateway/blocs/kv/prune

These routes are the primary app-facing durable prompt-cache path:

  • create or identify a durable text bloc;
  • ensure or load a KV artifact for a target local provider/model;
  • use the returned prompt_cache_binding in later Runtime-backed generation;
  • list/delete/prune artifacts without reaching into provider-private cache state.

They delegate through Runtime's public AbstractCore host facade rather than proxying Core directly. They are operator-style host controls, so the routes themselves are not ledgered run execution; the ledgered exact-reuse path is the later LLM_CALL.params.prompt_cache_binding used inside real Runtime runs.

Host-local prompt-cache export/import admin aliases:

  • GET /api/gateway/prompt_cache/saved
  • POST /api/gateway/prompt_cache/save
  • POST /api/gateway/prompt_cache/load

These remain explicitly local/operator-oriented:

  • the route paths are compatibility aliases, but the implementation delegates to Runtime's public host facade:
  • saved -> list_prompt_cache_exports(...)
  • save -> prompt_cache_export(...)
  • load -> prompt_cache_import(...)
  • local bundle/file runtimes store these exports under the Gateway data dir at prompt_cache_exports/
  • remote and hybrid runtimes return code=prompt_cache_local_only
  • response payloads follow Runtime's host-local export/import contract, including operation, local_only, artifact_*, capabilities, and provider_response

Accounts and activity

The Accounts page (admin): users and entities in one list.

Route Purpose
GET /admin/accounts {accounts: [{id, tenant_id, kind: user \| entity, role: admin \| user \| entity, own, email_address, mailbox{state: connected \| receive_only \| not_connected \| paused \| unavailable, address, provider, reason}, runtime_id, active, entity_state, actions{email, logs, workspace, preferences, rotate, manage, configure, archive, unarchive, suspend: {available, reason}}}]} (role user = a member; an account is an admin or a member), sorted admins, users, entities, then id; entities_warning when the entity list could not be read
PUT /admin/accounts/{id}/active {active} → the updated row. Users: false = deactivated (signed out, cannot sign in); 409 {message} for your own account ("You can't deactivate your own account.") or the last active admin. Entities: false = suspended (entity state paused, its door credential off, an open visit closed); true = resumed (the state it had before is restored, stored in <data_dir>/auth/entity_suspended.json)
GET /admin/accounts/{id}/activity ?limit=100&kind=sign_in,run,… (admin)
GET /me/activity the same for the signed-in account
GET /me/accounts any signed-in account: {accounts: [rows], scope: "own"}, the same row shape — your own row plus one row per entity you created; actions only an admin can take are unavailable with the reason. ?include_archived=true adds the archived entities you created
POST /me/accounts/{id}/archive, POST /me/accounts/{id}/unarchive, PUT /me/accounts/{id}/active an entity you created: archive it, unarchive it (it comes back inactive) or turn it on or off ({active}); any other id answers 404 like a missing account (who configures an entity)
GET /me/accounts/{id}/activity the activity of your own account or of an entity you created; any other id answers 404

Who sees which account

An admin sees every user and every entity (GET /admin/accounts; non-admins get 403 there). Anyone else sees only themself and the entities they created. Entity rows carry created_by ({tenant_id, user_id} of the account whose POST /entities created it, or null).

This is enforced on every entity route, not only on the Accounts page:

  • POST /entities writes created_by into the new home's manifest.json. Entities created before this field existed have none and are visible to admins only: no creator is guessed and no existing manifest is rewritten.
  • GET /entities lists only the entities the caller may see.
  • Every /entities/{name}/… route (inspect, card, state, chat, visit, summon, workspace, tool policy, replay, …) checks first. An entity you may not see answers exactly like one that does not exist: 404 with the same sentence, so names cannot be probed this way.
  • POST /entities/meets/open needs both entities visible; /entities/meets/{id} answers 404 for a meet with an entity you may not see.
  • Creating an entity under a name another account already holds answers 409 ("That name is taken …"): entity names are unique per gateway, so this is the one place a name's existence shows. This holds across runtimes: an entity living in another user's runtime, or a user account with that name, also answers 409 (POST /entities/{name}/validate reports the same error).
  • Visibility is not the same as configuration: the creator of an entity changes its settings (mind, voice, tools per phase, instructions, skills, workspaces, preferences, archive, unarchive, Active) within what the admin authorised; its lifecycle acts (state, personal time, work order, memory review and rebuild, mounts) stay admin-only. GET /entities/{name}/access says what the caller may change: security.md.

Without user accounts (the single-operator gateway) every entity is visible, as before.

The email address and mailbox of a row come from the resolver GET /me/email uses. An action that cannot apply says why in reason: an entity has no mailbox ("Entities can't have their own mailbox yet: mailboxes belong to a user's runtime." — entity runs use their own runtime, without the host's mailbox), no token to rotate (its credential is discarded at creation) and no delete ("An entity's name is kept for life; suspend it instead.").

Activity answers {events: [{ts, kind: sign_in \| token \| run \| automation \| email \| account, title, detail, run_id, observer_path, ok, ts_local}], source: "audit_log", oldest_ts, truncated, note}, newest first. It reads <data_dir>/audit_log.jsonl and its rotated files backwards within a fixed read budget (truncated: older entries were not read). Events come from two explicit tables: the request lines (sign-ins, sign-out, runs started with their run_id, automation commands, account changes by an admin) and the typed email events (mailbox connected, tested, notification sent or not, …). The audit log records writes only: read-only requests (page views, token use on reads), mail received and what agents send with their email tools are not in it, and note says so. observer_path opens the event in the Observer app: /apps/observer/#run/<run_id> for a run, /apps/observer/#automations for an automation event; ts_local is ts in the gateway's local time (ISO 8601 with its offset).

A run id is created by the run-start route, so it is not in the request path: POST /runs/start and POST /runs/schedule write run {run_id, workflow, bundle_id, bundle_version, entrypoint, scheduled} on their audit line (workflow is the entrypoint's name, else the bundle id). A run event's detail is that workflow name. A run-start line written by a gateway older than 0.10.0 has no run id: its detail is "Run id not recorded (before this version)" and it has no run_id and no observer_path (nothing is guessed from times). A notification event's detail is its kind in words: "Approval needed", "Job failed", "Job finished", "Automation result", "Automation failed", "Test notification"; any other kind is shown as written.

Account preferences

The gateway keeps each account's client preferences, so every app and every device of that account see the same choice and no client keeps it. The gateway defines the defaults; an account may override them for itself.

Route Purpose
GET /api/gateway/accounts/{account}/preferences {ok, account: "tenant:user", can_edit, preferences: {default_workflow: {<interface>: value \| null}, time_zone: value \| null}, declared: {default_workflow: {label, help}, time_zone: {label, help}}, apps: [row], time_zone: {value, gateway_default, effective, label, help, choices}}
PUT /api/gateway/accounts/{account}/preferences {"default_workflow": {<interface>: "bundle:flow" \| "catalog:bundle:flow" \| null}, "time_zone": "Europe/Paris" \| null} (each key optional) → the GET answer

{account} is me (the caller), name, tenant:name or an entity's slug. Who: anyone for their own; an admin for any account; an entity's preferences by an admin or the entity's creator. Anyone else gets 403 with "Only an admin or the account itself can read or change its preferences." (an entity: "Only an admin or 's creator can read or change its preferences."). An account that does not exist answers 404. A gateway older than 0.13.1 has no such route (404 Not Found); the Assistant and AbstractCode then keep their own choice as before.

Only keys the gateway declares are accepted: default_workflow and time_zone.

time_zone is the account's IANA time zone. Daily, weekly and monthly automations are created on it (automations.md), and automation summaries show times in it. null follows the gateway default, which is the time zone of the computer the gateway runs on (the OS TZ, else the zone /etc/localtime points to, else /etc/timezone, else UTC). The GET's time_zone block gives the stored value, the gateway_default, the effective zone and choices, every IANA name the gateway knows; clients offer exactly those. An unknown name is refused with 400 preference_refused, key time_zone. Changing it never moves a schedule@2 automation: each keeps the zone it was created with until its trigger is revised. A schedule@1, legacy, email or manual automation has no zone of its own, so its summary shows times in the owner's current time zone.

default_workflow is one entry per app interface (abstractcode.agent.v1, abstractassistant.agent.v1). null follows the gateway's per-app default, which is the admin setting agents.default_workflow.<interface> (Workflows → Default workflow per app, configuration.md); it is never copied into the account. A chosen workflow is stored without a version, so it runs its latest published version. The PUT replaces the named interfaces and keeps the others. It is refused with 400 {"detail": {"reason": "preference_refused", "message": <sentence>, "key": <key>}} for an unknown key ("Unknown preference 'theme': this gateway declares default_workflow, time_zone."), an interface that is not an app's, or a workflow the account may not run for that app ("…refused: 'helper@1.0.0:agent' declares abstractassistant.agent.v1, not abstractcode.agent.v1"). A refused PUT changes nothing. The change is audited on the target account's activity ("Preferences changed").

Each apps row: {interface, label, app, help, value, state, reason, gateway_default, gateway_default_label, effective, choices}.

Field Meaning
value the account's choice, null = the gateway default
state default (null), set (a choice that runs), broken (a choice that no longer runs; reason says why and what to do, e.g. "coder-two:agent no longer runs for alice: … Pick another workflow or Gateway default.")
gateway_default {available, name, value, workflow_id, reason}: what the admin's per-app default resolves to now
gateway_default_label "Gateway default ()", or "Gateway default (unavailable)"; every client shows it verbatim as the first option
effective what a run of this app starts for this account: {source: account \| gateway, available, name, value, workflow_id, bundle_id, bundle_version, flow_id, registry_scope, reason}
choices the workflows the account may run for this app: [{value, label, name, workflow_id, bundle_id, bundle_version, flow_id, registry_scope}], latest versions, never one an admin made unavailable to users or archived; label is shown verbatim

For me the choices are the caller's own (shared workflows available to them and their own workflows). For another account they are the gateway's shared workflows that account may run: an admin is never offered a user's private workflows.

Runs: an app starts the account's choice as an explicit workflow, or flow_id: "@default" with its interface when the value is null. @default keeps meaning the admin's per-app default.

Accounts rows (GET /admin/accounts, GET /me/accounts) carry actions.preferences {available, reason} (every user and entity that is not archived).

Email

Per-user email (email.md): every route acts on the caller's own account, resolved from the authenticated principal (never from a path or body id); entities are refused (403). No response ever carries a password, token or OAuth client secret.

The email address is the user's own address (sign-in codes, notifications, the default allowed recipient; no password); the mailbox is the connection the user makes so their agents and automations can read and send mail as them.

Your email address and mailbox (/api/gateway/me/..., every signed-in human):

Route Purpose
GET /me/email settings and status (mailbox{state, address, provider, reason} as in /admin/accounts): configured, address, imap, smtp, auth_kind, secret_set, policy, limits (+ usage), status{last_test, last_ok, last_error{code, cause, fix}}, watcher{state, last_poll, cursor, received}, admin_enabled, effective_enabled; for the account page: email_address (your email address as stored), registered_address ("self" for runs: that address, else the mailbox's own), email_available, notifications{job_failed, approval_needed} + notifications_unavailable_reason, agent_tools{on, available, unavailable_reason, active}, oauth_providers[{id, available, reason}]; send_capable (false for a mailbox stored without its SMTP leg — mailbox.state: receive_only)
POST /me/email/discover {address} → {address, domain, found, source, provider, imap, smtp, username, tried, defaults} (known providers, autoconfig, ISPDB, SRV, MX); defaults is what the form pre-fills: {imap{host, port, security}, smtp{…}, login, source: discovered \| standard, provider, message} (AbstractCore server_defaults: the discovered servers, else imap.<domain> 993 SSL and smtp.<domain> 465 SSL, "Standard settings for — change them if your provider uses others."); 400 for a non-address
PUT /me/email connect (save + test): {address, password, username?, display_name?, imap?{host, port, security, folder}, smtp?{host, port, security}, test}; username defaults to the discovered login, else the address; display_name to the stored name, else the address's local part; connecting sets your email address when it is empty (audited email.address_changed, reason mailbox_connected); without imap and smtp the servers are discovered (discovery{source, provider, tried} in the answer; none found = 400 email_discovery_failed with tried); signs in to both servers first (unless test: false), stores nothing on a failure and names the failing step (detail.step: imap | smtp, detail.message); a leg left out is filled with the domain's standard server (or the discovered one) and the test signs in to BOTH, so a connected mailbox can always send (an unreachable outgoing server is detail.step: smtp, nothing stored); tools_reloaded: the caller's workflows were reloaded so agents' toolsets follow
PUT /me/email/address {address} — your email address, stored on your user record ("" clears it; 400 email_invalid_settings for anything but one plain address)
PUT /me/email/notifications {job_failed?, approval_needed?} — the two notification switches (both on by default); the earlier {email: {...}} body is accepted and mapped; answers like GET /me/email
POST /me/email/test per-leg result {imap, smtp, ok, message}; message: "Test passed: signed in to imap.x and smtp.x." or the failing step and its cause ("Sign-in refused by imap.x — check the password. (…)")
DELETE /me/email disconnect: credentials and cursor deleted (policy and limits kept); tools_reloaded
PUT /me/email/policy {mode: "allowlist" \| "denylist", always_allow?: [address \| domain], always_deny?: [address \| domain]}; a list given replaces that list. Precedence: own address → allowed; Always denied → refused; Always allowed → allowed; else the mode (allowlist = Only the Allowed list → refused, denylist = Anyone not on the Denied list → allowed). A domain covers its subdomains. The older {mode, entries} is accepted (entries = the mode's list)
POST /me/email/policy/check {to?, cc?, bcc?, addresses?} (addresses = To) → per-recipient verdicts with source (self, always_deny, always_allow, mode)
PUT /me/email/limits {per_hour, per_day}
PUT /me/email/folder {folder} — the folder your mailbox is read from (empty = INBOX); the connection is kept and nothing is tested; 404 email_not_configured without a mailbox
PUT /me/email/enabled {enabled} — the mailbox's Active switch (off keeps the settings; stops watching, sending and notifications); tools_reloaded
GET /me/email/autodiscover?address= everything a mailbox form needs from an address alone: {address, provider: google \| microsoft \| yahoo \| icloud \| fastmail \| other, display_name ("Gmail", …; the domain for other), imap: {host, port, security: ssl \| starttls}, smtp: {host, port, security} \| null, login (the address, or the provider's login form), sign_in: ["oauth" \| "password" \| "app_password"] (what the provider accepts), oauth_available (this gateway has a sign-in client for it), app_password_url? (Google, Yahoo, iCloud), source: preset \| autoconfig \| srv \| none}. Resolution: AbstractCore's provider table (and MX pointing at a known provider) → the domain's autoconfig file and the Thunderbird ISPDB (3 s each) → DNS SRV (_imaps._tcp, _submission(s)._tcp, then _imap._tcp with STARTTLS) → none (empty IMAP host, no SMTP); an IMAP server alone is enough (a further mailbox reads only). Cached per domain for a day. 400 email_invalid_settings for a non-address
GET /me/email/accounts every mailbox of yours: {items: [{account_id, primary, name, account_ref, configured, address, can_read, can_send (Read and write and an outgoing server), can_write (automations may change the mailbox: mark, label, move, delete, and send), access (read= Read only \|write= Read and write \| null when not connected; the person's choice, the primary alwayswrite), enabled, folder, mailbox{state, address, provider, reason}, watcher{state, last_poll, last_error, received}}]}; the primary (default, the one PUT /me/email connects and runs are bound to) always first, further mailboxes once connected. GET /me/email carries the same list as accounts
GET /me/email/folders · GET /me/email/accounts/{mailbox_id}/folders the folders of your primary mailbox / of one of your mailboxes, for a folder picker: {folders: [{name, special: inbox \| sent \| trash \| drafts \| junk \| archive \| null, messages}]}, INBOX first then by name; special from the server's RFC 6154 special-use attributes; folders that cannot be opened are left out; messages absent when the server refused to open one. One connection, cached 60 s. 404 email_not_configured (no such mailbox of yours), 409 email_disabled (turned off)
GET /me/email/accounts/{mailbox_id} one of them; 404 email_not_configured for an id you have not connected
PUT /me/email/accounts/{mailbox_id} connect a further mailbox (mailbox_id: 1-32 of a-z 0-9 _ -; 400 email_invalid_settings otherwise): the PUT /me/email body plus write (default false) and name (optional, at most 120 characters: the mailbox's name in your lists, answered as name in its row; the login, username, defaults to the address). write: false stores IMAP only with access: read (Read only): automations can watch and read it, and mail verbs that change it or send from it are refused (email_mailbox_read_only); write: true stores access: write (Read and write) and also stores and tests SMTP (given, discovered or the domain's standard one). send is accepted as an older name of write. mailbox_id: default is the primary and behaves like PUT /me/email. Never changes your email address. Answers the mailbox's row
POST /me/email/accounts/{mailbox_id}/test {imap, smtp, ok, message} for that mailbox
PUT /me/email/accounts/{mailbox_id}/enabled {enabled} — that mailbox's Active switch (off: not watched)
PUT /me/email/accounts/{mailbox_id}/access {write: bool, smtp?: {host, port, security}, test?: true} — Read only / Read and write for a further mailbox without connecting it again (its sign-in is kept). write: true on a mailbox stored without an outgoing server adds one (smtp, else the provider's for a Google/Microsoft sign-in, else the discovered or the domain's standard one) and signs in to it first with the stored password or token: a refusal answers its typed error with details.step: smtp and changes nothing. write: false keeps a stored outgoing server, unused (can_send: false). 400 email_invalid_settings for the primary (default, always read and write); 404 email_not_configured for a mailbox that is not yours. Answers {ok: true, ...row}; audited as email.access_changed
DELETE /me/email/accounts/{mailbox_id} disconnect it (credentials and cursor deleted) → {account_id, disconnected, accounts}
POST /me/email/accounts/{mailbox_id}/oauth/start · …/oauth/poll · …/oauth/finish · …/oauth/cancel OAuth2 sign-in of a further mailbox (Gmail refuses account passwords over IMAP): the bodies and answers of /me/email/oauth/* plus write on start (default false: IMAP with XOAUTH2 only, Read only; true: Read and write, the provider's SMTP kept too; send is an older name of write); finish answers the mailbox's row. The tokens are sealed in that mailbox's own store; a sign-in started for one mailbox cannot be finished on another (422 email_oauth_failed)
PUT /me/email/agent-tools {enabled} — your agents' email tools (default off; 409 email_disabled while "Agent email tools for users" is off for you; active only with a connected, allowed mailbox); reloads your workflows so toolsets follow (tools_reloaded)
GET /me/email/oauth/clients which providers have a gateway OAuth client (no secrets)
POST /me/email/oauth/start {address, provider: google \| microsoft, client_id?, client_secret?, tenant?, flow?: device \| loopback} → device code (user_code, verification_uri) or authorization_url. token_endpoint, authorization_endpoint, device_authorization_endpoint and scopes are accepted only from an administrator with provider: "custom" (own client id); otherwise 403 email_oauth_override_refused
POST /me/email/oauth/poll {flow_id} → {pending: true} or the connected account
POST /me/email/oauth/finish {flow_id, wait_s} — waits up to 60 s for the approval; tools_reloaded once connected
POST /me/email/oauth/cancel {flow_id}
GET /me/notifications events and choices, channel availability, outbox summary
PUT /me/notifications {email: {job_failed, approval_needed: bool}}; the earlier kinds are accepted (automation_failed counts for job_failed; automation_result and job_finished are per-automation / per-run options now)
POST /me/notifications/test sends one test notification now → {ok, sent, reason_code, message, limit, state, error?}: reason_code is null (sent) or no_mailbox, mailbox_paused, rate_limited, queued_behind (+ queued_behind: how many), send_failed; message is the sentence to show ("Sent to x@y.", "Not sent: hourly limit reached (20 of 20 this hour) — resets at 14:05.", in the gateway's local time); limit {window: hour \| day, limit, used, resets_at} when a send limit held it back

Administrators (status and the switch only; administrators never read mail):

Route Purpose
GET /admin/users every row carries email_address and mailbox{state: connected \| receive_only \| needs_reconnect \| not_connected \| paused \| unavailable, address, provider, reason} (needs_reconnect: sealed with the old macOS keychain key, reason says to connect the mailbox again) from the same resolver as GET /me/email (so your own row matches your card; email stays the raw record field); each human row also carries email_account: {configured, address, state, admin_enabled, agent_tools_available, capabilities} (capabilities: {email, email_agent_tools} as {value, source: user \| gateway \| built-in}; user = a per-user override)
GET /admin/users/{user_id}/email configured, address, auth_kind, user_enabled, admin_enabled, effective_enabled, status (last test / last error), capabilities ({value, source: user \| gateway \| built-in}), agent_tools (available, user_enabled, active), watcher, state
PUT /admin/users/{user_id}/email {enabled?, agent_tools?, inherit?: ["email", "email_agent_tools"]} — per-user capabilities; enabled: false = no watcher, no sending, no notifications (settings kept); agent_tools = Agent email tools available
GET /admin/email/capabilities capabilities[{id, label, description, per_user, advanced, default, built_in_default}]: email "Mailboxes for users" (on), email_agent_tools "Agent email tools for users" (on) and email_recovery "Sign-in by email" (on)
PUT /admin/email/capabilities {email?, email_agent_tools?, email_recovery?, reset?: [...]}; tools_reloaded: how many built hosts were rebuilt so every user's agents follow the change
GET /admin/email/oauth-clients bring-your-own OAuth clients: client_id, client_secret_set, tenant per provider
PUT /admin/email/oauth-clients/{provider} {client_id, client_secret?, tenant?}; an empty client_id removes the provider's client; omitting client_secret keeps the stored one for the same id

Sign-in page (public):

Route Purpose
GET /session/recovery {available} — true when sign-in by email is on (email_recovery, default on) and at least one account of this gateway has email
POST /session/recovery/request {user_id, tenant_id?, purpose?: sign_in (default) \| reset_token} → {sent: true, to: "l•••@•••", expires_in_s, message}, {sent: false, reason_code: "no_email_address", message} (also for an unknown account), {sent: false, reason_code: "no_mailbox", message} (an address but no mailbox to send from), {sent: false, reason_code: "send_failed", message} (the mail server refused or could not be reached; the request waits up to 12 s for the real outcome) or {sent: false, reason_code: "too_many_requests", retry_after_s, message}; 404 recovery_off when sign-in by email is off (email.md)
POST /session/recovery/redeem {user_id, tenant_id?, purpose?, code, remember?} → a browser session; reset_token also returns the new token once. A wrong, expired or used code answers 401 recovery_code_refused

Errors carry {"detail": {"reason_code", "message", "cause", "fix", "retryable"}}: 400 invalid settings or a policy refusal (email_policy_refused), 403 entity or a refused OAuth override (email_oauth_override_refused), 404 no account (email_not_configured), 409 turned off (email_disabled) or credentials missing, 422 the mail server refused (email_auth_failed, email_tls_failed, email_unreachable, …), 429 send limit (email_rate_limited).

curl -sS -H "$AUTH" "$BASE_URL/api/gateway/me/email"
curl -sS -X POST -H "$AUTH" "$BASE_URL/api/gateway/me/email/test"
curl -sS -X POST -H "$AUTH" "$BASE_URL/api/gateway/me/notifications/test"

Runs: _runtime.notify = {"on": ["finished", "failed"], "channels": ["email"]} in a run's input asks for a notice when it ends (unknown values are dropped). _runtime.email_account and _runtime.email_allowed_recipients are set by the gateway; client-supplied values are removed.

Deprecated aliases (admin only, the calling administrator's own account; removed in a later minor release): GET /email/accounts, GET /email/messages (mailbox, since, status, limit), GET /email/messages/{uid} (whole body, content_trust: "untrusted"), POST /email/send ({to, cc?, bcc?, subject, body_text?, body_html?}; the recipient policy and limits apply).

Troubleshooting and common questions: faq.md.