AgentToolHooksMixin#
Build extensions, choose hooks, and manage request-scoped state. See the guide.
- class zett_agent.extensions.base.AgentToolHooksMixin[源代码]#
Hooks immediately before and after each requested tool invocation.
- async before_tool(context, call)[源代码]#
Run before one requested tool is invoked.
- 参数:
context (AgentRunContext)
call (ToolCall)
- 返回类型:
None
- async after_tool(context, call, result, error)[源代码]#
Inspect or modify a tool result before it is appended.
erroris the original execution exception for a failed result and None after successful execution. Changes made toresultare included in context, persistence, and the next model request. Raising prevents the result from being appended.- 参数:
context (AgentRunContext)
call (ToolCall)
result (ToolMessage)
error (Exception | None)
- 返回类型:
None