Skip to main content
Version: Dev

Control Agent Access

For Agent-to-Agent (A2A) traffic, each caller API key defines which registered agents that caller can reach. AISIX denies agent calls and agent-card discovery unless the key's allowed_agents grant covers the agent's registered name.

Use separate grants when clients sharing a gateway need access to different upstream agents. AISIX applies the same matching and rejection behavior regardless of how the key is managed.

Prerequisites​

  • Complete Set Up Agent Gateway.
  • For AISIX Enterprise or AISIX Cloud, retain the environment, caller key, and registered test agent.
  • For AISIX OSS, retain the complete resources file containing the caller key and test agent.
  • Keep the shell, gateway, and test agent running if you want to verify a changed grant.

How Agent Access Works​

allowed_agents is a list of agent-name patterns on the caller API key. When the field is omitted, null, or an empty list, the key has no A2A agent access.

Each pattern is matched against the agent's registered name:

EntryGrantsExample
Exact nameOne agent.invoice-processor grants only that agent.
Name patternAgents whose names match one * wildcard.invoice-* grants every agent whose name starts with invoice-.
*Every registered agent.* grants current and future agents.

Choose exact names for the narrowest access. Use * only for a caller that may reach every current and future agent.

The matcher is the same single-* glob matcher used by MCP tool patterns. An entry can contain at most one *.

AISIX Enterprise and AISIX Cloud reject an entry with two or more asterisks with HTTP 400. An AISIX OSS resources file accepts the entry, but it grants nothing.

Configure Agent Access​

Set the complete list of agents that the caller should keep. The control plane stores the grant on the API key resource; an open-source AISIX gateway reads it from resources.yaml.

Update the caller key in the environment where it is used.

  1. Open the environment and select API keys.

  2. Select Edit on the caller key. Under A2A agent access, configure the complete grant the caller should retain:

    • For exact access, select the listed agents.

      Exact A2A agent grant with echo-agent selected
    • For a name pattern, expand Advanced — exact agent names. Enter one exact name or single-wildcard pattern per line. For example, invoice-* grants agents whose names start with invoice-.

      Advanced A2A access with an invoice wildcard pattern
    • For access to every current and future agent, select All A2A agents.

      All A2A agents enabled for a caller
  3. Select Save changes.

To revoke all A2A access, clear All A2A agents, then clear any remaining agent selections and advanced patterns. Confirm that the form reports no agent access, then select Save changes.

Empty A2A grant with the no-access message visible

How Enforcement Works​

The gateway checks the grant after confirming that the agent exists and is enabled. It performs the check before contacting the upstream agent for both A2A calls and agent-card discovery:

  • JSON-RPC calls to /a2a/<agent>.
  • Agent-card requests to /a2a/<agent>/.well-known/agent-card.json.

The caller-visible outcome depends on the agent and key state:

  • An unknown or disabled agent returns 404.
  • A known agent outside the key's grant returns 403 before AISIX contacts the upstream agent.
  • A known agent covered by the key's grant is forwarded upstream.

Because the existence check runs first, an authenticated caller can distinguish an agent it cannot access from an agent that does not exist.

Next Steps​

You have now scoped which agents a caller API key may reach. Use these guides to complete the caller and upstream control path: