Skip to content

Chat Agent inside Workflow loses conversation history across turns #5873

@deepakbatham572

Description

@deepakbatham572

🔴 Required Information

Describe the Bug:
A chat mode Agent (with include_contents='default') used as a static graph
node inside a Workflow does not retain conversation history across user turns.
Each turn the agent behaves as if it has never spoken to the user before.

Steps to Reproduce:

  1. Install google-adk==2.1.0
  2. Create a Workflow with a chat Agent as a graph node:
qa_agent = Agent(name="qa_agent", model=model, instruction="You are a helpful assistant.")

workflow = Workflow(
    name="root_workflow",
    edges=[("START", qa_agent)],
)
adk = ADKAgent(adk_agent=workflow, use_thread_id_as_session_id=True, ...)
  1. Turn 1: send message "my name is deepak" → agent responds "Nice to meet you, deepak!"
  2. Turn 2: send message ["what is my name?"]→ agent responds "I don't know your name"

Expected Behavior:
[Agent]( with include_contents='default' should receive prior session events as
conversation history on each turn, even when running as a Workflow graph node.
Turn 2 should respond: "Your name is deepak."

Observed Behavior:
The agent answers each turn as if it is a fresh conversation with no prior context.
Session storage is confirmed working (events are persisted in DB). The issue is
that the Workflow does not pass prior session history to the node Agent's LLM context.

Environment Details:

ADK Library Version: [google-adk==2.1.0]
Desktop OS: macOS
Python Version: 3.12
Model Information:

Are you using LiteLLM: Yes
Which model is being used: gpt-5.1 (via LiteLLM)
🟡 Optional Information
Regression:
N/A

Additional Context:
The ADK source _validate_no_task_mode_graph_nodes already documents a related issue
for [mode='task'] agents:

"The workflow scheduler currently overwrites node_input with the latest user message
on every re-entry, so the task brief is lost and the agent loses context."

The same scheduler behaviour appears to affect [mode='chat'] agents — the agent only
sees the current [node_input]without the accumulated session history, making it
stateless despite include_contents='default'.

This makes [Workflow] unsuitable as a root agent for any conversational use case
that requires memory across turns — which is the primary use case for chat agents.

Minimal Reproduction Code:

from google.adk.agents import Agent
from google.adk.workflow import Workflow
from ag_ui_adk import ADKAgent

qa_agent = Agent(
    name="qa_agent",
    model=model,
    instruction="You are a helpful assistant. Remember what the user tells you.",
    # include_contents defaults to 'default' — should receive history
)

workflow = Workflow(
    name="root",
    edges=[("START", qa_agent)],
)

adk = ADKAgent(
    adk_agent=workflow,
    session_service=session_service,  # DB-backed, confirmed working
    use_thread_id_as_session_id=True,
)

# Turn 1: "my name is deepak"  → agent greets by name  ✅
# Turn 2: "what is my name?"   → agent says "I don't know" ❌

How often has this issue occurred?:
Always (100%)

Metadata

Metadata

Assignees

Labels

request clarification[Status] The maintainer need clarification or more information from the authorv2Affects only 2.0 versionworkflow[Component] This issue is related to ADKworkflow

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions