Skip to content

[BUG]: Error when deploying academic-research agent to vertex AI agent engine #1223

@eguiraud-pf

Description

@eguiraud-pf

Name of sample affected

python/agents/academic-research

Description of issue

Local usage with adk web works. When deploying to Vertex AI, trying to use the model I get this error and no output:

  File "/code/app/api/factory/python_file_api_builder.py", line 473, in _async_stream_json_generator
    async for chunk in output:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/vertexai/preview/reasoning_engines/templates/adk.py", line 1017, in async_stream_query
    async for event in events_async:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/runners.py", line 565, in run_async
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/runners.py", line 550, in _run_with_trace
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/runners.py", line 782, in _exec_with_plugin
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/runners.py", line 539, in execute
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/agents/base_agent.py", line 295, in run_async
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/agents/llm_agent.py", line 470, in _run_async_impl
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 752, in run_async
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 829, in _run_one_step_async
    async for llm_response in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1186, in _call_llm_async
    async for event in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1169, in _call_llm_with_tracing
    async for llm_response in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 1245, in _run_and_handle_error
    async for response in agen:
  File "/home/appuser/.cache/pypoetry/virtualenvs/reasoning-engine-assembly-service-MATOk_fk-py3.12/lib/python3.12/site-packages/google/adk/flows/llm_flows/base_llm_flow.py", line 335, in _run_and_handle_error
    raise TypeError(
TypeError: Expected agent to have canonical_on_model_error_callbacks attribute, but got <class 'google.adk.agents.llm_agent.LlmAgent'>"

Environment

europe-west1 region, Vertex AI Agent Engine.
I have tried updating deploy.py so that create uses the latest versions of the libraries, but it does not help.

    remote_agent = agent_engines.create(
        adk_app,
        display_name=root_agent.name,
        requirements=[
            "google-adk (>=1.0.0)",
            "google-cloud-aiplatform[agent_engines] (>=1.93.0)",
            "google-genai (>=1.9.0)",
            "pydantic (>=2.10.6,<3.0.0)",
            "python-dotenv (>=1.0.1)",
        ],
        #        extra_packages=[""],
    )

Reproduction steps or code

(Paste your code here)

Error log

(Paste your error log here)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions