skillfed

Automat

Self-service finite-state machines for the programmer on the go.

automat v25.4.16 14.3M downloads/30d#1,239 on PyPI647
Permissive 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) AGING released

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 on this page — 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

automat on PyPI

pip

pip install automat

uv

uv add automat

poetry

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 the current Python release (>=3.9)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing_extensions
Maintenance aging — 485 days since the last release
Last repo commit
First released
Downloads 14,296,962/month — #1,239 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: automat-25.4.16-py3-none-any.whl

Keywords: fsm, state machine, automata

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.9Typing :: Typed

Tags

finite state machine librarystate machine pythonfsm frameworktyped state machinesdeterministic automatastateful behavior patternsstate transitions python
state-machinetype-safeprotocol-based

More Software Development packages