Hi everyone,
I’m encountering an issue when trying to use Agno with the Gemini model and wanted to see if anyone else has experienced this or has any suggestions.
Problem:
I’m getting the following error:
AttributeError: 'NoneType' object has no attribute 'update'
This error occurs when I try to initialize and run an agent with the Gemini model.
Code:
Here’s the code I’m using:
from agno.agent import Agent, RunResponse # noqa
from agno.models.google import Gemini
agent = Agent(model=Gemini(id="gemini-2.0-flash-001"), markdown=True)
# Get the response in a variable
# run: RunResponse = agent.run("Share a 2 sentence horror story")
# print(run.content)
# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story")
Traceback:
The traceback points to the _get_request_kwargs
method within the agno.models.google.Gemini
class:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "<path_to_your_script>/main.py", line 11, in <module>
agent.print_response("Share a 2 sentence horror story")
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<path_to_agno>/agent/agent.py", line 3511, in print_response
run_response = self.run(
message=message,
...<5 lines>...
**kwargs,
)
File "<path_to_agno>/agent/agent.py", line 870, in run
return next(resp)
File "<path_to_agno>/agent/agent.py", line 592, in _run
model_response = self.model.response(messages=run_messages.messages)
File "<path_to_agno>/models/base.py", line 163, in response
assistant_message, has_tool_calls = self._process_model_response(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
messages=messages,
^^^^^^^^^^^^^^^^^^
model_response=model_response,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "<path_to_agno>/models/base.py", line 287, in _process_model_response
response = self.invoke(messages=messages)
File "<path_to_agno>/models/google/gemini.py", line 307, in invoke
request_kwargs = self._get_request_kwargs(system_message)
File "<path_to_agno>/models/google/gemini.py", line 254, in _get_request_kwargs
config.update(
^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'update'
Investigation:
I’ve verified that the Gemini API is accessible and functioning correctly. I successfully made a direct request to the API using a PowerShell script, confirming that my API key and network connection are working. This suggests the issue lies specifically within Agno’s Gemini integration.
What I’ve Tried:
- Restarted Kernel
- Reinstalled agno
Environment:
- agno version: “agno>=1.1.4”
- google-genai version: “google-genai>=1.2.0”
- Python version: 3.13.2 (initially), also tested with 3.12.9
- Operating System: Windows
Question:
Has anyone else run into this issue? Any suggestions on how to resolve it would be greatly appreciated! It seems the config
variable in agno.models.google.Gemini._get_request_kwargs
is sometimes None
when it should be a dictionary-like object.
Thanks in advance for any help!