Scheduler API
Scheduler API
Section titled “Scheduler API”Lifecycle
Section titled “Lifecycle”async with Scheduler() as scheduler: ...or:
scheduler = Scheduler()await scheduler.start()...await scheduler.stop()Core methods
Section titled “Core methods”enqueue_input(...)
Section titled “enqueue_input(...)”Queue the next input for a persistent root that is IDLE or FAILED.
route_root_input(...)
Section titled “route_root_input(...)”Canonical integration entry point used by Console and channels. It decides whether the correct action is:
submittedenqueuedsteered
The returned RouteResult.stream is the root stream for that routed turn.
wait_for(...)
Section titled “wait_for(...)”Wait until a state settles to IDLE, COMPLETED, or FAILED.
Control methods
Section titled “Control methods”steer(...)cancel(...)shutdown(...)rebind_agent(...)
Query methods
Section titled “Query methods”get_state(...)list_states(...)list_events(...)get_stats(...)get_registered_agent(...)
Stream semantics
Section titled “Stream semantics”route_root_input()exposes stream consumption throughRouteResult.stream- only one live stream subscriber is allowed per root
state_id RouteResult.streamisNoneonly forsteered + RUNNING, where the existing subscriber keeps consuming the live stream
State storage backends
Section titled “State storage backends”SchedulerConfig.state_storage.storage_type supports:
memorysqlitemongodb
Route stream modes
Section titled “Route stream modes”RouteStreamMode currently supports:
RUN_ENDUNTIL_SETTLED