-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Describe the bug
A 400 INVALID_ARGUMENT error with the message "Invalid Session resource name" occurs when an agent using VertexAiSessionService is called from another agent via A2A (Agent-to-Agent) communication.
This issue does not occur when interacting with the agent without using A2A.
To Reproduce
Steps to reproduce the behavior:
- Create an agent that utilizes
VertexAiSessionService. - From a different agent, attempt to connect to the first agent using A2A.
- Initiate a conversation.
- See the following error:
400 INVALID_ARGUMENT. {'error': {'code': 400, 'message': 'List of found errors:\t1.Field: name; Message: Invalid Session resource name.\t', 'status': 'INVALID_ARGUMENT', 'details': [{'@type': 'type.googleapis.com/google.rpc.BadRequest', 'fieldViolations': [{'field': 'name', 'description': 'Invalid Session resource name.'}]}]}}}
Expected behavior
The A2A connection should be established successfully without any errors, and a new session should be created in the VertexAiSessionService-backed agent.
Screenshots
N/A
Desktop (please complete the following information):
- OS: Debian 13 (Using
pythondocker image) - Python version(python -V): 3.13.7
- ADK version(pip show google-adk): 1.12.0
Model Information:
gemini-2.5-pro
Additional context
The root cause appears to be a mismatch in session ID formats.
Based on the source code, the A2A SendMessageRequest in remote_a2a_agent.py uses a UUID as the session ID.
adk-python/src/google/adk/agents/remote_a2a_agent.py
Lines 472 to 473 in 5b999ed
| a2a_request = SendMessageRequest( | |
| id=str(uuid.uuid4()), |
adk-python/src/google/adk/agents/remote_a2a_agent.py
Lines 319 to 320 in 5b999ed
| return SendMessageRequest( | |
| id=str(uuid.uuid4()), |
However, when the receiving agent's VertexAiSessionService tries to create the session, it passes this UUID directly to the Vertex AI API.
adk-python/src/google/adk/sessions/vertex_ai_session_service.py
Lines 77 to 81 in 5b999ed
| get_session_api_response = await api_client.async_request( | |
| http_method='GET', | |
| path=f'reasoningEngines/{reasoning_engine_id}/sessions/{session_id}', | |
| request_dict={}, | |
| ) |
The Vertex AI API seems to expect a numeric ID for the session resource name, not a UUID. This causes the "Invalid Session resource name" error.
This can be verified by sending a request with a UUID-formatted session ID directly to the Vertex AI API, which reproduces the error:
curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://<location>-aiplatform.googleapis.com/v1beta1/projects/<our-project>/locations/<location>/reasoningEngines/<engine-id>/sessions/7e56773c-8968-4fe5-97c0-cc8d14e200e1"
{
"error": {
"code": 400,
"message": "List of found errors:\t1.Field: name; Message: Invalid Session resource name.\t",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "name",
"description": "Invalid Session resource name."
}
]
}
]
}
}