ol.llx.agent.driver
platforms: clj, cljs
Driver loop for the agent runtime.
The driver is the sole owner of state transitions. It steps inputs through `ol.llx.agent.loop/step`, interprets resulting effects via `ol.llx.agent.fx/execute-fx`, and feeds resulting signals back into `loop/step`.
Multiplexing: - Tracks all active signal channels returned by signal-producing effects. - Includes `command>` in the `alts` set for external commands. - Removes channels when they close.
Signal flow:
input (command/signal) -> loop/step -> [state', effects] -> execute-fx -> channels + fire-and-forget side effects -> alts over active channels + command> -> loop/step for each received signal -> repeat until active channel set is empty.
run
clj
platforms: clj
(run env input)
Driver loop. Processes a single input through the state machine,
interprets resulting effects, and multiplexes signals from all active
channels back through loop/step until the system settles.
The driver is the sole owner of state transitions — it is the only code that calls `loop/step` and mutates the state atom. Effect interpreters perform side effects but never step the state machine.
Multiplexing: The driver maintains a set of active signal channels (from `:call-llm`, `:execute-tool`, etc.) plus the external `command>` channel. It uses `alts` to read from all of them concurrently. Multiple signal-producing effects can be active at once, enabling concurrent tool execution.
Signal processing: When a signal arrives from any channel, it is stepped through `loop/step`. The resulting effects are processed: fire-and-forget effects execute inline, signal-producing effects add their channel to the active set. When a channel closes (effect complete), it is removed from the active set.
Termination: The driver resolves when the active channel set is empty and all effects from the final step have been processed.
cljs
platforms: cljs
(run env input)
Driver loop. Processes a single input through the state machine,
interprets resulting effects, and multiplexes signals from all active
channels back through loop/step until the system settles.
The driver is the sole owner of state transitions — it is the only code that calls `loop/step` and mutates the state atom. Effect interpreters perform side effects but never step the state machine.
Multiplexing: The driver maintains a set of active signal channels (from `:call-llm`, `:execute-tool`, etc.) plus the external `command>` channel. It uses `alts` to read from all of them concurrently. Multiple signal-producing effects can be active at once, enabling concurrent tool execution.
Signal processing: When a signal arrives from any channel, it is stepped through `loop/step`. The resulting effects are processed: fire-and-forget effects execute inline, signal-producing effects add their channel to the active set. When a channel closes (effect complete), it is removed from the active set.
Termination: The driver resolves when the active channel set is empty and all effects from the final step have been processed.