ol.llx.agent.loop

platforms: clj, cljs

empty-queue

clj

platforms: clj

cljs

platforms: cljs


handle-command

clj

platforms: clj

(handle-command state cmd)

Pure command handler. Takes state + command, returns [state' signals]. Handles global state mutations directly and translates FSM-driving commands into signals for the graph.

Commands that only mutate state (e.g. `:ol.llx.agent.command/steer`) return an empty
signals vector. Commands that drive the FSM (e.g. `:ol.llx.agent.command/prompt`)
return one or more signals to be fed into the transition functions.

cljs

platforms: cljs

(handle-command state cmd)

Pure command handler. Takes state + command, returns [state' signals]. Handles global state mutations directly and translates FSM-driving commands into signals for the graph.

Commands that only mutate state (e.g. `:ol.llx.agent.command/steer`) return an empty
signals vector. Commands that drive the FSM (e.g. `:ol.llx.agent.command/prompt`)
return one or more signals to be fed into the transition functions.

idle-transition

clj

platforms: clj

(idle-transition state msg)

Pure transition from ::idle state. Returns [state' effects].

cljs

platforms: cljs

(idle-transition state msg)

Pure transition from ::idle state. Returns [state' effects].


streaming-transition

clj

platforms: clj

(streaming-transition state msg)

Pure transition from ::streaming state. Returns [state' effects].

cljs

platforms: cljs

(streaming-transition state msg)

Pure transition from ::streaming state. Returns [state' effects].


tool-executing-transition

clj

platforms: clj

(tool-executing-transition state msg)

Pure transition from ::tool-executing state. Returns [state' effects].

cljs

platforms: cljs

(tool-executing-transition state msg)

Pure transition from ::tool-executing state. Returns [state' effects].


closed-transition

clj

platforms: clj

(closed-transition state _msg)

Terminal state. No transitions possible.

cljs

platforms: cljs

(closed-transition state _msg)

Terminal state. No transitions possible.


route-from-idle

clj

platforms: clj

(route-from-idle state)

cljs

platforms: cljs

(route-from-idle state)

route-from-streaming

clj

platforms: clj

(route-from-streaming state)

cljs

platforms: cljs

(route-from-streaming state)

route-from-tool-executing

clj

platforms: clj

(route-from-tool-executing state)

cljs

platforms: cljs

(route-from-tool-executing state)

command?

clj

platforms: clj

(command? input)

cljs

platforms: cljs

(command? input)

graph

clj

platforms: clj

Agent state machine as data.

Transitions: `(state, msg) -> [state', effects]`
  Pure transition fns. Take current state and a signal, return
  new state and a vector of effect descriptions to execute.
Routes: `(state') -> phase-key`
  Pure routing fns. Take the post-transition state and return
  the keyword of the next phase to enter.

cljs

platforms: cljs

Agent state machine as data.

Transitions: `(state, msg) -> [state', effects]`
  Pure transition fns. Take current state and a signal, return
  new state and a vector of effect descriptions to execute.
Routes: `(state') -> phase-key`
  Pure routing fns. Take the post-transition state and return
  the keyword of the next phase to enter.

step

clj

platforms: clj

(step state input)
(step g state input)

Pure step function. Takes state + input (command or signal), returns [state' effects].

Commands are processed by `handle-command` which may produce signals.
Signals are processed by the graph transition + routing fns.
Emits `:ol.llx.agent.event/agent-end` automatically when the agent transitions from a non-idle phase back to `::idle`.

cljs

platforms: cljs

(step state input)
(step g state input)

Pure step function. Takes state + input (command or signal), returns [state' effects].

Commands are processed by `handle-command` which may produce signals.
Signals are processed by the graph transition + routing fns.
Emits `:ol.llx.agent.event/agent-end` automatically when the agent transitions from a non-idle phase back to `::idle`.