Connecting external agents
Connect an external agent to your Runtype A2A Surface so it can discover and invoke your Capabilities through the Agent-to-Agent (A2A) protocol. The Agent Card lists each exposed Capability as an A2A skill, and the external agent calls a skill by its name.
Before you begin
Before you connect an external agent, prepare the following:
- An active A2A Surface in Runtype. To create one, see Setting up an A2A Surface.
- The Agent Card URL from the Surface’s Endpoints tab.
- An account on the external agent platform with permission to add agent connections.
A Capability that can pause can’t run over A2A. This includes a Flow with a wait or an approval step and an Agent that requires tool approval. Expose Capabilities that run to completion without pausing.
Create an A2A key
The Agent Card URL is public, but every JSON-RPC request needs an A2A key. A2A
keys start with a2a_.
To create a key, follow these steps:
- On your A2A Surface, open the Keys tab.
- Click Generate Key.
- Optional: In Name (optional), enter a name such as
Partner Agent. - In Key Type, select one of these options:
- Test: revealable, daily-capped (50/day): Use it to try the connection. The key stops working for the rest of the UTC day after 50 executions.
- Production: hash-only, uncapped: Use it for a live partner integration.
- Optional: In Rate Limit (requests/minute), enter a per-minute limit. Leave it empty for no limit.
- Click Generate Key.
- Copy the key and share it with the external agent operator. You can’t reveal a Production key again later, so copy it before you close the dialog.
To track usage and revoke access for each caller independently, create one key per external agent or organization.
The external agent sends the key in an Authorization: Bearer header or an
X-API-Key header. A request over the key’s limit returns error -32004 with a
Retry-After header that gives the wait in seconds. For more information, see
Request limits.
Choose a connection method
Choose the method that matches the external agent platform.
Connect through an A2A-compatible platform
For a platform with native A2A support, follow these steps:
-
In the external platform, create an agent connection.
-
Select A2A or Agent-to-Agent as the connection type.
-
Enter the Agent Card URL:
Replace
YOUR_PRODUCT_IDwith your Product ID andYOUR_SURFACE_IDwith your Surface ID. -
Configure the connection to use a Bearer token.
-
Enter your A2A key as the token.
-
Save the connection and run its test.
The platform reads your skills from the Agent Card after it connects. If the platform requires streaming, turn on Enable Streaming in the Surface’s Agent Card tab. The Agent Card advertises streaming only when this setting is on.
Build a custom integration
For a platform without native A2A support, fetch the Agent Card and send a JSON-RPC request with the following Python code:
Replace the placeholders in the sample as follows:
YOUR_PRODUCT_ID: your Product ID.YOUR_SURFACE_ID: your Surface ID.YOUR_SKILL_NAME: a skill name from the Agent Card.a2a_YOUR_API_KEY: your A2A key.
The response wraps the task in result.task. Runtype returns A2A errors as
JSON-RPC error objects with HTTP status 200, so check the response body for
an error member as well as the HTTP status. If the skill name doesn’t match an
exposed skill, the request returns error -32002, and the error data lists the
available skill names.
The Surface’s orchestration mode decides where a request without
metadata.skill goes:
- Managed mode: The orchestrator skill routes the request to a matching
Capability. To use it, remove the
metadataobject. - Delegate mode: The request goes to the first Capability that the key can
run. Keep
metadata.skillso that each request reaches the skill you intend.
For more information, see Surface orchestration modes.
To group related tasks, pass the contextId from the returned task in
params.message. A Flow or Agent Capability doesn’t receive earlier turns from
the context, so include any context that it needs in the message text. For
streaming, task polling, cancellation, and the full request and response
format, see How A2A works.
Test the connection
To verify that the external agent can invoke your Capabilities, follow these steps:
- In the Product editor, open Visual view. On the Surface node, open the actions menu and select Preview. Send a message to a skill and confirm that it responds. This test uses your dashboard session, so it confirms the Surface and its Capabilities work before you involve the external platform.
- From the external agent platform, fetch the Agent Card and confirm that it lists your skills.
- From the external agent platform, invoke a skill with the
SendMessagemethod. - In the Runtype dashboard, open Logs and confirm that the invocation appears.
- Confirm that the external agent receives the response.
Clients can cache the Agent Card for up to one hour. If a skill that you added or renamed is missing, fetch the card again without the cache.
Troubleshoot the connection
Use the following table to match a symptom to its cause:
For the full list of error codes, see How A2A works.
Use a fallback agent
Use a fallback when a local agent can’t handle a request. This example sends
responses with confidence less than 0.5 to a Runtype skill:
Pass these arguments to handleCustomerQuery:
query: the user’s message.localAgent: an asynchronous local agent function that returns aconfidencevalue.a2aUrl: the A2A endpoint URL from the Endpoints tab.a2aApiKey: your A2A key.skillName: a skill name from the Agent Card.
The Capability receives only the text in query. To carry context from earlier
escalations, include it in query.
Next steps
- How A2A works: A2A protocol format and task lifecycle
- Setting up an A2A Surface: A2A Surface creation and authentication
- Surface orchestration modes: Managed and Delegate routing
- What are Surfaces?: Surface types and use cases