Skip to content
mentoor

Topic 3 of 5 · 5 min read

Delegating long-running work across organizations with A2A

Goal: Design an A2A delegation flow for a cross-company task, including discovery, authentication, task states and failure handling.

A cross-company delegation is a task you start, then follow: discover the remote agent, authenticate, send the goal, handle every task state, and treat the artifact as the only result. The remote side runs on its own schedule and may answer in seconds or days, so the design has to hold up when you are not watching.

Check yourself · 1 of 3

You send a request to a remote agent and it returns a task id. What should your system do first?

Choose one answer

Why it matters

A buyer's agent asking a supplier's agent for a custom quote is not a request-response call. The supplier may need to check stock, ask a person to approve a discount, or request a missing dimension. If your client treats the exchange as a function, it will time out, retry blindly and create duplicate orders.

A flow that holds up

  1. Discover. Fetch the supplier's agent card from its well-known URL. Check the supported interface and protocol version, whether push notifications are offered, and which security schemes are required.
  2. Authenticate. Use a scheme the card declares, for example OAuth 2.0 or OpenID Connect. The card says how; your credentials and scopes are agreed out of band.
  3. Send the goal. One message with parts: the request in text and the specification as a file or structured data. Include what you need back and by when.
  4. Record the task id in your own store immediately. It is your only handle if your process restarts.
  5. Follow it. Use a webhook if the card offers push notifications, or fetch the task on a schedule. A missed webhook is repaired by fetching.
  6. Handle each state. Working: do nothing. Input required: route the question to the right person or system, then answer on the same task. Auth required: complete the extra authorization. Completed: read the artifact. Failed or rejected: decide whether to retry as a new task. Canceled: stop and clean up.
  7. Validate the artifact. It is output from another organization's model. Check it against your own schema and rules before it triggers anything.

Before and after

Weak plan: "Call the supplier agent, wait for the quote, place the order." Fixed plan:

1 fetch card; verify OAuth scope and push support
2 send RFQ message with spec file; store task id with a 7-day deadline
3 webhook updates the record; poll once a day as a backstop
4 input required -> ask the buyer in our UI; reply on same task
5 completed -> validate quote artifact (currency, validity date, total)
6 a person approves before any order is placed

What goes wrong

  • No deadline. Tasks can stay in working indefinitely; cancel and escalate after your own limit.
  • Retrying a failed send blindly. The first attempt may have created a task. Look it up before sending again.
  • Acting on the artifact directly. A quote is a proposal. Money moves after your own check and approval.

Examples

Input required from a supplier

A packaging supplier's agent moves a quote task to input required: "Do you need FSC-certified board?" The buyer's agent cannot know. It forwards the question to the procurement manager, who answers in the app, and the reply goes back on the same task. The task then continues to completed with a quote artifact.

A webhook that never came

The buyer's server was down for an hour when the supplier's push notification fired. On restart a reconciliation job fetches every open task by id, finds one already completed, and processes its artifact. Nothing is lost because the task id was stored at the start.

Key points

  • Discovery, authentication and protocol version come from the remote agent's card, not from guesswork.
  • Store the task id as soon as it is returned; it is the handle for every later step.
  • Plan for each state: working, input required, auth required, completed, failed, rejected and canceled.
  • Use push notifications where offered and keep fetching the task as a backstop for missed callbacks.
  • Validate the returned artifact and require approval before it triggers payments or orders.

Common mistakes

  • Holding a single request open for a job that may take hours.
  • Resending a request after a timeout without checking whether a task already exists.
  • Treating a completed task as permission to place an order or pay.
  • Having no owner for input-required questions, so tasks wait forever.

Check yourself · 2 of 3

A remote task moves to input required with a question your agent cannot answer. What is the best next step?

Choose one answer

Check yourself · 3 of 3

A completed task returns a quote artifact for 4,200 EUR. What should happen before the order is placed?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic