-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
agent engine[Component] This issue is related to Agent Engine deployment[Component] This issue is related to Agent Engine deployment
Description
I built a simple agent and I'm trying to deploy to AgentEngine. When I run adk deploy agent_engine its seems to work. But when I try to connect to the agent, I get the following error:
google.genai.errors.ClientError: 400 FAILED_PRECONDITION. {'error': {'code': 400, 'message': 'Reasoning Engine Execution failed.\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\nError Details: {"detail":"Agent Engine Error: (\\"FastAPI could not JSON-encode the response from invocation method %s. Error: %s. Invocation method\'s original response: %r\\", \'async_create_session\', ValueError([TypeError(\\"\'coroutine\' object is not iterable\\"), TypeError(\'vars() argument must have __dict__ attribute\')]), <coroutine object AdkApp.async_create_session at 0x7f70a598a320>)"}', 'status': 'FAILED_PRECONDITION'}}
To Reproduce
Steps to reproduce the behavior:
- Install adk
pip install google-adk==1.15.1 - Create simple agent
from google.adk.agents import Agent
system_instruction = (
"Just say hi and be nice"
)
root_agent = Agent(
name="my_test_agent",
model='gemini-2.5-flash',
instruction=system_instruction,
description="Test agent",
)- Deploy the agent
adk deploy agent_engine \
--project=<project_id> \
--region=us-central1 \
--staging_bucket=gs://<bucket> \
--display_name=my_agent \
my_agent
- Try to connect to remote agent and create a session
import asyncio
import vertexai
async def main():
# Create a local session to maintain conversation history
client = vertexai.Client(project="<project_id>", location="us-central1")
remote_app = client.agent_engines.get(name='projects/<project_id>/locations/us-central1/reasoningEngines/<agent_id>')
remote_session = await remote_app.async_create_session(user_id="u_456")
print(remote_session)
if __name__ == "__main__":
asyncio.run(main())- Stacktrace of the error
Traceback (most recent call last):
File "/Users/ezmarques/git/plataforma/agent-demo/main.py", line 24, in <module>
asyncio.run(main())
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/main.py", line 8, in main
remote_session = await remote_app.async_create_session(user_id="u_456")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/vertexai/_genai/_agent_engines_utils.py", line 1481, in _method
response = await self.api_async_client._query(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/vertexai/_genai/agent_engines.py", line 2159, in _query
response = await self._api_client.async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/google/genai/_api_client.py", line 1325, in async_request
result = await self._async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/google/genai/_api_client.py", line 1270, in _async_request
return await self._async_retry( # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/__init__.py", line 418, in exc_check
raise retry_exc.reraise()
^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/__init__.py", line 185, in reraise
raise self.last_attempt.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/google/genai/_api_client.py", line 1250, in _async_request_once
await errors.APIError.raise_for_async_response(client_response)
File "/Users/ezmarques/git/plataforma/agent-demo/.venv/lib/python3.11/site-packages/google/genai/errors.py", line 159, in raise_for_async_response
raise ClientError(status_code, response_json, response)
google.genai.errors.ClientError: 400 FAILED_PRECONDITION. {'error': {'code': 400, 'message': 'Reasoning Engine Execution failed.\nPlease refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/use) for checking logs and other troubleshooting tips.\nError Details: {"detail":"Agent Engine Error: (\\"FastAPI could not JSON-encode the response from invocation method %s. Error: %s. Invocation method\'s original response: %r\\", \'async_create_session\', ValueError([TypeError(\\"\'coroutine\' object is not iterable\\"), TypeError(\'vars() argument must have __dict__ attribute\')]), <coroutine object AdkApp.async_create_session at 0x7f4757473520>)"}', 'status': 'FAILED_PRECONDITION'}}
Desktop (please complete the following information):
- OS: macOS
- Python version(python -V): 3.11.9
- ADK version(pip show google-adk): 1.15.1
svillegasz
Metadata
Metadata
Assignees
Labels
agent engine[Component] This issue is related to Agent Engine deployment[Component] This issue is related to Agent Engine deployment
