Skip to content

A2A (Agent-to-Agent)

A2A (Agent2Agent) is an open protocol that lets one agent platform call agents hosted on another. Every VirtuAI agent can be reached over A2A while its A2A switch is on. A caller finds the agent through its Agent Card, then sends it messages with an OAuth 2.0 token you control.

Use A2A to add a VirtuAI agent to Gemini Enterprise, or to call it from your own services.

The A2A switch is in the agent’s Channels tab, and it’s on by default. While it’s off, the agent’s Agent Card and endpoint answer 404, even to a caller that holds a valid token. With versioning, the switch waits for Publish.

Protocol versions A2A 1.0 and 0.3, on the same endpoint
Transport JSON-RPC 2.0 over HTTPS, with streaming
Input Text and files: a file’s bytes in the message, or a link to it
Output Text, and files the agent shares
Push notifications Not supported
Authentication OAuth 2.0 authorization code (with optional PKCE), client credentials and refresh token
Scope a2a:invoke: send messages to the agent and read its tasks

Under Integration URLs, at the bottom of the agent’s Channels tab, you’ll find:

Item URL Needs a token
A2A Agent Card https://<your-virtuai-host>/a2a/<agent-id>/.well-known/agent-card.json No
A2A Endpoint (JSON-RPC) https://<your-virtuai-host>/a2a/<agent-id> Yes

The Agent Card is public on purpose: callers read it before they authenticate. It describes the agent’s name, description and skills, and where to get a token. It never gives access by itself.

Most platforms ask for the card URL. Some ask for the endpoint instead.

Each service that calls your agents gets its own client.

  1. Open Settings, select SSO, A2A and CLI, and find A2A Clients.

  2. Enter the name of the consuming service, for example Gemini Enterprise, and select Create client.

  3. Copy the Client ID, Client secret, Token URL and Scopes. Then select I’ve copied the secret.

A client created here can call every agent in the workspace. Its sign-in redirects are limited to Gemini Enterprise’s redirect addresses.

2. Register the agent in the other platform

Section titled “2. Register the agent in the other platform”

Give the consuming service:

Field Value
Agent Card URL The agent’s A2A Agent Card URL
Authorization URL https://<your-virtuai-host>/a2a/oauth/authorize
Token URL https://<your-virtuai-host>/a2a/oauth/token
Client ID and secret From step 1
Scope a2a:invoke

For Gemini Enterprise, see Google’s guide to registering an A2A agent.

On behalf of a person (authorization code). This is what Gemini Enterprise uses. The first time someone uses the agent, they’re sent to VirtuAI and sign in. An Authorize access page shows which service is asking and what it may do. They select Allow or Deny. If they aren’t signed in yet, they sign in, with a password or SSO, and come straight back to the Authorize access page. People with the chat-only webapp_viewer role can authorize too.

If the agent’s tools act on that person’s own accounts, such as Gmail or Drive, the page lists them under These agents also act on your accounts. They can Connect each one now, or wait until the agent needs it.

After they allow access, the agent runs as that person, with their connected accounts. Access tokens last 1 hour. Refresh tokens last 30 days and are replaced each time they’re used. One consent lasts at most 90 days, however often it is refreshed; after that the person signs in and allows access again. If the person leaves the workspace or their account is deactivated, the connection they authorized stops working on its next request.

As a service (client credentials). A backend service with no person behind it trades its client ID and secret at the token URL for a 1-hour access token. It doesn’t need the authorization URL or PKCE.

Send the token on every call:

POST /a2a/<agent-id> HTTP/1.1
Host: <your-virtuai-host>
Authorization: Bearer <access-token>
Content-Type: application/json

When the agent wants to run a command, or use a tool that can change something, it asks the caller’s end user first. The task moves to input-required, and its status message is the question as plain text, in English. Gemini Enterprise shows it in its own input form:

Run: make deploy
1 once · 2 this conversation · 3 60 min · 4 always · 5 deny
Reply with the number · only you can answer · expires in 10 min

It is three lines because that box shows about five. Only the answers the request offers are listed, and each number always means the same answer. The question appears only there, not in the reply as well. The request itself is in the message’s metadata.approval_requests, one entry per waiting approval:

{"type": "approval_request", "approval_id": "…", "kind": "command", "tool": null,
"summary": "make deploy", "timeout_secs": 600,
"scopes": ["once", "conversation", "timed", "always"], "timed_minutes": 60}

A message/stream ends at that input-required event, which A2A 0.3 marks final: true. message/send returns there too. The turn doesn’t stop: it waits for the answer on the server. Answer with a new message on the same task, or in the same contextId. The answer can be the number on its own (2, 2. and 2 all count), one of the typed answers below, or a data part:

{"type": "approval_decision", "approval_id": "…", "approved": true, "scope": "conversation"}

The number or words can come as a text part or as a string inside a data part. Anything else approves nothing, including a message that only confirms, like “Action Confirmed”. The reply asks the question again, and the task goes back to input-required so the form comes back.

The person who answers is always the A2A caller, never anything in the payload. If you answer with message/stream, that stream carries the rest of the turn as a new artifact: how the approval ended, the tool’s result, and the final answer. It sends only status and artifact updates, never the task again, since your client already has it. It ends when the task completes, or at input-required if the agent asks again. If you answer with message/send, it returns at the same point. Answering an approval that has already ended gets a short reply that says how it ended.

The question isn’t drawn a second time as a card with buttons in the reply: in Gemini Enterprise, its own form is the one place to answer. This doesn’t affect the progress cards a reply shows while the agent works.

scope is optional and works like web chat’s approval card:

scope What it approves
once (the default) This call only.
conversation This call and every later one in the same contextId, across tasks.
timed Every call for duration_minutes (60 if not sent, at most 1440), in any conversation.
always Every call, in any conversation, until an editor of the agent revokes it.

A denial is always for that one call. A broader approval only covers the same person on the same agent over A2A. A caller with no signed-in person is identified by its contextId, so for it timed and always reach no further than that conversation. People who can edit the agent can see and revoke these approvals under Standing approvals, in the agent’s Security tab. When the caller acts for a signed-in person, an approval that person gave in web chat also counts here.

Besides the numbers, people can type the answer, in English or Spanish, without worrying about case or accents:

Answer Typed
Once approve, yes, ok, aprobar, sí
This conversation approve conversation, approve all, aprobar conversación, aprobar todo, esta conversación
60 minutes approve 60 min, 60 min, aprobar 60, aprobar 60 minutos
Always approve always, always, aprobar siempre, siempre
Deny deny, no, rechazar

If several approvals are waiting on the task (the agent made parallel calls), a plain approve or deny (1 or 5) can’t say which one it’s for, so send one approval_decision per approval. An answer for the conversation, 60 minutes or always (2, 3, 4, or typed) is about all of them, so it approves every approval waiting on the task. Anything else the person writes while an approval waits gets a reminder, and doesn’t start a new turn. The reply says what was approved, for example “Approved for this conversation — running it.”

With no answer within 10 minutes, the approval expires and nothing is run. The Agent Card declares this under the extension https://imvirtuai.com/a2a/extensions/approvals/v1.

In Settings > SSO, A2A and CLI > A2A Clients, select the trash icon next to a client and confirm. Its tokens stop working immediately, and any service using it loses access.

  • A token only works for agents in the workspace that issued it.
  • Files can be sent in the message itself or as a link. VirtuAI fetches a link only from a public internet address, without following redirects. A file that can’t be received is named to the agent, and a message that is only files that can’t be received fails with “The attached files could not be received: …”. Files go into the agent’s working folder, and images and PDFs also go to its model when it can read them. See Files and voice notes.
  • The Agent Card lists the file types the agent accepts, so a caller that honors it forwards people’s attachments.
  • Commands and tools that can change something wait for the end user’s approval. See Approvals and Command approvals.

401 “Missing bearer credential” or “Invalid credential” : The call has no token, or the token expired or was revoked. Get a new one.

403 “Credential is not authorized for this agent” : The token belongs to another workspace than the agent.

The consuming service can’t finish the sign-in : Its redirect address isn’t one VirtuAI allows for this client. Clients created in Settings only allow Gemini Enterprise’s addresses. Contact Support for other platforms.

404 “Agent not found” : Check the agent ID in the URL, and that the agent is active and published.

404 “… is not available over A2A” : The agent’s A2A switch is off. Turn it on in the agent’s Channels tab, and publish if the agent uses versioning.