ToolExecutionLoop class
Handles the autonomous tool execution loop.
When an AI responds with tool calls, this class:
- Parses the requested tools
- Executes the Dart callbacks
- Injects results back into the conversation
- Recursively calls the AI until a final text response is given
Enforces a maximum iteration depth to prevent infinite loops.
Constructors
- ToolExecutionLoop({required AIProvider provider, int maxIterations = 10})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxIterations → int
-
Maximum iterations before aborting.
final
- provider → AIProvider
-
The AI provider to use for completions.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
execute(
{required Conversation conversation, required List< AIMessage> contextMessages, List<AITool> ? tools, int depth = 0}) → Future<AIResponse> - Processes a conversation, executing tool calls recursively until done.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited