You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VertexAiSessionService.get_session Becomes Super Slow When There Are Higher Numbers of Session Events #3039
Hey @DeanChensj
This issue makes the session service unusable as the response time grows linearly as the number of session events increase.
Please take a look.
Hi @touhonoob , may I know how do you use session service? Do you use the adk api_server, or do you manage the runner yourself? I'm thinking adding configuration to only load number of recent events in session service, it will either be in the RunConfig in runner, or in the config of App
Hello @DeanChensj Thanks for checking.
I deployed my agent on Google Cloud's Vertex AI Agent Engine and didn't add any customization.
It can be easily reproduced by having a longer conversation with an ADK agent I believe.
When I checked the profiler chart it's trying to traverse through all session events pages for every single query I made, which apparently would be making it getting slower over time with growing chat history.
Thank you for reporting this performance issue and sharing the detailed analysis!
Since this issue was opened, ADK has added two mechanisms on main to prevent VertexAiSessionService.get_session from loading unbounded historical events on every turn:
Per-Run GetSessionConfig via RunConfig.get_session_config: RunConfig (src/google/adk/agents/run_config.py) now exposes get_session_config: GetSessionConfig | None = None, which Runner forwards to session_service.get_session(..., config=run_config.get_session_config):
after_timestamp (server-side filter): In VertexAiSessionService.get_session (src/google/adk/sessions/vertex_ai_session_service.py), setting after_timestamp pushes a server-side filter='timestamp>="..."' directly to the Vertex AI Agent Engine events.list RPC so older events are never transferred over the network.
num_recent_events: Setting num_recent_events=0 skips calling events.list completely when only session metadata/state is needed, and num_recent_events=N bounds the events retained on the session.
Automatic Sliding-Window Event Compaction (EventsCompactionConfig):
You can configure EventsCompactionConfig on App (src/google/adk/apps/app.py) to periodically summarize older turns into a single compacted event so active sessions stay bounded in length.
We're closing this issue as resolved. Please feel free to reopen it if you still experience performance bottlenecks with these options enabled!
Activity
touhonoob commentedon Oct 23, 2025
Hey @DeanChensj
This issue makes the session service unusable as the response time grows linearly as the number of session events increase.
Please take a look.
DeanChensj commentedon Oct 24, 2025
Hi @touhonoob , may I know how do you use session service? Do you use the adk api_server, or do you manage the runner yourself? I'm thinking adding configuration to only load number of recent events in session service, it will either be in the RunConfig in runner, or in the config of App
touhonoob commentedon Oct 24, 2025
Hello @DeanChensj Thanks for checking.
I deployed my agent on Google Cloud's Vertex AI Agent Engine and didn't add any customization.
It can be easily reproduced by having a longer conversation with an ADK agent I believe.
When I checked the profiler chart it's trying to traverse through all session events pages for every single query I made, which apparently would be making it getting slower over time with growing chat history.
touhonoob commentedon Oct 24, 2025
Maybe you guys should work on something like https://platform.openai.com/docs/api-reference/responses ?
The session service is pointless if it needs to retrieve all of the historical events
couchrishi commentedon Oct 30, 2025
any updates pl? This is critical for production-grade deployments
arminhamp commentedon Feb 5, 2026
@adk-bot any solutions?
devashishupadhyay-unlocq commentedon Feb 17, 2026
@adk-bot any updates or quick fixes?
DeanChensj commentedon Oct 13, 2026
Thank you for reporting this performance issue and sharing the detailed analysis!
Since this issue was opened, ADK has added two mechanisms on
mainto preventVertexAiSessionService.get_sessionfrom loading unbounded historical events on every turn:Per-Run
GetSessionConfigviaRunConfig.get_session_config:RunConfig(src/google/adk/agents/run_config.py) now exposesget_session_config: GetSessionConfig | None = None, whichRunnerforwards tosession_service.get_session(..., config=run_config.get_session_config):after_timestamp(server-side filter): InVertexAiSessionService.get_session(src/google/adk/sessions/vertex_ai_session_service.py), settingafter_timestamppushes a server-sidefilter='timestamp>="..."'directly to the Vertex AI Agent Engineevents.listRPC so older events are never transferred over the network.num_recent_events: Settingnum_recent_events=0skips callingevents.listcompletely when only session metadata/state is needed, andnum_recent_events=Nbounds the events retained on the session.Automatic Sliding-Window Event Compaction (
EventsCompactionConfig):You can configure
EventsCompactionConfigonApp(src/google/adk/apps/app.py) to periodically summarize older turns into a single compacted event so active sessions stay bounded in length.We're closing this issue as resolved. Please feel free to reopen it if you still experience performance bottlenecks with these options enabled!
github-actions commentedon Oct 13, 2026
Are you satisfied with the resolution of your issue?
Yes
No