Class: LoopController
Defined in: packages/agentos/src/orchestration/runtime/LoopController.ts:202
Configurable ReAct loop controller.
Drives a generate → act → observe cycle, delegating LLM inference and tool execution to the caller-provided LoopContext. The loop terminates when:
- The LLM returns no tool calls (natural stop), or
maxIterationsis exceeded, or- A tool fails and
failureModeis'fail_closed'.
All intermediate events are yielded so callers can stream output to the user or record an audit trace.
Constructors
Constructor
new LoopController():
LoopController
Returns
LoopController
Methods
execute()
execute(
config,context):AsyncGenerator<LoopEvent>
Defined in: packages/agentos/src/orchestration/runtime/LoopController.ts:211
Execute the ReAct loop and yield LoopEvents.
Parameters
config
Loop behaviour configuration.
context
Callbacks to the underlying LLM/tool layer.
Returns
AsyncGenerator<LoopEvent>
Yields
Structured events for each phase of the loop.
Throws
Only when failureMode === 'fail_closed' and a tool fails.