Skip to content

keelgate.adapters

Stability of each symbol (stable or provisional) is listed in the API contract. Narrative and semantics are in the integration contract.

Adapters that wrap existing agent frameworks. Keelgate never requires them.

GovernedToolset is the one governed path every adapter uses: the tools an agent may call, each call routed through the gateway (grant, policy, approvals, audit), with tool output labelled untrusted. It needs no optional dependency; the framework-specific adapters live in the subpackages (mcp, langgraph, openai_agents, claude_agent_sdk, a2a and temporal).

GovernedToolset dataclass

A registry of tools bound to a gateway, a grant and a trusted context.

invoke async

invoke(
    name: str, arguments: Mapping[str, Any]
) -> ToolOutcome

Run one proposed call through the gateway. Never raises for a refusal.

is_error staticmethod

is_error(outcome: ToolOutcome) -> bool

Whether a framework should flag the result as an error (anything but OK).

render

render(outcome: ToolOutcome) -> str

The result as JSON text for a framework that only accepts strings.

The control-plane view (status, error code, hint, approval id) is plain. The tool's own output sits under :data:UNTRUSTED_KEY, so a model reading it sees a label saying it is data from outside. That label is a mitigation, not a control: the gateway already decided what could run.

tools

tools() -> list[Tool]

The tools offered to the agent, in a stable order.