Skip to main content

tools_condition

Function tools_condition 

Source
pub fn tools_condition(input: &Value) -> String
Expand description

Routing function for determining whether to continue with tool execution or end the conversation.

This is a standard conditional edge function for ReAct-style agents. It checks if the last AI message contains tool calls:

  • If yes, route to the “tools” node
  • If no, route to END

Returns a string key that should be mapped in the conditional edges:

  • “tools” → route to ToolNode
  • END (“end”) → route to END