Skip to content

Unexpected Agent Behavior when using VertexAiSessionService and Resumability #4332

@lucasbarzotto-axonify

Description

@lucasbarzotto-axonify

🔴 Required Information

Describe the Bug:

When VertexAiSessionService is used with Resumability and the root_agent has at least 2 sub_agents, the conversation always go back to the root_agent. For example:

Image

I believe this is related to the TODO in vertex_ai_session_service.pyline 270:

Image

Since agent_state is not supported by VertexAiSessionService, it seems like empty Events are created, and the last event is always from the root_agent:

Image

As a consequence, the _find_agent_to_run method from runners.py doesn't work as expected, as the selected agent to run is always the root_agent.

Steps to Reproduce:

  1. Pass an agent engine uri for the session service, so VertexAiSessionService is used
  2. Create an agent with at least 2 sub agents
  3. Add ResumabilityConfig with is_resumable=True set

Example:

import logging

from google.adk.agents import Agent
from google.adk.apps import App, ResumabilityConfig

logger = logging.getLogger(__name__)

travel_agent = Agent(
    name="travel_agent",
    model="gemini-2.5-flash",
    description="The travel agent.",
    instruction="You are a helpful agent who can help the user with their travel plans.",
    tools=[],
)


doctor_agent = Agent(
    name="doctor_agent",
    model="gemini-2.5-flash",
    description="The doctor agent.",
    instruction="You are a helpful agent who can help the user with their health questions.",
    tools=[],
)

root_agent = Agent(
    name="helpful_agent",
    model="gemini-2.5-flash",
    description="The orchestrator agent.",
    instruction="You are a helpful agent who can greet the user and transfer to the appropriate sub-agent.",
    tools=[],
    sub_agents=[travel_agent, doctor_agent],
)

app = App(
    name="helpful_agent",
    root_agent=root_agent,
    resumability_config=ResumabilityConfig(  # Comment this out so it works
        is_resumable=True,
    ),
)

Expected Behavior:

The conversation should continue in the current's agent, and not go back to the root_agent for every new user message. Also VertexAiSessionService should support Resumability, or at least it should be mentioned in the documentation that this is not supported yet.

Observed Behavior:

For every new user message, the root_agent is always executed and VertexAiSessionService doesn't support Resumability

Environment Details:

  • ADK Library Version (pip show google-adk): 1.23
  • Desktop OS: macOs
  • Python Version (python -V): 3.13.11

Model Information:

  • Are you using LiteLLM: No
  • Which model is being used: gemini-2.5-flash

🟡 Optional Information

Providing this information greatly speeds up the resolution process.

Regression:
Did this work in a previous version of ADK? If so, which one? I don't think so. I think it never worked before.

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

Assignees

No one assigned

    Labels

    services[Component] This issue is related to runtime services, e.g. sessions, memory, artifacts, etc

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions