Skip to content

Deploying App (with Caching) to Agent Engine - Pydantic runtime error #3826

@steffanianigro

Description

@steffanianigro

Hi, I have recently added caching to my agents by wrapping them as an App and it works well when evaluating the agent and using the in memory runner. I can also successfully deploy the agent to Agent Engine (updating my existing agent). However, when I invoke the agent, I get the error: Input should be a valid dictionary or instance of BaseAgent [type=model_type, input_value=App(name='oracle', root_a...esumability_config=None), input_type=App].

I suspect I am configuring the agent incorrectly when deploying but I can't find any alternatives to my current approach. An example of my agent and deployment configuration is below:

app = App( name="agent_name", root_agent=root_agent, context_cache_config=ContextCacheConfig( min_tokens=4096, ttl_seconds=600, cache_intervals=10, ), )

agent_engines.update( resource_name=existing_agent.resource_name, agent_engine=AdkApp(agent=app), display_name="Agent", ... )

To Reproduce

  1. Create an agent and wrap it as an App with caching configuration
  2. Deploy the agent using the python API by wrapping the App as an AdkApp (I have tried using the App directly but the deployment fails).
  3. Invoke the agent using the python API

Expected behavior
I expect the agent to behave as normal. However, I get a runtime error due to a Pydantic model validation issue.

Screenshots
I have attached a screenshot of the logs.

Desktop (please complete the following information):

  • OS: Linux
  • Python version(python -V): 3.13.5
  • ADK version(pip show google-adk): 1.20.0

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used(e.g. gemini-2.5-pro): gemini-2.5-flash / gemini-2.5-flash-lite

Additional context
I have tried on both ADK 1.19.0 and 1.20.0.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent engine[Component] This issue is related to Agent Engine deployment

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions