adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

Unable to deploy ADK Agent to Vertex AI Agent Engine due to type incompatibility

Open rlucasfm opened this issue 1 year ago • 5 comments

Describe the bug

When trying to deploy an agent created with ADK using the agent_engines.create method from the Vertex AI SDK, the following type error occurs:

Argument of type "Agent" cannot be assigned to parameter "agent_engine" of type "Queryable | OperationRegistrable | None" in function "create"
  "Agent" cannot be assigned to type "Queryable | OperationRegistrable | None"
    "LlmAgent" is incompatible with protocol "Queryable"
      "query" is missing
    "LlmAgent" is incompatible with protocol "OperationRegistrable"
      "register_operations" is missing
    "LlmAgent" cannot be assigned to "None"

To Reproduce

Steps to reproduce the error:

  1. Install the dependencies: pip install google-adk google-cloud-aiplatform

  2. Create an agent with ADK:

   from google.adk.agents import Agent
   root_agent = Agent(
       name="metereology_agent",
       model="gemini-2.5-flash",
       instruction="...",
       description="...",
       tools=[]
   )
  1. Try to deploy with Agent Engine:
   from vertexai import agent_engines
   remote_app = agent_engines.create(
       agent_engine=root_agent,
       requirements=["google-cloud-aiplatform[agent_engines,adk]"],
   )

OR

   from vertexai import agent_engines
   remote_app = agent_engines.create(
       agent_engine=app,
       requirements=["google-cloud-aiplatform[agent_engines,adk]"],
   )
  1. See the type error above

Expected behavior

It was expected to be possible to deploy an agent created with ADK directly to the Vertex AI Agent Engine, as suggested by the documentation and the integration between the libraries. Screenshots Not applicable, type error at development time. Desktop (please complete the following information): OS: macOS Sonoma 14.5 Python version: 3.12.7 ADK version: 1.7.0 Model Information: Model: gemini-2.0-flash Additional context The error suggests that the Agent type from ADK does not implement the expected protocols (Queryable or OperationRegistrable) required by the agent_engines.create method.

rlucasfm avatar Jul 17 '25 20:07 rlucasfm

Hi @rlucasfm ,

Could you try

from vertexai.preview import reasoning_engines

Instead of

from vertexai import agent_engines

?

DeanChensj avatar Jul 18 '25 03:07 DeanChensj

Hi @rlucasfm ,

Could you try

from vertexai.preview import reasoning_engines

Instead of

from vertexai import agent_engines

?

So, should I use Reasoning Engine instead of Agent Engine when deploying? I could successfully deploy it even with the error, and it's somewhat working with Agent Engine.

I can't use reasoning_engines.create(...) tho

rlucasfm avatar Jul 18 '25 19:07 rlucasfm

Hi @rlucasfm, could you share the version of google-cloud-aiplatform you are using? in theory the latest version should support deploying the ADK agent directly using from vertexai import agent_engines and agent_engines.create.

DeanChensj avatar Jul 23 '25 02:07 DeanChensj

To deploy to agent engine, you do not need to pass an agent for a parameter called agent_engine.

Your current code:

remote_app = agent_engines.create(
       agent_engine=root_agent,
       requirements=["google-cloud-aiplatform[agent_engines,adk]"],
   )

should change to:

remote_app = agent_engines.create(
       root_agent,
       requirements=["google-cloud-aiplatform[agent_engines,adk]"],
   )

I was able to deploy to agent_engine recently like so^

See a LangchainAgent deployed like so here: https://colab.research.google.com/github/GoogleCloudPlatform/generative-ai/blob/main/gemini/agent-engine/intro_agent_engine.ipynb

paulrinaldi avatar Jul 23 '25 21:07 paulrinaldi

Hi @rlucasfm and thanks to everyone who participated in this thread.

We're currently doing some housekeeping on our issue tracker. Given the rapid pace of development and the number of updates since this was last active, there's a good chance this issue has been resolved in a newer version. To help us keep our backlog focused on current issues, we are closing this as stale.

If you're still facing this problem, could you please update to the very latest version of the library and confirm the issue still exists? If it does, please comment here, and we will be happy to reopen this issue and investigate further.

Thanks for your contribution and understanding!

jwiejulie avatar Aug 14 '25 21:08 jwiejulie