-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
When trying to create a session after deploying an agent with event compaction and/or context caching (which requires creating an App that gets passed to AdkApp), session creation fails due to an invalid app_name. This seems to occur because Pydantic expects you to supply a name when creating an App (note that the problem will occur even if you set name=None), however this name is not a valid reasoning engine resource name (e.g., projects/1234567/locations/us-central1/reasoningEngines/456789) and so attempts to create a session fail.
To Reproduce
-
Deploy an agent to Agent Engine using an
Appto configure event compaction and/or context caching:app = google.adk.apps.App( root_agent=my_agent, name="my_agent_name", events_compaction_config=EventsCompactionConfig(), context_cache_config=ContextCacheConfig(), ) adk_app = vertexai.agent_engines.AdkApp( app=app, enable_tracing=False, ) vertexai.agent_engines.create( agent_engine=adk_app, ... ) -
Attempt to create a session:
remote_agent: vertexai.agent_engines.AgentEngine = agent_engines.get(resource_name="projects/12345/...") remote_session = await remote_agent.async_create_session(user_id="my_user_id")
Actual behavior
The async_create_session() call fails with the error message:
Error Details: {"detail":"Agent Engine Error: An error occurred during invocation. Exception: App name my_agent_name is not valid. It should either be the full ReasoningEngine resource name, or the reasoning engine id.\nRequest Data: {'user_id': 'my_user_id'}"}"
Expected behavior
A session is successfully created, with Agent Engine supplying the necessary resource name as-needed in order for session creation to occur.
Desktop (please complete the following information):
- OS: macOS
- Python version(python -V): 3.11
- ADK version(pip show google-adk): 1.18.0
Model Information:
- Are you using LiteLLM: No
- Which model is being used: N/A
Additional context
Add any other context about the problem here.