Skip to content

Cannot access agent's final output from after_agent_callback #1952

@albertogeniola

Description

@albertogeniola

Describe the bug

As per official documentation, we should be able to modify the final agent response by operating at after_agent_callback level.

Image

As per ADK 1.5, however, it seems there is no way to publicly access the agent's final output from within the callback_context parameter. This clearly is either a BUG in the code or an error in the documentation.

To Reproduce
Steps to reproduce the behavior:

  1. Create an agent
  2. Register a after_agent_callback
  3. Debug and inspect the values of callback_context variable

Expected behavior
There should a way to access the final output of the agent via the callback_context or via another parameter passed to the callback.

Screenshots

Image Image

Desktop (please complete the following information):

  • OS: Windows 11
  • Python version(python -V): 3.13
  • ADK version(pip show google-adk): 1.5

Model Information:

Gemini 2.5-flash

Additional context

Possibly related to #1231. However, in my opinion, this has to be considered a BUG and not a feature request, unless we clearly change the documentation.

Metadata

Metadata

Assignees

Labels

bot triaged[Bot] This issue is triaged by ADK botcore[Component] This issue is related to the core interface and implementation

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions