Skip to content

Commit 52284b1

Browse files
seanzhougooglecopybara-github
authored andcommitted
fix: A2A RPC URL got overriden by host and port param of adk api server
PiperOrigin-RevId: 794708721
1 parent a74d334 commit 52284b1

File tree

6 files changed

+98
-5
lines changed

6 files changed

+98
-5
lines changed

contributing/samples/a2a_auth/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,43 @@ You can extend this sample by:
157157
- Adding audit logging for authentication events
158158
- Implementing multi-tenant OAuth token management
159159

160+
## Deployment to Other Environments
161+
162+
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:
163+
164+
### Local Development
165+
```json
166+
{
167+
"url": "http://localhost:8001/a2a/bigquery_agent",
168+
...
169+
}
170+
```
171+
172+
### Cloud Run Example
173+
```json
174+
{
175+
"url": "https://your-bigquery-service-abc123-uc.a.run.app/a2a/bigquery_agent",
176+
...
177+
}
178+
```
179+
180+
### Custom Host/Port Example
181+
```json
182+
{
183+
"url": "https://your-domain.com:9000/a2a/bigquery_agent",
184+
...
185+
}
186+
```
187+
188+
**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.
189+
160190
## Troubleshooting
161191

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

168199

@@ -182,3 +213,4 @@ You can extend this sample by:
182213
- Check the logs for both the local ADK web server and remote A2A server
183214
- Verify OAuth tokens are properly passed between agents
184215
- Ensure agent instructions are clear about authentication requirements
216+
- **Double-check that the RPC URL in the agent.json file is correct and accessible**

contributing/samples/a2a_auth/remote_a2a/bigquery_agent/agent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"tags": ["authentication", "oauth", "security"]
2525
}
2626
],
27-
"url": "http://localhost:8000/a2a/bigquery_agent",
27+
"url": "http://localhost:8001/a2a/bigquery_agent",
2828
"version": "1.0.0"
2929
}

contributing/samples/a2a_basic/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,47 @@ You can extend this sample by:
107107
- Adding persistent state management
108108
- Integrating with external APIs or databases
109109

110+
## Deployment to Other Environments
111+
112+
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:
113+
114+
### Local Development
115+
```json
116+
{
117+
"url": "http://localhost:8001/a2a/check_prime_agent",
118+
...
119+
}
120+
```
121+
122+
### Cloud Run Example
123+
```json
124+
{
125+
"url": "https://your-service-abc123-uc.a.run.app/a2a/check_prime_agent",
126+
...
127+
}
128+
```
129+
130+
### Custom Host/Port Example
131+
```json
132+
{
133+
"url": "https://your-domain.com:9000/a2a/check_prime_agent",
134+
...
135+
}
136+
```
137+
138+
**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.
139+
110140
## Troubleshooting
111141

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

118149

119150
**Agent Not Responding:**
120151
- Check the logs for both the local ADK web server on port 8000 and remote A2A server on port 8001
121152
- Verify the agent instructions are clear and unambiguous
153+
- **Double-check that the RPC URL in the agent.json file is correct and accessible**

contributing/samples/a2a_human_in_loop/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,50 @@ You can extend this sample by:
116116
- Integrating with external approval systems or databases
117117
- Implementing approval timeouts and escalation procedures
118118

119+
## Deployment to Other Environments
120+
121+
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:
122+
123+
### Local Development
124+
```json
125+
{
126+
"url": "http://localhost:8001/a2a/human_in_loop",
127+
...
128+
}
129+
```
130+
131+
### Cloud Run Example
132+
```json
133+
{
134+
"url": "https://your-approval-service-abc123-uc.a.run.app/a2a/human_in_loop",
135+
...
136+
}
137+
```
138+
139+
### Custom Host/Port Example
140+
```json
141+
{
142+
"url": "https://your-domain.com:9000/a2a/human_in_loop",
143+
...
144+
}
145+
```
146+
147+
**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.
148+
119149
## Troubleshooting
120150

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

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

132164
**Approval Workflow Issues:**
133165
- Verify that updated tool responses use the same `id` and `name` as the original function call

contributing/samples/a2a_human_in_loop/remote_a2a/human_in_loop/agent.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@
2424
"tags": ["expenses", "processing", "employee-services"]
2525
}
2626
],
27-
"url": "http://localhost:8000/a2a/human_in_loop",
27+
"url": "http://localhost:8001/a2a/human_in_loop",
2828
"version": "1.0.0"
2929
}

src/google/adk/cli/fast_api.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,6 @@ async def _get_a2a_runner_async() -> Runner:
352352
logger.info("Setting up A2A agent: %s", app_name)
353353

354354
try:
355-
a2a_rpc_path = f"http://{host}:{port}/a2a/{app_name}"
356-
357355
agent_executor = A2aAgentExecutor(
358356
runner=create_a2a_runner_loader(app_name),
359357
)
@@ -365,7 +363,6 @@ async def _get_a2a_runner_async() -> Runner:
365363
with (p / "agent.json").open("r", encoding="utf-8") as f:
366364
data = json.load(f)
367365
agent_card = AgentCard(**data)
368-
agent_card.url = a2a_rpc_path
369366

370367
a2a_app = A2AStarletteApplication(
371368
agent_card=agent_card,

0 commit comments

Comments
 (0)