Skip to content

events is mixing while running single_turn agent as parallel #5961

@maxx1958

Description

@maxx1958

🔴 Required Information

Please ensure all items in this section are completed to allow for efficient
triaging. Requests without complete information may be rejected / deprioritized.
If an item is not applicable to you - please mark it as N/A

Describe the Bug:
When "single_turn" agents are executed in parallel, the context gets mixed.
Single_turn_Agent1("order 1")
Single_turn_Agent1("order 2")
Single_turn_Agent1 got
context = [
"order 1",
"order 2",
]

Single_turn_Agent2 also got
context = [
"order 1",
"order 2",
]

Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:

  1. Install '...'
  2. Run '....'
  3. Open '....'
  4. Provide error or stacktrace
    root_agent(
    sub_agents = [ Single_turn_Agent1 , Single_turn_Agent2 ]
    )

Asking questions that are called simultaneously

Expected Behavior:
A clear and concise description of what you expected to happen.

Single_turn_Agent1("order 1")
Single_turn_Agent1("order 2")
Single_turn_Agent1 got
context = [
"order 1",
]

Single_turn_Agent2 also got
context = [
"order 2",
]

Observed Behavior:
What actually happened? Include error messages or crash stack traces here.

Environment Details:

  • ADK Library Version (pip show google-adk):
    Version: 2.1.0

  • Desktop OS:** [e.g., macOS, Linux, Windows] : linux

  • Python Version (python -V):
    Python 3.12.3

Model Information:

  • Are you using LiteLLM: Yes
  • Which model is being used: (e.g., gemini-2.5-pro)
    bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0

🟡 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?

Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.

// Paste logs here

Screenshots / Video:
If applicable, add screenshots or screen recordings to help explain
your problem.

Additional Context:
Add any other context about the problem here.

@OverRide
async def run_async(
self,
*,
args: dict[str, Any],
tool_context: ToolContext,
) -> Any:
input_schema = _get_input_schema(self.agent)
if input_schema:
try:
node_input = input_schema.model_validate(args)
except Exception as e:
return f'Error validating input: {e}'
else:
node_input = args.get('request')
print(f"# name:{self.agent.name}, node_input:{node_input}")
print(f"# name:{self.agent.name}, tool_context:{tool_context.session.events}")
try:
return await tool_context.run_node(
self.agent, node_input=node_input, use_sub_branch=True
)
except Exception as e:
return f'Error running sub-agent: {e}'

Minimal Reproduction Code:
Please provide a code snippet or a link to a Gist/repo that isolates the issue.

// Code snippet here

How often has this issue occurred?:

  • Always (100%)

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementationrequest clarification[Status] The maintainer need clarification or more information from the authorworkflow[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