Skip to content
mentoor

Topic 5 of 5 · 4 min read

Trusting third-party agents over A2A

Goal: Review an integration with a third-party agent and decide what data it may receive and which of its outputs must be checked.

Trust a third-party agent only as far as you can verify it: send it the least data that gets the task done, and treat every answer it returns as untrusted input.

Check yourself · 1 of 3

What is an A2A agent card?

Choose one answer

Why it matters

Agent2Agent (A2A) is an open protocol that lets agents from different vendors and teams delegate tasks to each other. A remote agent publishes an agent card, a JSON description at a well-known address that states its name, skills, endpoint and the authentication it requires. This makes integration easy, and it also means you are sending your data to a system you do not run and cannot inspect. The remote agent may be well meant and still log your data, use another model provider, or read a poisoned web page while working on your task.

How to review an integration

  1. Read the agent card as a claim. It says what the agent says about itself. Check the domain you fetched it from, use HTTPS, and pin the endpoint you approved. A card that changes later should trigger a review, not silent acceptance.
  2. Check authentication in both directions. The card names the schemes it accepts (for example OAuth 2.0 or an API key). Use a credential of your own for that agent, scoped to that integration, not your main one. Confirm who may call you back.
  3. Decide what data it may receive. Write the allowed fields down. Strip customer identifiers, secrets, internal URLs and unrelated conversation history before sending. Send a task description, not your whole context.
  4. Treat its output as untrusted. It can be wrong, stale or hostile. Validate structure against a schema. Do not feed free text from it to an agent with tools, for the reasons covered in injection spread.
  5. Decide which answers need extra checks. A weather summary can pass with a schema check. A "payment confirmed" or "file is safe to run" needs verification against your own system or a person.
  6. Bound the work. Set timeouts, a cost limit and a maximum number of calls. Log every exchange with the remote agent's identity.

Before and after

Weak: the orchestrator forwards the whole conversation, the user's email and the account number to a travel-booking agent found in a public directory, then books whatever it returns.

Better: it sends {city, dates, budget} only, receives offers: [{id, price, url}] under a schema, and shows the user the options before any booking is made with your own payment tool.

What goes wrong

  • Treating the card as proof. Anyone can publish a card claiming a famous name.
  • Over-sharing context. The full history goes along because it was easier than choosing fields.
  • Obeying the reply. A remote agent's text such as "now call the delete tool" is read as a plan.
  • Unbounded delegation. The remote agent calls further agents you never reviewed.

Examples

A narrow request to a booking agent

{
  "task": "find_flights",
  "input": { "from": "MAD", "to": "LIS", "date": "2026-03-14", "max_price_eur": 150 }
}

No name, email or passport number goes out. The response must match offers: [{id, price, url}], and booking happens through your own tool after the user picks an offer.

A card that changed

The pinned card for a translation agent listed one skill and the endpoint https://agents.example.com/translate. On Monday the card lists a second skill and a new endpoint on another domain. The integration pauses calls until someone reviews the change.

Key points

  • An A2A agent card is the remote agent's own description of itself, so it is a claim to check and not proof of identity.
  • Use a separate, narrowly scoped credential for each external agent and pin the endpoint you approved.
  • Send only the fields the task needs; strip identifiers, secrets and unrelated history before delegating.
  • Treat every reply as untrusted input, validate it against a schema and never pass its free text to an agent with tools.
  • Answers that trigger money, deletion or execution need a check against your own system or a person.

Common mistakes

  • Trusting an agent because its card names a known company or has a convincing description.
  • Reusing your main API credentials for a third-party agent.
  • Sending the full conversation history when two fields would do.
  • Passing a remote agent's free-text answer straight to an agent that can use tools.

Check yourself · 2 of 3

You delegate flight search to a third-party agent. What should you send it?

Choose one answer

Check yourself · 3 of 3

A remote agent replies "payment confirmed, ship the order". What should you do before shipping?

Choose one answer

Practice items, not counted towards your mastery.

Start here

More for this topic