dome package on PyPI. All configuration is explicit — the SDK does not read environment variables.
Client construction
The SDK ships two clients with identical surfaces:dome.Client (sync) and dome.AsyncClient (async). Both accept keyword arguments only.
gateway_url names the Gateway this client uses (/gateways/{uuid}). A client maps to one Gateway; there is no implicit global endpoint. connect() validates the URL and verifies that gateway_id, when supplied, names the same Gateway.
connect() prepares credentials and transport. It performs a token exchange when needed for control-plane discovery, but never blocks on local Cedar sync.
Gateways
A Gateway is a workspace-scoped grouping of MCP tools and LLM models with its own access grants and protocol endpoints. The SDK accepts only a complete scoped URL:
Agent-key creation and token exchange return a
GatewayEndpoints object containing all four call-ready values. Use gateway_url as returned; do not derive it from a bare data-plane host. If the client has control_plane_url, pass gateway_id to select a Gateway during exchange. Omission succeeds only when the agent can access exactly one Gateway; the workspace default marker does not resolve ambiguity.
The tools-list cache is keyed by the complete Gateway URL, agent, workspace, and act-as identity, so clients pointed at different Gateways never share entries. Find IDs with dome gateway list, the dashboard, or the admin surface.
Client surface
AsyncClient exposes the same members; methods marked synchronous below have async counterparts on AsyncClient.
Gateway tools
client.gateway.tools is the MCP tool client.
tools/list can do real work: upstream discovery, per-user authorization, audit emission, and credential-link generation. The SDK never does an implicit list-before-call.
tools/list are returned on the fresh response and are not cached.
Calling a tool
call() distinguishes JSON-RPC errors from MCP tool errors. JSON-RPC errors raise typed DomeGatewayError subclasses. If the upstream tool returns isError=true, the SDK raises DomeToolExecutionError by default. Pass raise_on_tool_error=False to receive ToolCallResult(is_error=True) instead.
Reading tool results
ToolCallResult exposes convenience accessors so you do not have to walk the MCP content array by hand.
Gateway LLM
client.gateway.llm posts OpenAI- and Anthropic-shaped requests through the Dome LLM ingress and decodes structured Dome errors.
client.gateway.model(...):
Provider-native clients
For teams that want provider-native APIs, the gateway hands back a configuredopenai/anthropic client pointed at the Dome ingress:
client.gateway.llm.* or client.gateway.model(...) when you want SDK-owned typed error decoding.
Gateway readiness
client.gateway.wait_ready() polls unauthenticated GET /ready and is an explicit diagnostic helper — not a startup requirement.
dome.wait_for_agent_key(...) or dome.bootstrap.ensure_agent(..., wait_gateway=True) in setup scripts to wait for the gateway’s synced API-key snapshot.
Act-as
The gateway act-as trust model is driven by Dome configuration, not by the client choosing a header shape. Pass the SDK value that matches the gateway method:bound, the SDK fails closed if caller code tries to send an act-as header.
Activity correlation
Wrap a run in an activity context to stamp every gateway call and audit event with the same opaque activity ID.AuditEventV1.correlation.activity_id and activity_trust surface the stamp on each event.
dome.new_activity_id() -> str
Mint a fresh UUIDv4 activity ID. Use when persisting an ID for later correlation. Equivalent to the ID client.activity() mints when none is passed.
Audit reads
client.audit queries the hosted Audit v1 read APIs through the configured control plane. The SDK does not write hosted audit events — gateway and control-plane services do that.
AuditQuery enum fields use the proto JSON enum names (for example EVENT_RESULT_SUCCEEDED, ACTOR_KIND_AGENT, INITIATOR_SURFACE_GATEWAY_MCP). stream rejects query-only filters (agent_ids, primary_resource_id, primary_resource_kind, trace_id, activity_id, workspace_id, start_time, end_time, page_size) at call time instead of silently dropping them.
Waiting on activity events
Gateway audit lands asynchronously. Usewait_for_activity in tests and post-run verification to block until the events you correlated under an activity ID are visible.
find_gateway_events is the non-blocking form — it issues one query and returns whatever is already visible. Both helpers default the workspace to the client’s authenticated workspace; pass workspace_id= to scope a platform-key reader explicitly.
Audit envelope
AuditEventV1 is the normalized read-side envelope returned by every audit read method.
Local policy checks
In-process Cedar evaluation is still available when an agent needs a fast, self-enforced decision. Local checks are opt-in — they requirestart_policy_sync() and a control_plane_url.
evaluate() with resource_type="mcp_tool" and the right action verb.
Admin client
DomeAdminClient is the workspace-scoped provisioning surface. Use it from orchestrator code or setup scripts to register agents, issue keys, deploy Cedar bundles, and configure gateway MCP and LLM connections. It authenticates with a workspace platform key (dome_pk_...) — not an agent token — and every call hits the control plane.
Client and DomeAdminClient are separate on purpose: Client is the runtime agent surface (authorization, audit reads, gateway calls); DomeAdminClient is the admin surface that creates the agents Client runs as.
Constructor
Agent registry
AgentKeyMaterial.token is the only place the bearer is ever returned. Persist it before discarding the response.
Workspace and gateway setup
Gateway admin
Create a Gateway, add tool sources, grant admission, and hand the resulting/gateways/{id} URL to agents.
The admin client covers Gateway CRUD, state/default selection, resource membership, per-agent access, and the all-agents grant. Gateway cost quotas live in the CLI, dashboard, and MCP tools.
delete_gateway) removes its memberships but leaves the underlying connections and pools unchanged. Callers still pointed at the deleted Gateway’s URL fail closed; repoint them first.
Admin errors
Every admin RPC raisesAdminAPIError on non-2xx responses. The exception carries path, status_code, and the full response body. body is truncated in the exception message so a verbose HTML error page does not produce an unreadable str().
Bootstrap helpers
Setup scripts can provision a development agent and issue a fresh gateway key with one call.
Pass an existing
DomeAdminClient as admin_client=, or pass control_plane_url, platform_key, and workspace_id and let the helper construct one. The returned BootstrapAgent exposes agent_id, token, gateway_id, and the complete gateway_url, plus the underlying AgentRecord and AgentKeyMaterial.
ensure_agent is idempotent. If an agent with the exact name exists, it is reused; if create_key=True, the named key is created or rotated and fresh key material is returned.
Pass wait_gateway=True to block until the Gateway has synced the new key. Select it with gateway_id=; gateway_url= is only an optional complete-URL override for the readiness probe and must name the same Gateway.
Errors
All error classes inherit fromdome.DomeError.
Control-plane / lifecycle
Gateway data-plane
All gateway errors inherit fromDomeGatewayError and carry status_code plus the raw response when available. request_id and activity_id are populated when the gateway response exposes them. gateway_id is stamped from the client’s configured endpoint, so every gateway error names the Gateway the failing call was routed through.
Async client
dome.AsyncClient has the same constructor and exposes the same surfaces with await-able methods.
client.audit.stream(...) returns an async iterator on AsyncClient. client.activity(...) returns an AsyncActivity and supports async with.
Framework adapters
Adapters are separate PyPI packages that wrapClient for a specific framework. Refer to Adapters for the catalog and integration details.
Next steps
Wrap the client for a framework, or wire credentials and Act-As from Develop:- Adapters for framework wrappers
- Develop for credentials, endpoints, and Act-As envelopes
- Delegated agents when access depends on the person
- Examples for a governed agent pattern