AttributeError: 'AgentEngine' object has no attribute 'async_create_session' after ADK 2.4 upgrade
Here's a clearer and more professional version of your bug report:
Yesterday, after noticing the ADK 2.4 release, I upgraded all dependencies to ensure my environment was fully up to date:
uv tool upgrade
uv lock --upgrade
I then created a new minimal project following the official guide:
https://google.github.io/agents-cli/guide/getting-started/#prefer-to-type-commands-yourself
# Create a minimal agent project
agents-cli create my-agent --prototype --yes
# Install dependencies and start the dev playground
cd my-agent
agents-cli install
agents-cli playground
Next, I deployed the agent to Google Cloud:
agents-cli deploy
The deployment completed successfully, and I was also able to access and test the agent in the GCP Agent Platform Playground without any issues.
Following the documentation for obtaining an agent instance:
the following call works correctly:
adk_app = client.agent_engines.get(...)
However, when I follow the next step in the documentation to create a session:
I receive the error shown below:
AttributeError: 'AgentEngine' object has no attribute 'async_create_session'
Additionally, according to the "Supported Operations" section of the documentation:
the following call returns no results:
adk_app.operation_schemas()
Based on my previous experience, I would expect this method to return a JSON document listing the available operations, including async_create_session.
While investigating the issue, I noticed that the generated agents-cli-manifest.yaml contains:
is_a2a: true
In older projects that work correctly, this value is set to false. I suspected this might be related to the problem, but even after manually changing it to false before deployment and redeploying the agent, the issue persists.
Expected behavior
adk_app.operation_schemas()should return the supported operation schemas.- The returned operations should include
async_create_session. - Session creation should work as described in the documentation.
Actual behavior
adk_app.operation_schemas()returns no schemas.- Session creation fails with the reported error.
- Changing
is_a2atofalsedoes not resolve the issue.
remote_agent.async_api_client now is "remote_agent.api_async_client"
it was renamed to remote_agent.api_async_client.sessions.create()
Dug into this further. adk-python's manifest generation in cli_deploy.py
(_AGENT_ENGINE_CLASS_METHODS, used by adk deploy) sets
agent_config['class_methods'] unconditionally, correctly including
async_create_session — no is_a2a conditional around it.
Also traced how class_methods gets used server-side in fast_api.py
(getattr(adk_app, parsed.class_method)), and that's not where your error
happens — your AttributeError is on the client-side AgentEngine object
from client.agent_engines.get(...), which is part of the vertexai SDK,
not adk-python. That object very likely generates its methods dynamically
from the class_methods metadata stored on the deployed resource at deploy
time.
So either: (a) your deployment didn't go through this manifest-generation
code path at all (possible if agents-cli deploy uses separate logic from
adk deploy), or (b) the resource has stale metadata from before this
manifest included async_create_session, and a fresh redeploy through
adk deploy directly might resolve it. Worth checking which deploy path
agents-cli actually uses under the hood, or trying a redeploy via
adk deploy to compare.
@jorgemontalvao-tre-ba This looks like stale class_methods metadata on that specific resource rather than an ADK bug — adk-python's own deploy manifest already includes async_create_session unconditionally.
As a workaround, try client.agent_engines.sessions.create(name=resource_name, user_id=user_id) instead of adk_app.async_create_session(...) and see if that unblocks session creation on your end.
If it holds up, please test it thoroughly before raising a PR — happy to help track down the permanent fix once we know which layer actually needs it!
Thanks for the work around, but changing the code to remove async_create_session breaks backward compatibility. Also how about all the other functions like list session, delete, query, so on?
All existing and future applications are built against the official Google documentation, which explicitly defines this method. It would invalidate ALL current projects relying on documented APIs, force unnecessary rewrites across the globe, and create a mismatch between implementation and official docs.
Backward compatibility is critical. Any deviation from the documented interface risks incompatibility with every application developed under Google’s official guidance.
Root cause found — it's in agents-cli, not adk-python. Filed google/agents-cli#55 with the details.
Short version: agents-cli 0.6.0 moved Agent Runtime deploys to a single unified container and dropped class_methods generation from its deploy config (deploy/agent_runtime.py; 0.5.x still had it). The deployed resource ends up with empty spec.class_methods, and vertexai's agent_engines.get() builds the returned object's methods from exactly that metadata — _register_api_methods_or_raise() returns early when operation_schemas() is empty. Hence operation_schemas() == [] and the AttributeError on async_create_session, while the playground keeps working, since the container itself still serves the full contract through its reasoning-engine adapter.
That also explains why flipping is_a2a: false and redeploying changed nothing: at deploy time that flag only picks the agent card URL in the success message and a local metadata file — it never touches the registered operations.
adk-python is not at fault here: adk deploy agent_engine sets class_methods unconditionally (cli_deploy.py, _AGENT_ENGINE_CLASS_METHODS, which includes async_create_session), and that list is byte-identical between 1.36.1 and 2.4.0 — upgrading ADK didn't change this path. Anything deployed with agents-cli <= 0.5.x keeps working, which matches the "older projects are fine" observation.
Until agents-cli restores the metadata, @surajksharma07's client.agent_engines.sessions.create(...) suggestion above is the least-bad unblock (it's a resource-level call that doesn't depend on spec.class_methods), and no application code built on the documented methods needs rewriting once the deploy tool sends class_methods again — the methods reappear on the next deploy. This one can probably be closed here and tracked in google/agents-cli#55.
@abhiramArise @surajksharma07 and @Brumbelow Glad to see this issue being addressed. Thank you very much for taking the time to investigate and provide clarity. Really appreciate the quick response and support! 🙏
@surajksharma07 The workaround you suggested "client.agent_engines.sessions.create()" works fine for this step. Thank you very much for this! 😁🙏
Could you, please, share the other operators? So everybody can proceed while the agents-cli team works on the fix.
async_stream_query: for streaming a response to a query. ❔🙏😁
async_create_session: for creating a new session. ➡️ client.agent_engines.sessions.create(name=resource_name, user_id=user_id)
async_list_sessions: for listing the sessions available. ➡️ client.agent_engines.sessions.list(name=resource_name)
async_get_session: for retrieving a specific session. ➡️ client.agent_engines.sessions.get(name=resource_name)
async_delete_session: for deleting a specific session. ➡️ client.agent_engines.sessions.delete(name=resource_name)
async_add_session_to_memory: for generating memories of a session. ❔
async_search_memory: for retrieving memories. ➡️ client.agent_engines.memories.list(name=resource_name)
I really spend many hours on this, but I couldn't find my self. Here is what I have
> dir(client.agent_engines)
['__class__',
'__delattr__',
'__dict__',
'__dir__',
'__doc__',
'__eq__',
'__format__',
'__ge__',
'__getattribute__',
'__getstate__',
'__gt__',
'__hash__',
'__init__',
'__init_subclass__',
'__le__',
'__lt__',
'__module__',
'__ne__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'_a2a_tasks',
'_api_client',
'_async_stream_query',
'_check_query_job',
'_create',
'_create_config',
'_delete',
'_generate_deployment_spec_or_raise',
'_get',
'_get_agent_operation',
'_is_lightweight_creation',
'_list',
'_list_pager',
'_memories',
'_query',
'_register_api_methods',
'_run_query_job',
'_runtimes',
'_sandboxes',
'_sessions',
'_set_package_spec',
'_set_source_code_spec',
'_stream_query',
'_update',
'_update_deployment_spec_with_env_vars_dict_or_raise',
'a2a_tasks',
'append_session_event',
'cancel_query_job',
'check_query_job',
'create',
'create_memory',
'create_session',
'delete',
'delete_memory',
'delete_session',
'generate_memories',
'get',
'get_memory',
'get_session',
'list',
'list_memories',
'list_session_events',
'list_sessions',
'memories',
'retrieve_memories',
'run_query_job',
'runtimes',
'sandboxes',
'sessions',
'update',
'vertexai']
For async_add_session_to_memory — checked the SDK source directly (google-cloud-aiplatform 1.142.0): client.agent_engines.memories.generate(name=resource_name, vertex_session_source={"session": session_resource_name}). One gotcha: session_resource_name needs the full path (projects/.../reasoningEngines/.../sessions/{id}), not just the bare session ID — that field is marked required in exactly that format.
For async_stream_query I can't give you a real answer though. The installed SDK only has _stream_query/_async_stream_query as underscore-private methods, both still carrying internal TODOs ("replace with generated methods", "add replay test for async stream query"), so Google's own SDK treats this as unfinished rather than just undocumented. That one genuinely depends on agents-cli#55 restoring class_methods so .get() hands back a properly-populated AgentEngine object — there's no supported workaround in the meantime.
Since the root cause and the actual fix both live in agents-cli, happy to keep this open as a tracking pointer here, but the real progress will show up on that issue rather than this one!
@surajksharma07 @Brumbelow @impeachmentright
remote_agent = client.agent_engines.create(
agent=local_agent, # Optional.
config={
"requirements": requirements, # Optional.
"extra_packages": extra_packages, # Optional.
"gcs_dir_name": gcs_dir_name, # Optional.
"display_name": display_name, # Optional.
"description": description, # Optional.
"labels": labels, # Optional.
"env_vars": env_vars, # Optional.
"build_options": build_options, # Optional.
"identity_type": identity_type, # Optional.
"service_account": service_account, # Optional.
"min_instances": min_instances, # Optional.
"max_instances": max_instances, # Optional.
"resource_limits": resource_limits, # Optional.
"container_concurrency": container_concurrency, # Optional
"encryption_spec": encryption_spec, # Optional.
"agent_framework": agent_framework, # Optional.
},
)
And then use-an-adk-agent
import vertexai
client = vertexai.Client(
project="PROJECT_ID",
location="LOCATION",
)
response = client.agent_engines.run_query_job( #vertexai__genai_agent_engines_AgentEngines_run_query_job)(
name="projects/PROJECT_ID/locations/LOCATION/reasoningEngines/RESOURCE_ID",
config={
"query": '{"input":{"user_id":"USER_ID", "message":"What is ..."}}'
},
)
print(response)
It works for now.
Also adk deploy works as expected. I believe the issue is in agents-cli component, but I hope they fix it asap. The Deploy to Agent Runtime with Agents CLI paper in place by Google ADK supportint deploy using it, and many other like this.
Good to hear run_query_job and adk deploy are holding up for you in the meantime. Re-checked cli_deploy.py at 2.5.0 too — _AGENT_ENGINE_CLASS_METHODS is still unconditional and still includes both async_create_session and async_stream_query, so there's nothing to fix on this side at any version. Confirms Brumbelow's read.
agents-cli#55 is still open with no PR yet, so no fix timeline I can give you there. One flag on run_query_job: it looks like a job-style call rather than the streaming surface, so it's a fine unblock for now but I wouldn't assume it behaves identically to async_stream_query once that's restored — worth re-testing against the real method once agents-cli ships the metadata fix.
Leaving #6369 open as the tracking pointer per my last comment — will ping this thread if agents-cli#55 moves!
@jorgemontalvao @jorgemontalvao-tre-ba closing this out. Confirmed it was never an adk-python bug and the actual fix has now landed upstream: agents-cli v1.4.0 (released Aug 18) restored the class_methods contract on agent_runtime deploys and agents-cli#55 was closed as fixed on Aug 24. Please upgrade agents-cli to >=1.4.0, redeploy and re-verify async_create_session/async_stream_query. Reopen or drop a comment here if anything's still off after that.