Skip to content

LlmAgent.mode attribute is forbidden on the model but referenced in runners.py (regression) #6156

@lvth3r

Description

@lvth3r

That's the GitHub issue template — I'll fill it out for you. Paste this into the GitHub issue form:

Describe the Bug:
When deploying an LlmAgent (or Agent) to Vertex AI Agent Engine, every query against the deployed agent returns an empty HTTP response (Content-Length: 0). The underlying error in the agent runtime logs is:
AttributeError: 'LlmAgent' object has no attribute 'mode'. Did you mean: 'model'?
The error originates inside ADK's own runners.py at line 995, which accesses self.agent.mode. However, the LlmAgent Pydantic model rejects mode as an extra/forbidden field meaning the runtime expects a field that the model definition explicitly forbids. This is an internal inconsistency in ADK between the model schema and the runner code.
Steps to Reproduce:

pip install "google-cloud-aiplatform[adk,agent_engines]>=1.153.0" "google-adk>=1.20.0"
Create a minimal agent and deploy to Vertex AI Agent Engine (see Minimal Reproduction Code below)
Query the deployed agent via REST: POST https://us-central1-aiplatform.googleapis.com/v1beta1/{RESOURCE_NAME}:streamQuery?alt=sse with {"classMethod": "stream_query", "input": {"user_id": "test", "message": "Hi"}}
Response is HTTP 200 with Content-Length: 0 and empty body
Check Cloud Logging for the deployed ReasoningEngine's stderr — see the AttributeError traceback

Expected Behavior:
The agent should respond to queries with a streaming response containing the model's reply.
Observed Behavior:
The HTTP response returns immediately with an empty body. The agent never processes the query. Logs show:
File "/code/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 995, in run_async
if self.agent.mode is None:
^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/pydantic/main.py", line 1042, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'LlmAgent' object has no attribute 'mode'. Did you mean: 'model'?
Attempting to add mode="interactive" (or any value) to the Agent(...) constructor fails Pydantic validation:
pydantic_core._pydantic_core.ValidationError: 1 validation error for LlmAgent
mode
Extra inputs are not permitted [type=extra_forbidden, input_value='interactive', input_type=str]
Environment Details:

ADK Library Version (pip show google-adk): latest from >=1.20.0 resolution at time of deploy (mid-June 2026)
Desktop OS: Cloud Shell (Linux)
Python Version (python -V): Python 3.12
Runtime: Vertex AI Agent Engine, us-central1

Model Information:

Are you using LiteLLM: No
Which model is being used: gemini-3.5-flash

Regression:
Yes. An identical agent definition deployed in early June 2026 (with google-cloud-aiplatform==1.112.0) works correctly. The bug appeared after upgrading to google-cloud-aiplatform>=1.153.0.
Logs:
textTraceback (most recent call last):
File "/usr/local/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.12/threading.py", line 1012, in run
self._target(*self._args, **self._kwargs)
File "/code/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 932, in _asyncio_thread_main
asyncio.run(_invoke_run_async())
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
return future.result()
File "/code/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 925, in _invoke_run_async
async for event in agen:
File "/code/.venv/lib/python3.12/site-packages/google/adk/runners.py", line 995, in run_async
if self.agent.mode is None:
^^^^^^^^^^^^^^^
File "/code/.venv/lib/python3.12/site-packages/pydantic/main.py", line 1042, in getattr
raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
AttributeError: 'LlmAgent' object has no attribute 'mode'. Did you mean: 'model'?

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementationrequest clarification[Status] The maintainer need clarification or more information from the author

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions