LLM State Machine is an open-source Python framework designed to construct AI agents using explicit state machines. Developers define states as discrete steps—each invoking a large language model or custom logic—and transitions based on outputs. This approach provides clarity, maintainability, and robust error handling for multi-step, LLM-powered workflows, such as document processing, conversational bots, or automation pipelines.