--- id: automat version: "25.4.16" license: Copyright (c) 2014 Rackspace Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software… (full text in the JSON record) license_treatment: permissive maintenance: aging --- # Automat — Self-service finite-state machines for the programmer on the go. License: permissive · Maintenance: aging · Downloads: 14.3M/mo ## What it is and what it does Automat is a finite-state machine library that lets you define stateful behavior using Python method calls and type protocols, rather than requiring you to pass generic input objects through a state engine. Instead of scattering conditional logic across methods to track state flags, you declare states and transitions upfront, and the library synthesizes a clean interface that enforces valid state sequences at runtime. The library targets the common pattern where your code needs to behave differently depending on its state (like a coffee machine that should only brew when it has water, beans, and a closed lid), but your callers should not need to know or care that you've implemented it as a state machine. It depends only on typing_extensions and supports Python 3.9 through 3.13, with full type hints throughout. Use it for: - Implement protocol-based state machines for complex objects like network connections, protocol handlers, or device controllers that need strict state ordering. - Build workflow engines or task schedulers where transitions between states must be explicit and validated at definition time. - Create deterministic finite-state transducers that transform input sequences into output behaviors while maintaining clean, method-call-based APIs. - Model state-dependent behavior in game logic, UI state management, or embedded systems where invalid state combinations must be impossible. - Define type-safe state machines for async systems where each state transition can trigger side effects or return computed results. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Automat provides a Python library for building finite-state machines using type-safe, method-based interfaces rather than generic input/output objects, letting you organize stateful behavior while keeping a clean API. Yes, if you need to model stateful behavior with strict state ordering and want a clean, type-safe API. The permissive MIT license and low install friction make it low-risk. However, the 485-day gap since the last release suggests the project is aging; verify that it meets your Python version requirements (3.9+) and that its approach fits your use case before committing to it as a core dependency. ## Install pip install automat uv add automat poetry add automat ## Installing Automat Before you install: Low install friction with a single lightweight runtime dependency (typing_extensions). Maintenance status is aging—last release was 485 days ago, though the repository remains active with a recent commit on 2026-01-13 and 647 stars. License in practice: MIT license (permissive) allows free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects. Quickstart: from automat import TypeMachineBuilder from typing import Protocol class MyStateMachine(Protocol): def event(self) -> None: pass builder = TypeMachineBuilder(MyStateMachine, CoreData) state_a = builder.state("state_a") state_b = builder.state("state_b") state_a.upon(MyStateMachine.event).to(state_b).returns(None) machine = builder.build() Requires Python 3.9 or later; familiarity with typing.Protocol and state machine concepts recommended. Verify before relying: - Whether the library is actively maintained or in maintenance-only mode given the 485-day gap since last release - Performance characteristics and scalability limits for complex state machines with many states or transitions - Real-world adoption patterns and whether it integrates well with async/await workflows ## Package facts - License: Copyright (c) 2014 Rackspace Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software… (full text in the JSON record) (permissive) - Python support: supports_current - Install friction: low - Maintenance: aging - Downloads: 14.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags finite state machine library, state machine python, fsm framework, typed state machines, deterministic automata, stateful behavior patterns, state transitions python, state-machine, type-safe, protocol-based [View on SkillFed](https://skillfed.io/packages/automat) · [View on PyPI](https://pypi.org/project/automat/)