Overview
Dome separates configuration from the client path. Connect and Govern define what an agent may reach and do. Develop covers the runtime client path: which credential to send, which Gateway URL to call, whether to attach act-as identity, and how to handle denials. Point every client at a Gateway path that includes/gateways/{{GATEWAY_ID}}. A bare host fails closed.
The typical workflow is:
- Authenticate with an agent key or short-lived JWT.
- Route traffic to MCP and model endpoints on the Gateway.
- Optionally pass identity for delegated agents when access depends on the person behind the agent.
- Handle errors and denials from the gateway.
Runtime credentials
The gateway accepts either credential form as a bearer (or Anthropicx-api-key):
- Agent API key is a long-lived secret for services and hosted clients. Send it on every request, or exchange it for a JWT.
- Short-lived JWT is exchanged from the key through the Dome API when your runtime rotates credentials. Cache until expiry. Do not exchange on every call.
Gateway URL
Use one Gateway URL for each runtime client:
Membership on the Gateway determines which tools and models the endpoint exposes. Grants and Rules still decide admission and actions. Build and verify URLs on Gateways. Call examples are under Route traffic.
Delegated identity on the wire
When the agent is delegated, every governed request carries verified end-user evidence inX-Dome-Act-As. Configure providers and the agent method in Delegated agents. Application code only attaches the header. It does not verify the claim. Refer to Pass identity for delegated agents.
Requirements
Before you begin:- Register an agent, create its key, and grant it access to a Gateway that already has the tools or models you need as members
- Confirm Rules (and Guards or Quotas, if used) allow the calls you will make
- Set
DOME_AGENT_KEYandDOME_GATEWAY_URLas shown in Gateway URL
Permissions
Runtime calls use the agent key and Cedar Rules, not workspace RBAC. Platform permissions apply when you manage agents, Gateways, or Rules in Connect and Govern.Authenticate
Present the agent key on every runtime request. The gateway authenticates the agent before it evaluates Gateway admission or Cedar policy. Use either credential form:- Agent API key: Send the key directly for long-running services and hosted clients.
- Short-lived JWT: Exchange the key for a token when your runtime rotates credentials.
Send the agent key
Send the key in theAuthorization header for MCP and OpenAI-shaped requests:
api_key as x-api-key on /v1/messages and /v1/messages/count_tokens. The gateway promotes it into the same agent identity pipeline.
Authorization takes precedence when both headers are present. Other runtime routes require bearer authentication.
Exchange the key for a JWT
Exchange the key against the Dome API, then cache the token until its expiry:expires_in. Do not exchange a token for every gateway call.
Route traffic
Send runtime traffic to the Gateway that contains the required tools or pools. Dome resolves the resource, authorizes the call, injects upstream credentials, and records the result.Call MCP tools
Use an MCP Streamable HTTP client against the Gateway’s/mcp endpoint:
tools/list returns only tools in the selected Gateway that the agent may discover. tools/call evaluates authorization again for the requested tool.
MCP Streamable HTTP can return normal JSON or an SSE response. Keep the session open until the client consumes the complete result.
Call models
Point an OpenAI or Anthropic client at the Gateway. Setmodel to a Dome pool or connection name. The gateway preserves each client’s native response shape and translates requests upstream only after resource resolution and authorization.
- OpenAI
- Anthropic
Point the OpenAI client at the Gateway’s The same base supports Consume the iterator until completion. Once the first SSE event reaches the client, the gateway cannot fail over to another model connection.
/v1 base. Pass the agent key as api_key./chat/completions, /responses, /embeddings, /moderations, and /models. Provider support can vary for embeddings, moderation, and Responses API calls.POST /v1/embeddings honors OpenAI’s encoding_format on the request body. With float (or omitted), the response is a JSON array of floats. With base64, the response is little-endian IEEE-754 float32 bytes as a string. The gateway always fetches float vectors upstream and re-encodes for the caller. Token accounting is unchanged. Any other value returns HTTP 400. Ingress routes are on the LLM gateway concept.Stream Chat Completions by setting stream=True:model:
- An exact pool name selects that pool.
- An exact connection name selects that connection.
- A provider model ID selects a matching connection.
- A configured routing predicate can select a pool.
- The workspace default pool handles the remaining request.
match_when are on the Pools reference. Define membership, strategies, and failover on Pools and connections on Models.
Pass identity for delegated agents
When the agent is delegated, attach the human identity on each request. The gateway verifies it before Cedar, routing, per-user credentials, or backend forwarding uses it. Send the evidence inX-Dome-Act-As on MCP, OpenAI, and Anthropic requests. Match the wire value to the agent’s configured verification method. The method-to-header table is on Delegated agents. Prefer OIDC or bound identity for production traffic. Configure providers on Delegated agents.
Pass OIDC identity to MCP
Add the end-user token to the session headers:tools/list and tools/call. Discovery can include per-user credential advisories specific to that identity.
Pass OIDC identity to OpenAI
Create a client for the current user or pass the header per request:Pass OIDC identity to Anthropic
Set the same header through the Anthropic client:Use identity at runtime
Verified claims populateprincipal.act_as for authorization and routing:
principal.act_as.subprincipal.act_as.emailprincipal.act_as.rolesprincipal.act_as.groupsprincipal.act_as.claims.<key>
sub. If the user has not connected a credential, follow the provisioning response in Errors and denials.
The gateway forwards act-as identity upstream only when the connection explicitly configures an act-as-sourced header. Keep that egress choice in Connect.
Errors and denials
Separate authentication failures, missing user credentials, authorization denials, and upstream failures. Each requires a different application response.Agent-facing prompt protocol
A missing per-user credential returns401 Unauthorized before an LLM stream starts. Give the returned provision_url to the end user, then retry after completion.
Shared surfaces on every ingress:
- HTTP status:
401 Unauthorized - Header:
WWW-Authenticate: Bearer realm="dome", error="invalid_token", resource_metadata="<magic-link-url>" - Body: a native permission error plus a
dome.credential_required/dome_credential_requiredextension withprovision_urlandexpires_at
WWW-Authenticate so HTTP-aware tooling, Dome-aware clients, and SDKs that only render error.message can all recover. Per-user LLM requests also need a verified X-Dome-Act-As identity. Without act-as, the gateway returns 401 with a plain permission error and does not mint a magic link.
For MCP:
tools/listincludes_meta.dome.auth_requiredadvisories (one entry per unprovisioned backend).tools/callsetserror.data.typetodome.credential_required.
dome_credential_required sibling with connection, provision_url, and expires_at.
Do not mint or open the URL in a background service. Present it to the represented end user. Magic links are single-use and short-lived (10 minutes by default). If a link expires, the next call against the same connection mints a fresh one.
- MCP
- LLM (OpenAI)
- LLM (Anthropic)
JSON-RPC error response
tools/list excerpt for a partially provisioned user
Authorization denial protocol
When the gateway denies a request, it returns a structureddome_authorization_denied extension alongside the native error body. The extension explains which rule fired so you can surface feedback in agent UIs and alert on the deciding policy.
- MCP — JSON-RPC
error.data, witherror.data.type = "dome.authorization_denied" - LLM (OpenAI) — top-level
dome_authorization_denied, pluserror.code = "dome.authorization_denied" - LLM (Anthropic) — top-level
dome_authorization_denied. The Anthropic envelope has nocodefield
- MCP
- LLM (OpenAI)
- LLM (Anthropic)
JSON-RPC error response
dome_authorization_denied field. Treat policy denials as final for the unchanged request. Show a safe reason to the user and record the request’s activity or trace identifier.
Handle streaming failures
Authentication, act-as validation, per-user credential checks, and initial authorization run before the first model SSE event. These failures arrive as normal HTTP errors. After streaming begins:- Treat a broken connection as an incomplete response.
- Do not assume the gateway retried another model.
- Discard partial structured output unless your application validates it.
- Retry only when the operation is safe and your client can prevent duplicates.
Retry safely
Retry timeouts, connection failures,429, and transient 5xx responses with bounded exponential backoff. Honor Retry-After when present.
Do not automatically retry 400, 401, or 403. Refresh an expired agent token, complete user provisioning, or change the denied request first.
Next steps
- Connect to attach resources, group them in Gateways, and configure routing
- Govern to authorize actions, assign Guards, and set Quotas
- Stream Live Events to trace calls, denials, latency, and model usage
- Agent Identity concept for keys, tokens, and act-as claims in more depth