On this page

0114: Deterministic agent ticks and sendability

Status: Proposed — design default, pending the maintainer's confirmation

Context

Agents need parallel execution without making observable behavior depend on worker scheduling or allowing state to retain worker-local resources.

Decision

Run bulk-synchronous logical ticks: all ready agents step in parallel, sharded by agent id modulo worker count onto their home workers. An agent's transitions are serial. Merge emitted actions, journal entries and output by (tick, agent id, action index) before dispatch, following the M11 ordered merge. The I/O event loop polls providers and tools and manages timers; the interpreter runs the same tick loop on one thread. Require byte-identical stdout and journals across backends and worker counts.

Check agent state for share-nothing sendability at compile time: reject capability handles other than permitted M12 grants and ports, streams, and views or slices into foreign arenas. Diagnose violations as E0840 unless M12 already rejects them, in which case reuse its diagnostic and leave E0840 free. Confirm the M12 rule before implementation.

Consequences

Deterministic merging enables differential testing at 1/2/4/N workers; a slow step can delay an entire tick. The precise M12 grants and ports and existing diagnostic need verification.

Alternatives

Free-running scheduling can reduce latency but makes ordering harder to reproduce; defer it. Thread-per-agent execution adds stacks and scheduling overhead.