Skip to content

after_agent_callback broke agent handoff #3220

@renatoviolin

Description

@renatoviolin

Describe the bug
when using after_agent_callback the current agent receives the handoff even if they already handoff to another agent

To Reproduce
Given 3 agents:
root_agent
A_agent
B_agent

A_agent has a after_agent_callback implementation. It can be nothing, just a return None.

Flow:

  1. user input -> root_agent -> A_agent -> response user
  2. user reply -> A_agent -> response
  3. user reply -> A_agent -> B_agent

Here's the problem
4) user reply (sending a image) -> A_agent (but should be the B_agent as the last one used).

This only occurs if I add the after_agent_callback in the A_agent

Expected behavior
The handoff should continue to B_agent, not be interpreted to A_agent, as A_agent already handoff to B

Desktop (please complete the following information):

  • OS: MacOS
  • Python version 3.11
  • ADK version 1.16.0

Model Information:

  • Are you using LiteLLM: Yes/No
  • Which model is being used(e.g. gemini-2.5-pro)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

core[Component] This issue is related to the core interface and implementation

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions