Expose Agents through A2A on n8n cloud

How can I expose my agents through A2A for outside world in n8n cloud.

@Gaurav_Sinha

To expose your n8n agents for A2A communication on n8n cloud, you must transform your workflow into a secure API service using a Webhook node as the entry point. Configure the webhook to use the POST method and set the “Response Mode” to When Last Node Finishes so that the external agent receives the actual AI response rather than a simple acknowledgment. To ensure your agent isn’t accessed by unauthorized parties, you should implement security by selecting an authentication method, such as Header Auth, which requires the calling agent to provide a valid token or API key.

Once the workflow is configured, the external agent interacts with your service by sending standard HTTP POST requests to your unique n8n webhook URL. The request should include a JSON payload containing the prompt (e.g., {"message": "your prompt"}), which your AI Agent node then processes using its connected tools and memory. After the agent generates a response, the workflow automatically sends that output back through the webhook as the HTTP response, completing the agent-to-agent exchange.

How can I generate the end point url having card.json.

n8n doesn’t generate an Agent Card for you. You can still serve one yourself with two Webhooks on your Cloud instance: one returns the card and the other is the actual A2A endpoint.

1. The card: a GET Webhook
Add a Webhook with method GET, path agent-card and Respond = Using ‘Respond to Webhook’ Node. Connect it to Respond to Webhook → Respond With: JSON:

{
  "protocolVersion": "0.3.0",
  "name": "My n8n Agent",
  "description": "What it does",
  "url": "https://YOUR.app.n8n.cloud/webhook/a2a",
  "preferredTransport": "JSONRPC",
  "version": "1.0.0",
  "capabilities": { "streaming": false },
  "defaultInputModes": ["text/plain"],
  "defaultOutputModes": ["text/plain"],
  "securitySchemes": { "apiKey": { "type": "apiKey", "in": "header", "name": "X-API-Key" } },
  "security": [{ "apiKey": [] }],
  "skills": [{ "id": "main", "name": "Main skill", "description": "...", "tags": ["n8n"] }]
}

On Cloud you can’t serve /.well-known/agent-card.json at your domain root because every webhook lives under /webhook/. Give clients the full card URL instead. The A2A SDKs let you override the card path (for example, agent_card_path in the Python A2ACardResolver).

2. The endpoint: a POST Webhook at path a2a
A2A clients send JSON-RPC, not {"message": ...}. Read the prompt from $json.body.params.message.parts, pass it to your AI Agent, then return a JSON-RPC envelope:

const req = $('Webhook').first().json.body;
return [{ json: {
  jsonrpc: '2.0',
  id: req.id,
  result: { kind: 'message', role: 'agent', messageId: $execution.id,
    parts: [{ kind: 'text', text: $json.output }] }
}}];

I reproduced the request/response shaping on a test workflow. Use Header Auth on this webhook so it matches the securitySchemes in the card.

Docs: Webhook node, Respond to Webhook

Hi @Gaurav_Sinha, use the GET webhook’s Production URL as the card URL. Your client needs to accept /webhook/agent-card instead of looking only at /.well-known/agent-card.json. Which A2A client and SDK version are you using?

For the 0.3 example above, add a Switch before the agent on {{ $json.body.method }}. Only message/send should invoke the agent. Handle tasks/get and tasks/cancel separately, returning error -32001 for unknown task IDs. Unknown methods should return -32601. Return these in the JSON-RPC error object with the original request id, so status/cancel requests don’t reach the prompt-processing path.

THanks. Able to configure A2A.