ADK crashes with MySQL session in v1.17.0
** Please make sure you read the contribution guide and file the issues in the right place. ** Contribution guide.
Describe the bug
adk crashes with TypeError: 'tuple' object cannot be interpreted as an integer when using MySQL backend in v1.17.0.
To Reproduce Please share a minimal code and data to reproduce your problem. Steps to reproduce the behavior:
- Install
google-adk==1.17.0 - Configure
DatabaseSessionServicewith MySQL - Create and store a session with events
- Error occurs during session serialization
Expected behavior Sessions should be stored and retrieved successfully from MySQL without errors.
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. macOS, Linux, Windows]
- Python version(python -V):
- ADK version(pip show google-adk):
Model Information:
- Are you using LiteLLM: Yes/No
- Which model is being used(e.g. gemini-2.5-pro)
Additional context Add any other context about the problem here.
I also encountered this problem, and I solved it by downgrading the version (I don't know exactly which version caused it, nor did I test it; in short, version 1.10 is definitely fine).
The reason for this error is probably as follows:
Omitting a lot of processing before and after, in short, during the message transmission process (when google-adk==1.17.0), the Event will be converted to bytes, and an attempt is made to execute bytes(Event). However, for Event type data, there is a place where it becomes a tuple during iteration, and a tuple cannot be converted to bytes, hence this error.
It can be reproduced this bug with this code:
from google.adk.events.event import Event
from google.adk.events.event_actions import EventActions
from google.genai.types import Content, Part
x = Event(content=Content(
parts=[
Part(
text="some text"
),
],
role='user'
), author='user',
)
print(bytes(x))
same error
......
File "/Users/gmy/Documents/liepinProjects/ins-pydora-internal/.venv/lib/python3.12/site-packages/sqlalchemy/engine/default.py", line 1521, in _init_compiled
flattened_processors[key](compiled_params[key])
File "/Users/gmy/Documents/liepinProjects/ins-pydora-internal/.venv/lib/python3.12/site-packages/sqlalchemy/sql/type_api.py", line 2096, in process
return fixed_impl_processor(
^^^^^^^^^^^^^^^^^^^^^
File "/Users/gmy/Documents/liepinProjects/ins-pydora-internal/.venv/lib/python3.12/site-packages/sqlalchemy/sql/sqltypes.py", line 914, in process
return DBAPIBinary(value)
^^^^^^^^^^^^^^^^^^
File "/Users/gmy/Documents/liepinProjects/ins-pydora-internal/.venv/lib/python3.12/site-packages/pymysql/__init__.py", line 129, in Binary
return bytes(x)
^^^^^^^^
sqlalchemy.exc.StatementError: (builtins.TypeError) 'tuple' object cannot be interpreted as an integer
我移除这段代码后,就可以使用了,或许应该处理这个? @hung12ct
Hi @growmuye , I’ve raised a PR: https://github.com/google/adk-python/pull/3282 to fix this issue. I’m still using v1.16 until it’s fixed.