DavidKPiano: Model Agent Logic as State Machines, Let the LLM Pick from Enabled Events

DavidKPiano · x · 2026-09-20

Developer David Khourshid (DavidKPiano) shares how to model agent logic as a state machine: give the LLM the current state plus a goal, and the enabled events it can trigger become its choice space.

He says this state-machine approach works extremely well in practice and teases an upcoming demo plus a small XState library for it, after previewing it at @AgentConf.

Related event: Modeling Agent Logic as State Machines Works Wonders(2 posts)→

Original post →

More from coding & agent

coding & agent channel →