AgentLoopConfig class final

Configuration for one agent loop run.

Ported subset of pi's AgentLoopConfig. convertToLlm, shouldStopAfterTurn, getApiKey, and the provider-option fields are not ported (see the library doc).

Constructors

AgentLoopConfig({required Model model, ToolExecutionMode toolExecution = ToolExecutionMode.parallel, BeforeToolCallHook? beforeToolCall, AfterToolCallHook? afterToolCall, TransformContextHook? transformContext, PrepareNextTurnHook? prepareNextTurn, QueuedMessagesSource? getSteeringMessages, QueuedMessagesSource? getFollowUpMessages})
const

Properties

afterToolCall AfterToolCallHook?
Called after each tool execution; can override the result.
final
beforeToolCall BeforeToolCallHook?
Called before each tool execution; can block it.
final
getFollowUpMessages QueuedMessagesSource?
Follow-up messages to process after the run would otherwise stop.
final
getSteeringMessages QueuedMessagesSource?
Steering messages to inject at the next turn boundary.
final
hashCode int
The hash code for this object.
no setterinherited
model Model
The model to call each turn.
final
prepareNextTurn PrepareNextTurnHook?
Adjusts context/model between turns.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolExecution ToolExecutionMode
How tool calls within one assistant message are executed. Default: ToolExecutionMode.parallel (pi default).
final
transformContext TransformContextHook?
Rewrites the message list sent to the provider before each call.
final

Methods

copyWith({Model? model}) AgentLoopConfig
Returns a copy with model replaced (used by prepareNextTurn).
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