-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Description
Describe the bug
When running an agent with VertexAI Agent Engine Sessions as the session service, only the first 100 events of the sessions are being pulled. This can be observed in both the LLM Request missing content and when the event history refreshes in the ADK web UI.
To Reproduce
Please share a minimal code and data to reproduce your problem.
Steps to reproduce the behavior:
- Run an agent using an agent engine's session service.
- Upload/generate more than a 100 events.
- When sending a new message, LLM requests will only contain content from the first 100 events plus the events from the current invocation. When using
adk web, the new events will appear as they are generated and then disappear when the session's event history is refreshed.
Expected behavior
All the events should appear in both the LLM requests and the adk web session history.
Desktop (please complete the following information):
- OS: MacOS
- ADK version: 1.18.0
- Google AI platform: 1.127.0
- Python version: 3.12.11
Model Information:
- Are you using LiteLLM: No
- Which model is being used(e.g. gemini-2.5-pro): gemini-2.5-flash
Additional context
It gets fixed by using async for instead of for here:
adk-python/src/google/adk/sessions/vertex_ai_session_service.py
Lines 179 to 183 in 7c993b0
| session.events += [ | |
| _from_api_event(event) | |
| for event in events_iterator | |
| if event.timestamp.timestamp() <= update_timestamp | |
| ] |