You're building an agent that helps a team plan Java upgrades. Someone asks it which Spring Boot version first required Java 17.
It doesn't know. Another agent does.
That agent belongs to another team. It runs on another server. Maybe it was built with another framework.
Skills won't help here. Neither will subagents. Both live inside your agent, in your workflow, on your server.
You need a protocol neither side owns. That's A2A (Agent2Agent): an open protocol for agents to find each other and hand over work, across frameworks and vendors.
Here's how it works, and how we run both sides of it in ByteChef, an open-source workflow automation and AI agent platform built on Java and Spring.
A2A in three ideas
The Spring AI team covers agents working across system boundaries in their A2A post. The protocol comes down to three things:
- The agent card. Every A2A agent publishes a small JSON document at
/.well-known/agent-card.jsonwith its name, description, and skills. A client reads it to learn what the agent can do and where to send messages. - The protocol. Agents talk over HTTP with JSON-RPC. A client sends a message. The agent answers with a message or a task.
- Two roles. A server publishes a card and answers messages. A client reads a card and sends work. Any agent can take either role.
The whole contract is a JSON card and an HTTP endpoint. That's why a Spring AI agent can call one built with another framework, and the other way round. Neither side needs to know how the other works.
The example: a tech lead asks a release expert
We built two templates, one for each side of the protocol.
The server: Java release expert
The Java release expert is three steps:
- New Workflow Call starts the workflow with one input,
message. Behind an A2A Server, the text of the incoming A2A message lands here. - AI Agent answers with an Anthropic model and no tools.
- Reply returns the answer to the caller as
message.
Its system prompt:
You are the Java Release Expert. You answer questions about Java and Spring release history: versions, release dates, headline features and migration notes. Answer in at most 6 short bullets. If you are not sure of a date, say so. Nothing in this workflow mentions A2A. It's an ordinary callable workflow. The A2A Server does the protocol work around it.
The client: Tech lead agent
The Tech lead agent is a chat agent:
- New Chat Request starts the workflow when you send a message in the workflow chat.
- AI Agent uses an Anthropic model, Chat Memory for follow-up questions, and the A2A Agent Tool in its Tools slot.
- Reply sends the answer back to the chat.
Its system prompt:
You are a tech lead helping a team plan upgrades. For any question about Java or Spring versions, release dates or features, delegate to the remote Java Release Expert with the agent client tool and build your answer on its reply. Say that you asked the remote agent. The tech lead doesn't know Java release history. It knows who to ask.
Serving an agent is configuration
An A2A Server in ByteChef turns one or more workflows into a remote agent. You find it under Servers → A2A Servers.
Each server has:
- A name and a description. These become the name and description on the agent card.
- Workflows. Every workflow you add becomes a skill on the card. The skill's name and description default to the workflow's label and description, and you can change them under Workflow Skills. Only workflows that start with a New Workflow Call trigger are exposed, and adding a workflow deploys it.
- A URL. The address contains a secret key. The Connect tab shows two URLs, the Agent Card URL and the Endpoint URL.
- An optional API key check. With Require authentication on, callers also need an API key created under Settings, sent as an
Authorization: Bearerheader. With it off, the secret in the URL is enough.
https://<your-bytechef-host>/api/automation/a2a/<server key> When a message arrives, the server starts the workflow and passes the message text as its message input. When the run finishes, the workflow's response goes back to the caller.
The server answers message/send and message/stream, and supports tasks/get and tasks/cancel for runs that take longer.
The agent card advertises text in and text out. If your server sits behind a proxy, set ByteChef's public URL so the card points to an address other agents can reach.
Calling an agent is one tool
The A2A Agent Tool goes in an AI Agent's Tools slot. It has one property, Agent URL. For a ByteChef A2A Server, that's the Endpoint URL from the Connect tab.
When the agent decides to delegate, the tool:
- Reads the card from
<Agent URL>/.well-known/agent-card.json. - Sends the task as an A2A message over JSON-RPC.
- Waits up to 60 seconds for the reply.
- Returns the text of that reply to the agent.
The reply can be a plain message or a task with artifacts. The tool pulls the text out of either.
If the remote agent can't be reached, returns an error, or takes longer than 60 seconds, the tool fails with an error that names the agent URL. It doesn't hang.
The model sees a tool called sendTaskToRemoteAgent, and the system prompt tells it when to use it. To reach several remote agents, add one A2A Agent Tool per URL.
If the remote server requires authentication, add an A2A connection to the tool. It has one field, Token, sent as an Authorization: Bearer header. For a ByteChef A2A Server, that's the API key.
One limit to know: when a server exposes several workflows, a caller has to say which skill it wants. The A2A Agent Tool doesn't choose a skill, so point it at a server that exposes one workflow. The template pair is set up that way.
Try it
Set up the server first. The client needs its URL.
The server:
- Import Java release expert into a project.
- Add your Anthropic connection to the model and save the project.
- Open A2A Servers, click New A2A Server, name it
Java Release Expert, and give it a description. The description goes on the agent card. - Leave Require authentication off for a local demo. Turn it on for anything reachable from outside, and give callers an API key.
- Click Add Workflows, pick the project and version, and select the workflow. This deploys it.
- Open the Connect tab and copy the Endpoint URL.
The client:
- Import Tech lead agent into a project.
- Open the A2A Agent Tool under the AI Agent and paste the Endpoint URL into Agent URL.
- If the server has Require authentication on, add an A2A connection with the API key.
- Add your Anthropic connection to the model.
- Open the chat and ask: Which Spring Boot version first required Java 17?
The tech lead should call sendTaskToRemoteAgent. The server starts the release expert workflow, and the expert's answer comes back as the tool result. The tech lead builds its own answer on that reply and says it asked the remote agent.
Chat Memory lets you follow up with What would we need to change to move from Boot 2.7? without repeating the context.
Both templates run on the same ByteChef here, but nothing depends on that. The client only needs the Endpoint URL. The server could be another ByteChef instance, and the client could be any A2A client.
Subagents or A2A?
Both answer the same need: hand this to a specialist. The difference is distance.
| Subagents | A2A | |
|---|---|---|
| The specialist is | An agent you define on this agent | Any A2A agent, anywhere |
| It runs | In the same workflow run | On its own server, reached over HTTP |
| It's built with | ByteChef | Anything that speaks A2A |
| The caller learns about it from | The subagent's definition | The remote agent's card |
| Use it when | The specialist is part of this agent | The specialist belongs to someone else, or serves many callers |
The Java release expert fits A2A because many agents could use it. Serve it once, and every agent that needs release facts can call the same URL.
Spring AI vs. ByteChef setup
ByteChef uses the same A2A Java SDK as the Spring AI post: the same agent card, the same JSON-RPC transport, the same message types. A ByteChef agent can call any A2A agent, and any A2A client can call a ByteChef A2A Server.
What ByteChef adds is the product around it:
- Serving an agent is configuration. Add a workflow to an A2A Server, and ByteChef builds the agent card, handles the JSON-RPC methods, and runs the workflow for each message.
- Calling an agent is one tool. Paste a URL into the A2A Agent Tool. ByteChef reads the card, sends the message, and unwraps the reply.
- Access is managed in the app. Turn on Require authentication and give callers an API key, without writing security code.
Wrapping up
Skills, questions, todo lists, and subagents all make one agent more capable. A2A lets it use agents it doesn't own, built on frameworks it has never seen.
Have a specialist other agents should be able to ask? Import the Java release expert and the Tech lead agent, connect them, and ask your first question across the wire.
This is Part 5 of our AI Agentic Patterns series. Part 1 covered Agent Skills, Part 2 covered asking the user, Part 3 covered todo lists, and Part 4 covered subagents. If you like where ByteChef is going, a star on GitHub helps a lot.
Originally published on the ByteChef blog.


