Skip to content

fix: A2A RPC URL got overriden by host and port param of adk api server #2520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions contributing/samples/a2a_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,43 @@ You can extend this sample by:
- Adding audit logging for authentication events
- Implementing multi-tenant OAuth token management

## Deployment to Other Environments

When deploying the remote BigQuery A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:

### Local Development
```json
{
"url": "http://localhost:8001/a2a/bigquery_agent",
...
}
```

### Cloud Run Example
```json
{
"url": "https://your-bigquery-service-abc123-uc.a.run.app/a2a/bigquery_agent",
...
}
```

### Custom Host/Port Example
```json
{
"url": "https://your-domain.com:9000/a2a/bigquery_agent",
...
}
```

**Important:** The `url` field in `remote_a2a/bigquery_agent/agent.json` must point to the actual RPC endpoint where your remote BigQuery A2A agent is deployed and accessible.

## Troubleshooting

**Connection Issues:**
- Ensure the local ADK web server is running on port 8000
- Ensure the remote A2A server is running on port 8001
- Check that no firewall is blocking localhost connections
- **Verify the `url` field in `remote_a2a/bigquery_agent/agent.json` matches the actual deployed location of your remote A2A server**
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server


Expand All @@ -182,3 +213,4 @@ You can extend this sample by:
- Check the logs for both the local ADK web server and remote A2A server
- Verify OAuth tokens are properly passed between agents
- Ensure agent instructions are clear about authentication requirements
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"tags": ["authentication", "oauth", "security"]
}
],
"url": "http://localhost:8000/a2a/bigquery_agent",
"url": "http://localhost:8001/a2a/bigquery_agent",
"version": "1.0.0"
}
32 changes: 32 additions & 0 deletions contributing/samples/a2a_basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,47 @@ You can extend this sample by:
- Adding persistent state management
- Integrating with external APIs or databases

## Deployment to Other Environments

When deploying the remote A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:

### Local Development
```json
{
"url": "http://localhost:8001/a2a/check_prime_agent",
...
}
```

### Cloud Run Example
```json
{
"url": "https://your-service-abc123-uc.a.run.app/a2a/check_prime_agent",
...
}
```

### Custom Host/Port Example
```json
{
"url": "https://your-domain.com:9000/a2a/check_prime_agent",
...
}
```

**Important:** The `url` field in `remote_a2a/check_prime_agent/agent.json` must point to the actual RPC endpoint where your remote A2A agent is deployed and accessible.

## Troubleshooting

**Connection Issues:**
- Ensure the local ADK web server is running on port 8000
- Ensure the remote A2A server is running on port 8001
- Check that no firewall is blocking localhost connections
- **Verify the `url` field in `remote_a2a/check_prime_agent/agent.json` matches the actual deployed location of your remote A2A server**
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server


**Agent Not Responding:**
- Check the logs for both the local ADK web server on port 8000 and remote A2A server on port 8001
- Verify the agent instructions are clear and unambiguous
- **Double-check that the RPC URL in the agent.json file is correct and accessible**
32 changes: 32 additions & 0 deletions contributing/samples/a2a_human_in_loop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,50 @@ You can extend this sample by:
- Integrating with external approval systems or databases
- Implementing approval timeouts and escalation procedures

## Deployment to Other Environments

When deploying the remote approval A2A agent to different environments (e.g., Cloud Run, different hosts/ports), you **must** update the `url` field in the agent card JSON file:

### Local Development
```json
{
"url": "http://localhost:8001/a2a/human_in_loop",
...
}
```

### Cloud Run Example
```json
{
"url": "https://your-approval-service-abc123-uc.a.run.app/a2a/human_in_loop",
...
}
```

### Custom Host/Port Example
```json
{
"url": "https://your-domain.com:9000/a2a/human_in_loop",
...
}
```

**Important:** The `url` field in `remote_a2a/human_in_loop/agent.json` must point to the actual RPC endpoint where your remote approval A2A agent is deployed and accessible.

## Troubleshooting

**Connection Issues:**
- Ensure the local ADK web server is running on port 8000
- Ensure the remote A2A server is running on port 8001
- Check that no firewall is blocking localhost connections
- **Verify the `url` field in `remote_a2a/human_in_loop/agent.json` matches the actual deployed location of your remote A2A server**
- Verify the agent card URL passed to RemoteA2AAgent constructor matches the running A2A server

**Agent Not Responding:**
- Check the logs for both the local ADK web server on port 8000 and remote A2A server on port 8001
- Verify the agent instructions are clear and unambiguous
- Ensure long-running tool responses are properly formatted with matching IDs
- **Double-check that the RPC URL in the agent.json file is correct and accessible**

**Approval Workflow Issues:**
- Verify that updated tool responses use the same `id` and `name` as the original function call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@
"tags": ["expenses", "processing", "employee-services"]
}
],
"url": "http://localhost:8000/a2a/human_in_loop",
"url": "http://localhost:8001/a2a/human_in_loop",
"version": "1.0.0"
}
3 changes: 0 additions & 3 deletions src/google/adk/cli/fast_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ async def _get_a2a_runner_async() -> Runner:
logger.info("Setting up A2A agent: %s", app_name)

try:
a2a_rpc_path = f"http://{host}:{port}/a2a/{app_name}"

agent_executor = A2aAgentExecutor(
runner=create_a2a_runner_loader(app_name),
)
Expand All @@ -365,7 +363,6 @@ async def _get_a2a_runner_async() -> Runner:
with (p / "agent.json").open("r", encoding="utf-8") as f:
data = json.load(f)
agent_card = AgentCard(**data)
agent_card.url = a2a_rpc_path

a2a_app = A2AStarletteApplication(
agent_card=agent_card,
Expand Down