std.agent_loop
Generated by
sema docfromstdlib/sema/agent_loop.sema. Import withfrom std.agent_loop import …. For a narrative introduction see std.agent_loop.
agent_loop
Section titled “agent_loop”std.agent_loop — the agentic loop as a reusable combinator (design ④).
loop_until(init, max_iters, step, done) runs step (a pure state -> state
function) until done(state) or max_iters. Replaces the ~300-line hand-rolled
_run_deep while loop; the termination policy is data. step/done are pure
lambdas over an immutable state (Sema forbids a lambda mutating captured state,
which keeps the loop parallel-safe).
loop_until
Section titled “loop_until”def loop_until(init: any, max_iters: int, step: fn, done: fn) -> any !{}Parameters
| name | type |
|---|---|
init | any |
max_iters | int |
step | fn |
done | fn |
Returns any
Effects !{}