Exception when inserting Event into DB when error_message is longer than 1024 characters
We are using CloudSQL (PostgreSQL) as our database for sessions. Sometimes, when an error in an agent occurs (usually a MALFORMED FUNCTION and input containing JSON data), it causes an exception when inserting data into the DB.
This is the error
sqlalchemy.exc.ProgrammingError: (pg8000.dbapi.ProgrammingError) {'S': 'ERROR', 'V': 'ERROR', 'C': '22001', 'M': 'value too long for type character varying(1024)', 'F': 'varchar.c', 'L': '640', 'R': 'varchar'}
The issue is with the 'Events' table and the column/field 'error_message', which has a length of 1024. https://github.com/google/adk-python/blob/831e2e6d4d3dbd56fe553ba1bba759588f1b7658/src/google/adk/sessions/database_session_service.py#L254
The fix in the code (for initial table creation) would be to change the type of the error_message column to Text type. For existing tables, this would also mean changing the column type on the database level.
I don't know if there would be other implications of this change.
Similar issue here, happens on calls to new internal tool "set_model_response"
duplicate to: https://github.com/google/adk-python/issues/3351. closing this.