Book a free call

A2A Protocol Best Practices: Reliable Agent-to-Agent Calls

A2A protocol best practices that keep agent calls reliable: clear task messages, scoped permissions, bounded retries, and a log of every exchange.

Hertiv engineering teamReviewed by a senior engineer
6 min read
A2A Protocol Best Practices: Reliable Agent-to-Agent Calls
On this page

Short answer

The A2A protocol works best when each agent sends small, clearly described tasks, proves who it is before acting, and reports progress in a format the other agent can read. Keep permissions narrow, retry failed calls a fixed number of times, and log every task state change. That combination keeps agent-to-agent work reliable without giving any agent more access than it needs.

What is the A2A protocol?

The A2A protocol is an open standard that lets independent AI agents send each other tasks, share progress and return results, even when the agents were built by different teams. It defines a common format for the exchange, so one agent can ask another to do a job without knowing how that agent works inside.

The exchange runs on a few building blocks. An agent card describes what an agent can do and how to reach it. A task object carries the goal, the inputs and the current state. Messages pass text and files between agents, and artifacts hold the finished work, such as a document, a booking or a report.

A2A sits beside other agent standards rather than replacing them. It handles agent-to-agent calls, while other protocols connect agents to tools and data. For the background, what the A2A protocol is explains the design in more depth.

How do you design a task message agents can read?

Design each task message as a small, self-contained request: one goal, the inputs the other agent needs, and the exact format you expect back. A task that asks for three different things at once is hard to track, hard to retry and hard to test.

Include a short description of the goal in plain language, a list of inputs with their meaning, and a deadline or a priority. If the task needs files, attach them to the message rather than describing them. The receiving agent should be able to start work without asking a follow-up question.

Keep the expected output explicit. Say whether you want a summary, a file, a booking confirmation or a yes-or-no answer, and name the fields that must be present. Clear outputs make it easy to check the result automatically, which is where good protocol practice pays off across agent systems.

How do you handle long-running tasks?

Treat long tasks as a state machine, not a single call. The requesting agent submits the task, then checks progress while the other agent works. The task moves through clear states, and either side can see where it stands without guessing.

StateWhat it meansWhat to do
SubmittedTask received, not yet startedWait for the first status update
WorkingAgent is doing the jobCheck progress on a schedule
Input requiredAgent needs more informationSend the missing input promptly
CompletedWork finished, result attachedCheck the result against the request
FailedTask could not finishRead the error, then retry or escalate
CancelledTask stopped by requestConfirm nothing was partly done

Use streaming updates or regular status checks for tasks that take minutes or longer. When a task needs input, it should pause and say exactly what is missing, rather than failing silently or guessing. That pause-and-ask pattern is the difference between a task that finishes and one that loops.

Set a timeout for each task and decide in advance what happens when it expires. A task that runs forever blocks the workflow and hides the failure, so a clear timeout with a retry or a handoff to a human keeps the system moving.

How do you keep agent calls secure?

Give each agent an identity and check it before any task is accepted. An agent should only receive tasks it is allowed to run, and it should only see the data that the task needs. Permissions are set per agent, not shared across the whole system.

Keep secrets out of task messages. Pass references to credentials or files through a secure channel, never inside the message text where they could be logged or forwarded. Rotate agent credentials on a schedule and revoke them when an agent is retired.

Log every task request, state change and result, and review the log for unusual patterns, such as an agent asking for data outside its scope. The log is also your audit trail when something goes wrong. For the implementation steps, how to implement the A2A protocol covers the security setup in order.

How do you handle failures and retries?

Retry failed calls a fixed number of times, then stop and report the failure. A retry loop without a limit can repeat a costly or harmful action many times, such as booking the same flight twice. Two or three attempts with a short pause between them covers most transient errors.

Make repeated calls safe by giving each task a unique id. If the same task arrives twice, the receiving agent should recognise the id and return the earlier result instead of running the work again. This idempotency rule matters most for tasks that change something, such as payments or bookings.

Send failed tasks to a dead-letter queue or a human review list after the retries run out, with the error and the task details attached. A visible failure list beats a silent one, because the team can fix the cause instead of discovering it days later. Agentic AI development covers the retry and fallback patterns in more detail.

Example (hypothetical): two agents booking a trip

Example (hypothetical): a travel agent asks a booking agent to hold seats on 6 flights for a group trip. Each hold normally takes about 20 seconds, so 6 holds should take about 2 minutes if everything works the first time.

Five holds complete in 20 seconds each, which is 100 seconds. The sixth hold fails on the first try, so the travel agent retries it once and it completes in 40 seconds. The total is 140 seconds, just over 2 minutes, and all 6 holds are in place.

The retry used the same task id, so the booking agent knew it was a repeat and did not create a duplicate hold. The travel agent logged each state change, so the trip organiser could see exactly which flights were held and when. The lesson is simple: small tasks, unique ids and a fixed retry limit turn a flaky call into a reliable one.

How do you test an A2A setup before launch?

Start by checking that each agent card is accurate: the skills it claims, the address it listens on and the formats it accepts. A card that promises a skill the agent cannot do will fail in production, usually at the worst moment.

Test with a slow or failing partner agent on purpose. Send tasks to an agent that takes minutes to answer, one that returns errors, and one that asks for missing input. Your side should handle each case without hanging or repeating the task.

Run a version check before every exchange. Agents change over time, and a task format that worked last month may not match the current card. A quick check at the start of the exchange catches the mismatch early, when it is cheap to fix.

What are the common mistakes?

The most common A2A mistakes are tasks that are too big, permissions that are too wide, and failures that nobody sees.

  • Sending one giant task instead of small steps, so a single failure wastes the whole run.
  • Giving every agent access to every tool, so one compromised agent can reach everything.
  • Retrying without a limit or a unique task id, so a failed booking is made twice.
  • Skipping the log, so nobody can explain what an agent did or why.
  • Assuming the other agent understands your format, instead of checking its agent card first.

A short checklist before launch catches most of these: one goal per task, scoped permissions, a retry limit, unique task ids and a log you actually read. For a broader view of agent-to-agent design, agent communication protocols compares the options.

Key takeaways

  • A2A lets agents from different teams exchange tasks through a shared format
  • Small, self-contained tasks with clear expected outputs are the easiest to track and retry
  • Scoped permissions and identity checks keep agent calls safe without slowing them down
  • Bounded retries with a unique task id stop a failed call from repeating harmful work
  • A log of every task state change is the audit trail when something goes wrong

Frequently asked questions

What is the A2A protocol used for?

The A2A protocol lets independent AI agents send each other tasks, share progress and return results. It is used when one agent needs another agent's skills, such as a travel agent asking a booking agent to hold flights, without either side knowing how the other works inside.

How is A2A different from MCP?

A2A connects agents to other agents, while MCP connects agents to tools and data. A typical setup uses both: MCP gives an agent access to a database or an API, and A2A lets it ask another agent to do a job that needs that agent's skills.

Do agents need to trust each other to use A2A?

No. Each agent checks the other's identity and only accepts tasks it is allowed to run, with permissions scoped to that agent. Trust is built into the checks, not assumed: messages carry only the data the task needs, and every exchange is logged.

What happens when an A2A task fails?

The task moves to a failed state with the error attached. The requesting agent retries a fixed number of times, using the same task id so the work is not repeated, and then sends the task to a human review list if it still fails.

Can A2A work with agents built by different companies?

Yes, that is the point of an open standard. As long as both agents follow the protocol and publish accurate agent cards, they can exchange tasks without sharing code or infrastructure.

Is A2A hard to adopt?

Adoption is gradual: publish an agent card, accept small tasks, add identity checks and logging, then expand. Most teams start with one pair of agents and one task type before connecting more.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: AI and agent systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Building agents that need to work together? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Multi-Agent Systems service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to contact@hertiv.com.

Prefer email? Write to contact@hertiv.com
Estimate costBook a call