Skip to content

keelgate.adapters.a2a

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

Agent-to-Agent (A2A) adapter: an agent card and task intake under policy.

Needs keelgate[a2a]. build_agent_card describes the agent; build_a2a_app serves it with the JSON-RPC binding. Every inbound task passes the governed a2a_task_intake tool first (see :mod:keelgate.adapters.a2a._intake), and remote text is always treated as untrusted.

GovernedA2AExecutor

Bases: AgentExecutor

Runs inbound A2A tasks through the intake gate, then the supplied runner.

IntakeIn

Bases: BaseModel

The arguments of the governed a2a_task_intake tool: the remote task's text, id and context.

IntakeOut

Bases: BaseModel

The result of accepting an A2A task: whether it was accepted and its id.

TaskRequest dataclass

A task from a remote caller. text is untrusted.

TaskResult dataclass

What a task runner returns for an A2A task: the text to report and whether it succeeded.

build_a2a_app

build_a2a_app(
    toolset: GovernedToolset,
    runner: TaskRunner,
    card: AgentCard,
    *,
    grant_resolver: GrantResolver | None = None,
    rpc_url: str = RPC_URL,
) -> Starlette

A Starlette app serving the agent card and the JSON-RPC task endpoint.

build_agent_card

build_agent_card(
    *,
    name: str,
    description: str,
    url: str,
    version: str = "1.0.0",
    skills: Sequence[tuple[str, str, str]] = (),
) -> AgentCard

An agent card. skills are (id, name, description) triples.

The card advertises a JSON-RPC interface at url and no streaming or push notifications, which this adapter does not implement.

loop_task_runner

loop_task_runner(
    loop_factory: Callable[..., Loop],
    *,
    tenant_id: str,
    agent_id: str,
    as_of_for: Callable[[], datetime] | None = None,
) -> TaskRunner

A :data:TaskRunner that runs a loop, with the remote text as untrusted context.

loop_factory is called as loop_factory(context_sources=[...]).

make_intake_tool

make_intake_tool(*, timeout_s: float = 5.0) -> Tool

The governed tool that gates task intake. Register it before building the gateway.