Skip to content

Agent2Agent protocol

The Agent2Agent (A2A) protocol enables interoperability between AI agents. By registering an external agent in the DataRobot model registry and attaching an agent card, you make the agent available for discovery.

This page outlines the end-to-end workflow, summarized below:

  1. Register an external model in the Model Registry.
  2. Create an external prediction environment.
  3. Deploy the registered model version.
  4. Upload an agent card to the deployment.

After completing these steps, the agent is available for A2A interactions within DataRobot.

前提条件

import datarobot as dr

# Authenticate with the DataRobot API
dr.Client(token="YOUR_API_TOKEN", endpoint="https://app.datarobot.com/api/v2") 

外部モデルの登録

Use RegisteredModelVersion.create_for_external to create a registered model version for an external agent. The target parameter uses the ExternalTarget type dict.

DataRobot provides a dedicated target type for agents — set type to "AgenticWorkflow".

import datarobot as dr

registered_model_version = dr.RegisteredModelVersion.create_for_external(
    name="My A2A Agent v1",
    target={"name": "target", "type": "AgenticWorkflow"},
    registered_model_name="My A2A Agent",
)

registered_model_version.id
>>> '66a1b2c3d4e5f6a7b8c9d0e1'
registered_model_version.registered_model_id
>>> '66a1b2c3d4e5f6a7b8c9d0e2' 

If you already have a registered model and want to add a new version, pass registered_model_id instead of registered_model_name:

new_version = dr.RegisteredModelVersion.create_for_external(
    name="My A2A Agent v2",
    target={"name": "target", "type": "AgenticWorkflow"},
    registered_model_id=registered_model_version.registered_model_id,
) 

Refer to the Model Registry documentation for additional details on managing registered models.

Create an external prediction environment

External agentic workflow models must be deployed to an external prediction environment. Deploying to a regular DataRobot prediction server is not supported and will result in a 422 error.

Use PredictionEnvironment.create to create an external prediction environment. Choose a platform value that matches where your agent is hosted (e.g. "aws", "gcp", "azure", or "other").

import datarobot as dr
from datarobot.enums import PredictionEnvironmentPlatform

prediction_environment = dr.PredictionEnvironment.create(
    name="A2A Agent Environment",
    platform=PredictionEnvironmentPlatform.OTHER,
    description="External prediction environment for A2A agents",
)

prediction_environment.id
>>> '66a0b1c2d3e4f5a6b7c8d9e0' 

If you already have a suitable external prediction environment, you can reuse it:

prediction_environments = dr.PredictionEnvironment.list()
prediction_environment = prediction_environments[0] 

登録されたモデルのデプロイ

Use Deployment.create_from_registered_model_version to create a deployment from the registered model version. Pass prediction_environment_id (not default_prediction_server_id) — this is required for agentic workflow targets.

import datarobot as dr

deployment = dr.Deployment.create_from_registered_model_version(
    model_package_id=registered_model_version.id,
    label="My A2A Agent Deployment",
    description="External A2A agent deployment",
    prediction_environment_id=prediction_environment.id,
)

deployment.id
>>> '66b2c3d4e5f6a7b8c9d0e1f2' 

Refer to the Deployments documentation for more information on deployment management.

Upload an agent card

Use Deployment.upload_agent_card to attach an A2A agent card to the deployment. The agent card is a dictionary describing the agent's capabilities and metadata, following the A2A Agent Card specification.

agent_card = {
    "name": "My A2A Agent",
    "description": "An agent that performs data analysis tasks.",
    "version": "1.0.0",
    "url": "https://my-agent.example.com/a2a",
    "capabilities": {
        "streaming": True,
        "pushNotifications": False,
    },
    "skills": [
        {
            "id": "data-analysis",
            "name": "Data Analysis",
            "description": "Analyzes datasets and provides statistical summaries.",
        }
    ],
}

uploaded_card = deployment.upload_agent_card(agent_card) 

After uploading, the agent is available in the DataRobot registry as an A2A agent.

Retrieve an agent card

Use Deployment.get_agent_card to fetch the agent card from an existing deployment:

agent_card = deployment.get_agent_card()
agent_card["name"]
>>> 'My A2A Agent' 

Delete an agent card

Use Deployment.delete_agent_card to remove the agent card from a deployment. This operation is idempotent — it returns successfully even if no agent card exists.

deployment.delete_agent_card() 

Discover A2A agent deployments

Use the is_a2a_agent filter on DeploymentListFilters to list only deployments that have an A2A agent card:

import datarobot as dr
from datarobot.models.deployment import DeploymentListFilters

filters = DeploymentListFilters(is_a2a_agent=True)
a2a_deployments = dr.Deployment.list(filters=filters)
a2a_deployments
>>> [Deployment('My A2A Agent Deployment'), Deployment('Another A2A Agent')] 

You can then retrieve the agent card from any discovered deployment to learn about its capabilities before initiating an A2A interaction:

for dep in a2a_deployments:
    card = dep.get_agent_card()
    print(f"{card['name']} (v{card['version']}): {card['description']}") 

Full example

The following example demonstrates the complete flow of registering an external A2A agent:

import datarobot as dr
from datarobot.enums import PredictionEnvironmentPlatform
from datarobot.models.deployment import DeploymentListFilters

# 1. Connect to DataRobot
dr.Client(token="YOUR_API_TOKEN", endpoint="https://app.datarobot.com/api/v2")

# 2. Register an external model
registered_model_version = dr.RegisteredModelVersion.create_for_external(
    name="Research Assistant Agent v1",
    target={"name": "target", "type": "AgenticWorkflow"},
    registered_model_name="Research Assistant Agent",
)

# 3. Create an external prediction environment
prediction_environment = dr.PredictionEnvironment.create(
    name="A2A Agent Environment",
    platform=PredictionEnvironmentPlatform.OTHER,
    description="External prediction environment for A2A agents",
)

# 4. Deploy the registered model
deployment = dr.Deployment.create_from_registered_model_version(
    model_package_id=registered_model_version.id,
    label="Research Assistant Agent",
    description="An A2A agent that assists with research tasks.",
    prediction_environment_id=prediction_environment.id,
)

# 5. Upload the agent card
agent_card = {
    "name": "Research Assistant",
    "description": "Assists with literature review, summarization, and citation management.",
    "version": "1.0.0",
    "url": "https://research-agent.example.com/a2a",
    "capabilities": {
        "streaming": True,
        "pushNotifications": False,
    },
    "skills": [
        {
            "id": "literature-review",
            "name": "Literature Review",
            "description": "Searches and summarizes academic papers on a given topic.",
        },
        {
            "id": "citation-management",
            "name": "Citation Management",
            "description": "Formats and organizes citations in various styles.",
        },
    ],
}
deployment.upload_agent_card(agent_card)

# 6. Verify the agent is available for A2A protocol
filters = DeploymentListFilters(is_a2a_agent=True)
a2a_deployments = dr.Deployment.list(filters=filters)
for dep in a2a_deployments:
    card = dep.get_agent_card()
    print(f"{card['name']} (v{card['version']}): {card['description']}")