Skip to main content
Use the Agents Gateway to connect A2A Protocol agents in both directions:

Call an external agent

Register a remote A2A endpoint, then invoke it through the AI Gateway Responses API with model: "agent/<key>".

Expose an internal Agent

Give A2A clients a per-Agent endpoint backed by an internal Orq.ai Agent.
Both directions use Orq.ai API keys, project scope, rate limits, and traces.

Connect an external A2A agent

Registering an external Agent fetches and validates its Agent Card before saving the connection. Orq.ai caches the card for display and discovery metadata, while each invocation discovers the current card before selecting a transport.

Register through AI Studio

1

Open the Agent creator

Open a Project or folder in AI Studio, select , select Agent, then select Connect External Agent.
2

Enter the connection

Enter an Agent key, display name, Agent URL, and optional Agent Card URL. Leave the protocol version and preferred transport empty to select a compatible interface from the card automatically.
3

Add authentication headers

Add up to 20 outbound headers. Keep Encrypt enabled for credentials and other secrets.
4

Create the Agent

Select Create agent. Registration succeeds only when the Agent Card is reachable, valid, and advertises the requested protocol and transport.
Open the external Agent in Agent Studio to edit its connection, select Test connection, or refresh the cached Agent Card. Publish connection edits before testing because the test uses the stored configuration. A connection test fetches the live card without persisting it. Refreshing the card replaces the cached metadata for the stored connection.

Register through the API

Use an API key with the a2a.create permission:
cURL
Omit card_url to discover the card from agent_url. Omit protocol_version and preferred_transport to select the first compatible interface advertised by the card.
Encrypted header values are encrypted at rest and returned as empty strings from read operations. When updating an existing encrypted header, send an empty value to preserve the stored secret. Send the complete desired headers map because the update replaces the map.
Manage external Agents with these endpoints: List requests accept limit, starting_after, and ending_before. Do not send both cursor fields in the same request. Update a connection and revalidate it:
cURL
Test or refresh the saved connection:

Invoke an external Agent

Call a registered external Agent through the standard Responses API. Keep the agent/ model prefix:
cURL
The AI Gateway maps text, image URLs, file URLs, and base64 file input into A2A message parts. Remote text artifacts become Responses API assistant messages. Structured A2A data parts become JSON text. Token usage is reported as zero because the remote Agent does not provide Orq.ai model usage.

Stream output

Set stream: true to receive standard Responses API server-sent events:
cURL
When the live Agent Card advertises streaming, the gateway maps A2A artifact and status updates to Responses API events. When the card does not advertise streaming, the gateway completes a blocking A2A call and emits a compatible synthetic Responses stream.

Continue an interrupted task

When a remote task returns input_required or auth_required, the Responses API returns an incomplete response. Pass that response ID as previous_response_id to continue the same A2A context:
cURL
The gateway keeps the remote context and task identifiers private. Store the Orq.ai response by leaving response storage enabled before using previous_response_id.

External Agent limits in v1

External execution in v1 uses a narrow contract:
  • The remote A2A mapping supports input, stream, and previous_response_id. Gateway-managed controls such as response storage still apply.
  • Accepted input: a string or user messages containing text, image URLs, file URLs, or base64 file data.
  • Unsupported request controls include caller-supplied tools, tool_choice, retries, fallbacks, load balancing, sampling parameters, background mode, and non-default output shaping.
  • instructions are not applied to the remote Agent. Configure its behavior at the remote endpoint.
  • Remote file output parts are not mapped in v1. Return text or structured data parts.
  • Failed and rejected A2A tasks map to failed Responses. Canceled tasks map to canceled Responses. Input-required and auth-required tasks map to incomplete Responses.

Expose an internal Agent through A2A

Every internal Orq.ai Agent has an A2A endpoint. Open the Agent in Agent Studio, expand Expose via A2A, then copy the Agent URL, Agent Card URL, and required a2a.execute permission.
Do not use an external Agent registration as an ingress endpoint. Only internal Orq.ai Agents can be exposed through the A2A gateway.

Discover the Agent Card

Fetch the standard Agent Card path with a scoped Orq.ai API key:
cURL
The card advertises A2A 1.0 JSON-RPC, HTTP + JSON, and gRPC interfaces, text input and output, streaming support, bearer authentication, and the Agent’s published skills.

Send a JSON-RPC message

The base endpoint defaults to the A2A 0.3 compatibility contract when A2A-Version is absent. Set A2A-Version: 1.0 for the A2A 1.0 contract.
Unsupported A2A-Version values return 400.

Use another A2A transport

Send the API key as Authorization: Bearer <token> for HTTP, Connect, and gRPC metadata. The API key must include a2a.execute and access to the Agent’s Project. Authentication, project scope, quota, and rate limits apply before execution.

Ingress limits in v1

  • Blocking and streaming message execution are supported.
  • Task retrieval and task listing are supported for stored Responses that belong to the routed Agent.
  • Non-blocking execution is not supported.
  • Task cancellation and task subscriptions are not supported.
  • Push notification configuration and extended Agent Cards are not supported.
  • Agent Cards advertise streaming: true and pushNotifications: false.

Security controls

External Agent registration and execution apply the following controls:
  • HTTPS is required for Agent, card, and advertised interface URLs.
  • Loopback, private, link-local, metadata, and unique-local network targets are blocked before connection, including alternate numeric IP forms and DNS answers that resolve to blocked ranges.
  • Redirects are not followed.
  • Agent Card size and fetch time are bounded.
  • Encrypted headers are masked at API boundaries. Runtime trace headers are managed by Orq.ai and cannot be overridden by stored connection headers.
  • Stored headers are sent only to interfaces on the configured agent or card origin. Other advertised interfaces are validated, then excluded before transport selection.
  • Project-scoped API keys can only manage, invoke, or expose Agents in allowed Projects.
Plain HTTP is available only for localhost development when both ENVIRONMENT is local or development and A2A_ALLOW_HTTP_LOCALHOST is true. Keep this setting disabled in deployed environments.

Self-hosted configuration

Set every duration, byte limit, and header limit to a positive integer. In deployed environments, set A2A_PUBLIC_BASE_URL to the public AI Gateway HTTP origin and A2A_GRPC_PUBLIC_URL to an externally reachable native gRPC target such as agents.example.com:443 or dns:///agents.example.com:443. Do not include http:// or https:// in the gRPC target; clients configure gRPC transport security separately. For authenticated ORQ-to-ORQ gRPC, expose the target through the same public HTTPS host and port as the configured agent or card URL so origin-bound stored headers remain eligible for that interface.