ol.llx.agent.fx
platforms: clj, cljs
Effect interpreter for the agent runtime.
The pure state machine in `ol.llx.agent.loop` emits inert effect maps. This namespace interprets those maps into concrete side effects.
Effect categories:
Fire-and-forget — synchronous, produce no signals. - `:emit-event` — publish an event to subscribers - `:reject` — report invalid operation state
Signal-producing — async, return a channel of signals. - `:call-llm` — perform inference and stream `llm-*` signals - `:execute-tool` — execute a tool and emit `tool-*` signals
Signal-producing effects return promesa CSP channels consumed by `ol.llx.agent.driver/run`.
execute-fx
clj
platforms: clj
(execute-fx env effect)
Interpret a single effect description. Dispatches on ::type.
Fire-and-forget effects (`:emit-event`, `:reject`): Execute the side effect synchronously. Return `nil`.
Signal-producing effects (`:call-llm`, `:execute-tool`): Start the async work and return a promesa CSP channel that will emit signal maps. The channel closes when the effect is complete. The driver consumes the channel and steps each signal through `loop/step`. The interpreter must not call `step` or mutate the state atom.
`env` carries runtime dependencies: - `:state_` — atom holding current agent state (read-only for fx) - `:events-mx>` — event multiplexer write endpoint - `:convert-to-llm` — `(fn [messages])` transform to LLM messages - `:transform-context` — `(fn [messages abort-signal])` optional context pruning - `:stream-fn` — `(fn [model context opts])` LLM streaming fn - `:abort-signal` — abort token for cancellation
cljs
platforms: cljs
(execute-fx env effect)
Interpret a single effect description. Dispatches on ::type.
Fire-and-forget effects (`:emit-event`, `:reject`): Execute the side effect synchronously. Return `nil`.
Signal-producing effects (`:call-llm`, `:execute-tool`): Start the async work and return a promesa CSP channel that will emit signal maps. The channel closes when the effect is complete. The driver consumes the channel and steps each signal through `loop/step`. The interpreter must not call `step` or mutate the state atom.
`env` carries runtime dependencies: - `:state_` — atom holding current agent state (read-only for fx) - `:events-mx>` — event multiplexer write endpoint - `:convert-to-llm` — `(fn [messages])` transform to LLM messages - `:transform-context` — `(fn [messages abort-signal])` optional context pruning - `:stream-fn` — `(fn [model context opts])` LLM streaming fn - `:abort-signal` — abort token for cancellation