This chapter delves into a powerful abstract model, namely the finite-state machines. Beyond the theoretical framework, the content of this chapter demonstrates the use of Sage to define, model, build, visualize, and execute examples of state machines, showcasing their application in solving real-world problems.