AgentLoopController class

Runs the autonomous agent loop for a given AgentGoal.

Minimal wiring

final memory  = AgentMemoryStore();
final llm     = LLMCore(provider: MockLLMProvider(), memory: memory);
final planner = PlanningEngine(llmCore: llm);
final tools   = ToolRegistry();
BuiltinToolset.registerAll(tools);

final loop = AgentLoopController(
  llm: llm,
  memory: memory,
  planner: planner,
  registry: tools,
);

final goal = AgentGoal(
  id: 'g-001',
  description: 'What is the current weather in Paris?',
);

final result = await loop.run(goal);
print(result.success); // true

Listening to events

loop.events.listen((e) => print('[${e.type.name}] ${e.iteration}'));

Constructors

AgentLoopController({required LLMCore llm, required AgentMemoryStore memory, required PlanningEngine planner, required ToolRegistry registry, EnvironmentAdapter? environment, AgentLoopConfig? config, SelfReflectionStub? reflection, ConsciousnessLogger? logger})

Properties

events → Stream<AgentLoopEvent>
Broadcast stream of AgentLoopEvents emitted during execution.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isRunning → bool
Whether the loop is currently active.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → Future<void>
Disposes the event stream. Call after the loop has finished.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
run(AgentGoal goal) → Future<AgentRunResult>
Executes the agent loop for goal and returns an AgentRunResult.
stop() → void
Requests a graceful stop after the current iteration finishes.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited