Open
Description
Describe the bug
When using the Bigquery toolset to execute queries that return columns with timestamps, serialization fails with:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/site-packages/google/adk/runners.py", line 138, in _asyncio_thread_main
asyncio.run(_invoke_run_async())
File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/usr/local/lib/python3.10/site-packages/google/adk/runners.py", line 126, in _invoke_run_async
async for event in self.run_async(
File "/usr/local/lib/python3.10/site-packages/google/adk/runners.py", line 199, in run_async
await self.session_service.append_event(session=session, event=event)
File "/usr/local/lib/python3.10/site-packages/google/adk/sessions/vertex_ai_session_service.py", line 227, in append_event
await api_client.async_request(
File "/usr/local/lib/python3.10/site-packages/google/genai/_api_client.py", line 789, in async_request
result = await self._async_request(http_request=http_request, stream=False)
File "/usr/local/lib/python3.10/site-packages/google/genai/_api_client.py", line 701, in _async_request
data = json.dumps(http_request.data) if http_request.data else None
File "/usr/local/lib/python3.10/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/usr/local/lib/python3.10/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/local/lib/python3.10/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/usr/local/lib/python3.10/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable
To Reproduce
Steps to reproduce the behavior:
- Create an Agent that uses the BigQueryToolset
- Have agent execute query against table with TIMESTAMP column types in response
Expected behavior
datetime objects should be serialized as suitably formatted timestamp strings
Screenshots
If applicable, add screenshots to help explain your problem.