Skip to main content

Dome LangChain Adapter

LangChain / LangGraph integration for the Dome Platform. It injects Dome identity and authorization into the seams of an existing LangChain app — it is additive, not a replacement for LangChain.

There are three surfaces, each opt-in:

Surface What it governs Key symbols
Governed tools tool calls DomeGatewayTool, gateway_tool; DomeGovernedTool, govern_tools (deprecated)
Governed chat models LLM calls DomeChatOpenAI, DomeChatAnthropic, broker_chat, broker_chat_for
Compose primitives agent-to-agent handoffs & spawned fleets session, mint_ephemeral, fleet_send; Gate, gate_edge, gate_command, causal (deprecated)

DomeGovernedTool, govern_tools, Gate, gate_edge, gate_command and causal decide with, or feed, the core SDK's local policy checks. They are deprecated and are removed in dome-langchain 1.0, together with local checks in dome-sdk 1.0. Dome does not record their decisions. Each emits a DeprecationWarning.

Install

pip install dome-langchain                 # core adapter: tools + gates + spawn
pip install 'dome-langchain[openai]'       # + DomeChatOpenAI (langchain-openai)
pip install 'dome-langchain[anthropic]'    # + DomeChatAnthropic (langchain-anthropic)
pip install 'dome-langchain[langgraph]'    # + the LangGraph shims

The core install needs only langchain-core. The chat-model surfaces pull in a provider client; importing DomeChatOpenAI / DomeChatAnthropic without the matching extra raises an ImportError with the install hint.

1. Governed tools

Deprecated, and removed in 1.0. For tools Dome serves, use DomeGatewayTool / gateway_tool: the call goes through the gateway, which enforces and records it.

DomeGovernedTool wraps any LangChain BaseTool. Before each execution it calls dome.Client.check(), and on deny it returns a denial message instead of running. Dome does not record these decisions.

import dome
from dome_langchain import DomeGovernedTool, govern_tools

client = dome.Client(token="dome_...", control_plane_url="https://api.domesystems.ai")
client.start_policy_sync()

governed = DomeGovernedTool(tool=search_tool, dome_client=client)
# or wrap several at once:
tools = govern_tools(client, [search_tool, db_tool, email_tool])

# Wrapping real Dome MCP tools: pass the connection UUID so the local check
# addresses them the way the gateway does (see dome.Client.check).
tools = govern_tools(client, mcp_tools, connection_id="<connection-uuid>")

client.close()

check() runs in this process, so a governed tool is a pre-check plus local enforcement — the gateway is not in the path and cannot enforce a call it never sees. Rules gating on facts only the gateway holds (a tool's Gateway memberships beyond the client's own, an LLM routing pool, connection attributes) have no local answer and fail closed. Use DomeGatewayTool / gateway_tool, which call through the gateway, when the gateway should be the one deciding.

2. Governed chat models

DomeChatOpenAI (the name mirrors its ChatOpenAI base; the older name DomeChatModel still works as an alias) is a ChatOpenAI subclass whose requests flow through the Dome Broker (the LLM gateway) under a specific agent's identity. The Broker authenticates the call as that agent, evaluates Cedar for the model action, audits it, then forwards to the upstream provider. Because it is a ChatOpenAI, streaming, tool-calling, and structured output work unchanged.

import dome
from dome_langchain import AgentIdentity, DomeChatOpenAI

# `for_agent` accepts any agent identity (anything with `token` +
# `gateway_url`) — an `EphemeralAgent` from the spawn API, or an
# `AgentIdentity` for an ordinary long-lived agent. The endpoint must name
# the agent's Gateway (`{root}/gateways/{id}`); enrollment/bootstrap/token
# exchange return the complete call-ready URL:
llm = DomeChatOpenAI.for_agent(
    AgentIdentity(
        token="dome_...",
        gateway_url="https://gw.example.com/gateways/<gateway-id>",
    )
)
llm.invoke("Summarise this ticket.")          # called as that agent

# End-user delegation (act-as) — per call, or bound once:
llm.invoke("Summarise this ticket.", act_as=user)   # ActAs or OIDC-JWT string
per_user = llm.with_act_as(user)
per_user.invoke("Summarise this ticket.")

act_as is encoded into an X-Dome-Act-As header on that request only; the Broker exposes it to Cedar as principal.act_as and does not forward it upstream. broker_chat / broker_chat_for are factory shims that return a DomeChatOpenAI (with a construction-time act-as default).

Every call also carries X-Dome-Caller-Surface: sdk so Dome audit attributes it to the SDK — attribution telemetry only, never an authorization input.

For Claude-native features (prompt caching, extended thinking, citations) use the Anthropic ingress instead:

from dome_langchain import DomeChatAnthropic
llm = DomeChatAnthropic.for_agent(agent, model="claude-haiku-4-5")

3. Compose primitives (chains & spawn)

Gated handoffs

Deprecated, and removed in 1.0. Gates decide with local policy checks, and Dome does not record their decisions.

A Gate turns a Dome authorization check into a routing decision. gate_edge adapts it to a LangGraph conditional edge ((state) -> next_node); gate_command is the newer node-returns-Command idiom. Gate is also a Runnable guard: in an LCEL chain, gate | next forwards the payload on allow and raises GateDenied on deny. (Use gate.evaluate() when you want the GateDecision value instead.)

What a gate checks — and what it doesn't. A gate evaluates Cedar with the agent backing dome_client (typically the orchestrator/parent) as the principal — not the downstream node. The from_node/to_node labels and any extra context are application-asserted, not verified: a gate is a client-side routing decision, not a cryptographic boundary, so it governs hops only insofar as your nodes assert that context honestly.

from dome_langchain import gate_edge

g.add_conditional_edges(
    "classifier",
    gate_edge(dome_client=client, from_node="classifier",
              to_node="retriever", resource="chain.hop_allowed"),
    {"retriever": "retriever"},
)

On allow the hop proceeds; on deny it routes to an on_deny node or raises GateDenied.

Spawned ephemeral fleets

session + mint_ephemeral register real, short-lived child agents (each with its own Dome identity and token) and tear them down on exit. fleet_send fans them out across a LangGraph node via Send.

from dome_langchain import session, fleet_send, DomeChatOpenAI

# `gateway_id` selects the Gateway every child is granted. Key creation and
# token exchange return each child's complete `/gateways/{id}` URL.
with session(platform, parent_agent_id=parent.agent_id,
             gateway_id=gateway_id) as s:
    fleet = s.spawn(count=4, template="researcher")
    sends = fleet_send(node="research", fleet=fleet,
                       payload_fn=lambda agent, i: {"agent": agent, "task": tasks[i]})
    # inside the "research" node, each worker calls the LLM as itself:
    #   llm = DomeChatOpenAI.for_agent(state["agent"])
# session exit revokes + hard-deletes the whole fleet

mint_ephemeral / session require a dome.DomeAdminClient (a workspace-admin client), not the per-agent DomeClient.

Examples

Runnable end-to-end demos live in examples/ (chain, spawn, broker). They require a provisioned Dome workspace — see examples/README.md.

Documentation

License

Proprietary. See LICENSE for details.

Metadata

Release files for dome-langchain 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dome-langchain 0.3.1
File Size Uploaded Provenance
dome_langchain-0.3.1.tar.gz 26.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for dome-langchain 0.3.1
File Interpreter ABI Platform
dome_langchain-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 56.3 kB

Release files / dome_langchain-0.3.1.tar.gz

Download URL dome_langchain-0.3.1.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a0c5bd2406035ba4d4def7a9c0f1b3947fb12d2f4cc77de48aee074028de91d
BLAKE2b-256 checksum
How to use checksums
6600c101ac5bd3f1d467adfddc71dc13664711419eb3607f2ebdecadf934705d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Release files / dome_langchain-0.3.1-py3-none-any.whl

Download URL dome_langchain-0.3.1-py3-none-any.whl
Size 30.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bedcde1480c1c204fa8c72602ac91c8da11d21db1ca217be6bc035261eaf9014
BLAKE2b-256 checksum
How to use checksums
8c4429f3c12eeca19e4bd1611b76e5ca0bbe4333733079f4203a9b31832c8d93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

Security for dome-langchain 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dome_langchain-0.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 24, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page