Skip to content

The A2A agent

limen_agents.a2a

Limen as an A2A agent: other agents send it a message, it answers.

The Agent2Agent protocol lets an agent find another (its agent card, at /.well-known/agent-card.json) and send it messages over JSON-RPC. This module gives Limen one: :class:LimenExecutor turns a message into a reply with any answer function, and :func:create_app serves it.

The default answer, :func:evidence_answer, needs no model: it takes a JSON request with a hazard and some places, and answers with what the open-data libraries say about them (:mod:limen_core.evidence), as data. An application plugs in its own answer, an agent with a model behind it, through the same function shape.

Needs the a2a extra. limen-agents-a2a serves on 127.0.0.1.

LimenExecutor

Bases: AgentExecutor

An A2A executor around an answer function: one message, one reply.

evidence_answer

evidence_answer(clients: Callable[[], Clients] = Clients) -> Answer

The default answer: a JSON request in, the evidence block out.

agent_card

agent_card(url: str, *, name: str = 'Limen', description: str = 'Limen reads the open data on hazards in Italy (rain, landslides, earthquakes, fires) and says what it measured, with its sources. It is not an alert service.', skills: Sequence[AgentSkill] = (EVIDENCE_SKILL,)) -> AgentCard

The card other agents read to know what Limen does and where to write.

create_app

create_app(answer: Answer | None = None, *, base_url: str = f'http://127.0.0.1:{HTTP_PORT}', card: AgentCard | None = None) -> Starlette

The ASGI app: the agent card and the JSON-RPC endpoint at :data:RPC_PATH.

main

main(argv: Sequence[str] | None = None) -> None

limen-agents-a2a: the agent on 127.0.0.1.