Skip to main content
Version: Dev

Set Up Agent Gateway

AISIX exposes registered Agent-to-Agent (A2A) agents through caller-authenticated gateway endpoints at /a2a/<agent>. This setup connects an official A2A echo agent to an existing AISIX gateway and grants a test caller access. The official A2A Go SDK client then sends an A2A 1.0 message through the gateway.

The local Docker topology applies when the AISIX gateway container can join the test agent's network. This can be an AISIX Enterprise, AISIX Cloud, or AISIX OSS gateway. If a managed gateway cannot join that network, deploy the same echo server at an HTTPS endpoint the gateway can reach, then use that endpoint in the registration steps. This guide's AISIX OSS path uses the Docker quickstart topology.

After registration, every product path uses the same agent-card readiness check and SDK client call to verify the result.

Prerequisites​

Before starting, prepare the following:

  • Docker, cURL, and jq.
  • For AISIX Enterprise, complete the AISIX Enterprise getting-started guide, then keep its shell and aisix-dp gateway running.
  • For AISIX Cloud, obtain an environment, attached gateway, caller API key reserved for this example, and gateway URL from your organization.
  • If you use the Dashboard to configure AISIX Enterprise or AISIX Cloud, sign in with permission to manage A2A agents and caller API keys.
  • If you use the Admin API to configure AISIX Enterprise or AISIX Cloud, obtain a write-scoped admin token and the environment and caller API key resource IDs.
  • For AISIX OSS, complete the AISIX OSS getting-started guide, then remain in its shell and working directory with the aisix-quickstart gateway running.

Start an A2A Test Agent​

The example runs the echo server provided by the official A2A Go SDK in Docker. When the AISIX gateway also runs in Docker, the agent and gateway join a temporary network, so the gateway can reach the agent without a restart. Use the echo server only for testing: it has no authentication and returns the caller's message text. The server publishes a dual A2A 0.3 and 1.0 compatibility card for checking client-facing discovery through AISIX. The SDK client example passes the test caller credential into this container; use a disposable caller key and remove the test container when finished.

Export the gateway origin, caller key plaintext, and gateway container name:

# Gateway origin only; omit a trailing slash and endpoint path.
export AISIX_PROXY="YOUR_AISIX_GATEWAY_URL"
export AISIX_API_KEY="YOUR_CALLER_API_KEY"
# The Enterprise quickstart uses aisix-dp. Use the actual name for another Docker deployment.
export AISIX_GATEWAY_CONTAINER="aisix-dp"

If the managed gateway cannot join the local Docker network, run the same a2a-go command on a platform or host that exposes port 8080 through HTTPS. Export the complete public A2A JSON-RPC endpoint:

export A2A_AGENT_URL="https://YOUR_ECHO_AGENT_HOST"

Then skip the remaining local-network commands in this section and continue with Register the Agent and Grant Access.

Create a temporary network and connect the running gateway to it:

docker network create aisix-a2a
docker network connect aisix-a2a "$AISIX_GATEWAY_CONTAINER"

Start the echo agent on the same network. The pinned Go SDK is downloaded and compiled inside the container, so the first startup can take about a minute:

docker run -d --name aisix-a2a-echo \
--network aisix-a2a \
golang:1.25-alpine \
sh -c 'go run github.com/a2aproject/a2a-go/v2/cmd/a2a@v2.5.0 \
serve --echo --card-compat --host 0.0.0.0 --port 8080 \
--transport jsonrpc --protocol latest --name "AISIX A2A Echo"'

Wait until the agent is ready:

for attempt in $(seq 1 120); do
docker logs aisix-a2a-echo 2>&1 | grep -q "Listening on" && break
sleep 1
done

docker logs aisix-a2a-echo 2>&1 | grep "Listening on"

The final command prints the listener address. From the gateway container, the agent is available at http://aisix-a2a-echo:8080.

export A2A_AGENT_URL="http://aisix-a2a-echo:8080"

Register the Agent and Grant Access​

The examples name the agent echo-agent, pin it to A2A 1.0, and grant it to the existing test caller.

Register the organization-level agent, expose it to the test environment, then grant access to the caller key.

  1. Open A2A agents and select New A2A agent.
  2. Set Name to echo-agent and URL to the value of A2A_AGENT_URL.
  3. Select 1.0 for Protocol version and None for Authentication.
  4. Under Available in environments, select the environment attached to the test gateway.
New A2A agent form with echo-agent, A2A 1.0, no upstream authentication, and an environment selected
  1. Select Register A2A agent. Confirm that the saved agent is enabled and exposed to the intended environment.
Registered echo-agent showing its protocol, authentication mode, enabled status, and environment
  1. Open the environment and select API keys. Select Edit on the test caller.
  2. Under A2A agent access, select echo-agent, then select Save changes.
A2A agent access controls with echo-agent selected for the caller

Use the caller key plaintext for verification:

export AISIX_A2A_KEY="$AISIX_API_KEY"

Verify with an A2A Client​

The agent-card readiness check is the same for every path. First, wait until the gateway can fetch the registered agent's card. This preserves the projection tolerance needed by the control plane without sending a handcrafted JSON-RPC message:

for attempt in $(seq 1 45); do
curl -fsS \
"$AISIX_PROXY/a2a/echo-agent/.well-known/agent-card.json" \
-H "Authorization: Bearer $AISIX_A2A_KEY" \
>/dev/null 2>&1 && break
sleep 2
done

curl -fsS \
"$AISIX_PROXY/a2a/echo-agent/.well-known/agent-card.json" \
-H "Authorization: Bearer $AISIX_A2A_KEY" \
>/dev/null

Set the agent URL that the client can reach.

For a local Docker gateway, the quickstart and generated Docker configurations use port 3000 inside the gateway container:

export AISIX_A2A_URL="http://${AISIX_GATEWAY_CONTAINER}:3000/a2a/echo-agent"

Run the command-line client from the official A2A Go SDK inside the echo-agent container. --transport jsonrpc connects directly to the registered AISIX endpoint instead of resolving an agent card first:

docker exec aisix-a2a-echo \
go run github.com/a2aproject/a2a-go/v2/cmd/a2a@v2.5.0 \
send "$AISIX_A2A_URL" "Hello through AISIX" \
--transport jsonrpc \
--auth "Bearer $AISIX_A2A_KEY" \
--output json | jq -e \
'.artifacts[].parts[] | select(.text == "Hello through AISIX")'

When the gateway is not on the local Docker network, use its public origin and run the same client in a temporary container:

export AISIX_A2A_URL="${AISIX_PROXY}/a2a/echo-agent"

docker run --rm \
-e AISIX_A2A_URL \
-e AISIX_A2A_KEY \
golang:1.25-alpine \
sh -c 'go run github.com/a2aproject/a2a-go/v2/cmd/a2a@v2.5.0 \
send "$AISIX_A2A_URL" "Hello through AISIX" \
--transport jsonrpc \
--auth "Bearer $AISIX_A2A_KEY" \
--output json' | jq -e \
'.artifacts[].parts[] | select(.text == "Hello through AISIX")'

The command prints the matching artifact part. AISIX authenticated the caller, checked its agent grant, and forwarded the SDK client's A2A 1.0 request to the echo agent.

Adapt the Setup for Your Agent​

Replace the test URL with an A2A JSON-RPC endpoint reachable from the gateway. Set protocol_version to the wire format the agent supports, and send requests in that format. AISIX supports "1.0" and "0.3" but does not translate between them.

Configure a required upstream credential with auth_type and secret. See Upstream Authentication.

For AISIX Enterprise or AISIX Cloud, save the updated registration through the dashboard or Admin API; the control plane projects it to attached gateways automatically.

For AISIX OSS, validate the complete resources file and send SIGHUP when the running gateway already has every referenced environment variable. If you add or change an environment variable, recreate the container with the new value. See Reload a Resources File.

Clean Up​

Keep the agent and caller grant if you plan to continue with the other Agent Gateway guides. Otherwise, remove the resources through the same management path you used to create them.

Remove the caller grant before deleting the shared agent registration.

  1. Open the environment and select API keys.
  2. Select Edit on the test caller, clear echo-agent from A2A agent access, and select Save changes.
  3. Open A2A agents, select Delete on echo-agent, and confirm the deletion.
Confirmation before deleting the echo-agent registration

Finally, remove the echo agent used for this guide.

If you deployed the echo server outside the local Docker network, remove it from that platform or host.

For a local Docker gateway, remove the test container and temporary network:

docker rm -f aisix-a2a-echo
docker network disconnect aisix-a2a "$AISIX_GATEWAY_CONTAINER"
docker network rm aisix-a2a

Next Steps​

You have now registered an A2A agent, granted caller access, and sent an A2A 1.0 message through AISIX with the official SDK client. Use these guides to extend the setup: