Tools: Agent2Agent (A2A)
The a2a tool lets your Lectic interlocutor call a remote agent that implements the Agent2Agent (A2A) protocol.
This is useful for:
- Testing the built-in
lectic a2aserver - Delegating work to an external agent process
Configuration
You configure an A2A tool by providing the base URL for the agent.
If your agent card is served at:
http://HOST:PORT/agents/<id>/.well-known/agent-card.json
then set the tool URL to:
http://HOST:PORT/agents/<id>
Example:
tools:
- name: remote_agent
a2a: http://127.0.0.1:41240/agents/assistantOptional settings:
stream: prefer streaming (message/sendStream). Defaults totrue.maxWaitSeconds: when streaming, max seconds to wait for the call to reach a final event before returning early withtaskIdso you can poll usinggetTask. Defaults to5.headers: extra HTTP headers to attach to every A2A request.- Header values support
file:andexec:sources (same as MCP). - Avoid hardcoding secrets directly in YAML.
- Header values support
Example (bearer token loaded from an external command):
tools:
- name: prod_agent
a2a: https://example.com/agents/assistant
headers:
Authorization: exec:bash -lc 'echo "Bearer $(pass a2a/token)"'Tool call parameters
The tool exposes these parameters:
op(required): operation mode.sendMsg: send user text viamessage/send(ormessage/sendStream).getTask: poll a long-running task viatasks/get.
text(required forop=sendMsg): user text to send to the agent.contextId(optional): A2A context id to continue a conversation.taskId:- required for
op=getTask - optional for
op=sendMsg(some agents may attach messages to a task)
- required for
stream(optional): override streaming forop=sendMsg.maxWaitSeconds(optional): override the streaming max-wait for this call. When exceeded, the tool returns early with ataskId.
Example conversation
Configuration:
interlocutors:
- name: Assistant
prompt: >
You coordinate with a remote research agent.
tools:
- name: researcher
a2a: http://127.0.0.1:41240/agents/researchConversation:
Find recent papers on retrieval-augmented generation.
:::Assistant
<tool-call with="researcher">
<arguments>
<op>
┆sendMsg
</op>
<text>
┆Find recent papers on retrieval-augmented generation.
</text>
</arguments>
<results>
<result type="text">
┆Here are three recent papers on RAG:
┆1. "Adaptive RAG" (Chen et al., 2025) ...
┆2. ...
</result>
<result type="application/json">
┆{
┆ "contextId": "ctx-abc123",
┆ "taskId": "task-xyz789",
┆ "agent": "research",
┆ "baseUrl": "http://127.0.0.1:41240/agents/research",
┆ "streaming": true
┆}
</result>
</results>
</tool-call>
The remote agent found three recent papers on RAG. Here's a
summary...
:::To continue the same conversation with the remote agent, the assistant passes the contextId from the metadata in subsequent calls.
Output format
The tool returns:
text/plain: the agent response text.- Zero or more additional results extracted from A2A message parts and artifact updates:
application/pdf,image/*, etc. are returned asdata:URLs when provided as bytes, or as a normal URL when provided as a URI.application/jsonresults are emitted fordataparts.
application/json: call metadata.
The metadata includes:
contextId,taskId: identifiers you can reuseagent: the agent name from its agent cardbaseUrl,streaming: call metadata