Agent-Level Callbacks for Eino ADK
Notice
This is an alpha version and does not guarantee compatibility.
Overview
en:
- This release introduces agent-level callbacks and multi-agent architecture to Eino ADK, enhancing middleware flexibility, observability, and management of complex agent workflows. Key additions include middleware hooks (BeforeAgent/OnEvents), global middleware injection, and Multi-Agent structure for unified multi-agent scenarios.
zh:
- 为 Eino ADK 引入Agent 级回调与多 Agent 架构,提升中间件灵活性、可观测性及复杂工作流管理能力。核心更新包括中间件切面(BeforeAgent/OnEvents)、全局中间件注入,以及 Multi-Agent 结构以统一多 Agent 场景。
Details
en:
- Introduce agent-level callbacks for ADK.
- Add callback hooks to current
AgentMiddleware:BeforeAgentandOnEvents - Add
AgentMiddlewareCheckerinterface. If an agent implementsAgentMiddlewareCheckerand enables agent middlewares internally, hooks run inside the agent; otherwise, agent middlewares are executed by the flowAgent. flowAgent/ChatModelAgent/workflowAgentRun/Resume adapt to middleware aspect execution, with partial refactoring ofChatModelAgentto adapt to runtime middleware injection and execution.- Add middlewares configuration to
Plan-ExecuteandSupervisorAgent - Add
globalAgentMiddlewaresto inject the same middleware at the outermost layer of all agent runtimes from a global perspective.
- Add callback hooks to current
- Introduce Multi-Agent for ADK.
- Add
Multi-Agentstructure, at the same conceptual level asChatModelAgent/WorkflowAgents, to solve the problem that Agent operations are at a flat level and difficult to observe inTransferAgentscenarios. flowAgentadapts toMulti-AgentoperationSupervisor Agentconstructor returnsMulti-Agent
- Add
- Add
WithGraphCallbacksAgentRunOption, which provides eino graph/chain callback injection inside an agent (mainly forChatModelAgent). - Provide utility helpers (
NewAsyncOnSingleEventHandler,NewSyncOnSingleEventHandler,BypassIterator) for event processing. - Add tests to verify middleware execution validity (order, deduplication, termination behavior, interruption/resume flows with tool calls, and global agent middleware propagation).
zh:
- ADK 支持 Agent 级别的回调
- 向现有的
AgentMiddleware中新增切面:BeforeAgent和OnEvents - 新增
AgentMiddlewareChecker接口用于检查 Agent 是否支持内部运行AgentMiddleware。如果支持,AgentMiddleware将在 Agent 内部运行(由 Agent 自行实现运行逻辑);否则将由 flowAgent 在 Agent 外部运行。 - flowAgent / ChatModelAgent / workflowAgent Run/Resume 适配 middleware 切面运行,对 ChatModelAgent 部分重构来适配运行时的 middleware 注入与运行。
- 新增
globalAgentMiddlewares,以全局角度向所有 agent 运行时最外侧注入相同的中间件
- 向现有的
- ADK 支持 Multi-Agent 概念
- 新增
Multi-Agent结构,概念层级与ChatModelAgent/WorkflowAgents一致,用于解决TransferAgent情况下各 Agent 运行处于平铺的层级难以进行观测的问题。 flowAgent对Multi-Agent运行进行适配Supervisor Agent构造方法返回Multi-Agent
- 新增
- 增加
WithGraphCallbacksAgentRunOption,提供向 Agent 内部的 graph/chain 运行 eino callback 的能力(主要面向 ChatModelAgent) - 提供多个工具方法,用于处理 Iterator 中的 Events (
NewAsyncOnSingleEventHandler,NewSyncOnSingleEventHandler,BypassIterator) - 补全 middleware 测试,保证功能正确性(顺序、去重、提前终止、中断恢复场景、工具调用、globalAgentMiddlewares 等)
Full Changelog: v0.7.17...v0.8.0-alpha.1