Skip to content

Chat Agent inside Workflow loses conversation history across turns #5873

Closed

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%)

Activity

  1. added
    workflow
    on May 27, 2026
  2. added theissue type on May 27, 2026
  3. added
    v2
    on May 28, 2026
  4. deepakbatham572 commented on May 28, 2026

    @deepakbatham572
    Author

    HI @GWeale / @surajksharma07 could you please help here ?

  5. llalitkumarrr commented on May 29, 2026

    @llalitkumarrr
    Collaborator

    Hello @deepakbatham572 ,

    It looks like you are using Workflow for a multi-turn conversation. Because Workflow is a deterministic orchestration pipeline, it does not retain conversation history.
    For multi-turn conversations, we recommend using Agent in chat mode instead. You can find more details in the adk 2.0 docs. Please let us know if this resolves the issue.
    If the issue persists or if we have misunderstood your query, could you please share your complete code along with step by step reproduction steps? This will help us analyze the problem further.

  6. added
    request clarification
    on May 29, 2026
  7. boyangsvl commented on May 29, 2026

    @boyangsvl
    Collaborator

    Currently only single_turn agent can be put in the workflow. We are working on enabling more use cases.

  8. deepakbatham572 commented on May 30, 2026

    @deepakbatham572
    Author

    HI @boyangsvl , thanks for letting us know , but this is the gap and we need this enhanced functionality, for tracking can't we not re open the issue once the feature or enchcement is there will close it .?

  9. boyangsvl commented on May 30, 2026

    @boyangsvl
    Collaborator

    It makes sense. Reopening. Thanks!

  10. changed the issue type fromtoon Jun 11, 2026
  11. added
    needs review
    and removed
    request clarification
    on Jun 11, 2026
  12. GWeale commented on Nov 17, 2026

    @GWeale
    Collaborator

    inside a Workflow, an Agent runs as single_turn unless you set its mode, so it only saw the current message. setting mode='chat' on qa_agent, wired from START like your example, keeps the earlier turns, though a chat agent can only sit right after START for now. the workflow graph guide at docs/guides/workflow/graph covers this. thanks @deepakbatham572, please open a new issue if it still forgets the conversation with mode='chat'.

  13. github-actions commented on Nov 17, 2026

    @github-actions

    Are you satisfied with the resolution of your issue?
    Yes
    No

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

needs reviewv2workflow

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions