Class ToolCallLimitHook
java.lang.Object
com.alibaba.cloud.ai.graph.agent.hook.ModelHook
com.alibaba.cloud.ai.graph.agent.hook.toolcalllimit.ToolCallLimitHook
- All Implemented Interfaces:
Hook,Prioritized
Hook that tracks and limits tool call counts.
This hook monitors the number of tool calls made during agent execution
and can terminate the agent when specified limits are reached.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic enum -
Field Summary
Fields inherited from interface com.alibaba.cloud.ai.graph.agent.Prioritized
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Method Summary
Modifier and TypeMethodDescriptionafterModel(OverAllState state, RunnableConfig config) beforeModel(OverAllState state, RunnableConfig config) static ToolCallLimitHook.Builderbuilder()Gets the list of allowed jump destinations for this hook.getName()Gets the unique name of this hook.Methods inherited from class com.alibaba.cloud.ai.graph.agent.hook.ModelHook
getAgent, getAgentName, getOrder, setAgent, setAgentNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.alibaba.cloud.ai.graph.agent.hook.Hook
getHookPositions, getKeyStrategys, getModelInterceptors, getToolInterceptors, getTools
-
Method Details
-
builder
-
beforeModel
- Overrides:
beforeModelin classModelHook
-
afterModel
- Overrides:
afterModelin classModelHook
-
getName
Description copied from interface:HookGets the unique name of this hook. The name is used to identify the hook in the execution graph.- Returns:
- the hook name, must not be null
-
canJumpTo
Description copied from interface:HookGets the list of allowed jump destinations for this hook.Hooks can control the flow of execution by specifying where the agent can jump to after the hook executes. This allows hooks to redirect the execution flow based on their logic.
Common jump destinations include:
JumpTo.model: Jump to model nodeJumpTo.tool: Jump to tool nodeJumpTo.end: Jump to end (terminate agent)
- Returns:
- list of allowed jump destinations, empty list by default
- See Also:
-