Open
Description
Request
Add the ability to modify the final response of an agent in the after_agent_callback function, similar to how after_model_callback allows response modification at the model level.
Motivation
Currently, after_model_callback allows modification of LLM responses, but there's no equivalent functionality at the agent level. This limitation becomes apparent when working with workflow agents (like LoopAgent) where you need to modify the final response after all processing is complete, but cannot use after_model_callback due to the agent architecture.
Use Case
I have a LoopAgent with the following workflow:
- An LlmAgent generates code
- A custom agent runs pylint to verify code correctness
- Loop continues until code passes validation
4- After the loop completes, I want to format the final code response to match a specific output format