Skip to content

API Reference

Complete reference documentation for PyStator's Python API. The following pages pull from the library docstrings (single source of truth).

Module overview

pystator
├── StateMachine, StateMachineBuilder   # FSM definition and processing
├── EntitySession                       # Stateful instance (create, send)
├── GuardRegistry, ActionRegistry       # Guards and actions
├── ActionExecutor                      # Run actions (sync/async, phased)
├── Orchestrator                        # Delayed transitions, state store
├── stores/                             # InMemory, SQLite, Postgres, MongoDB, Redis
├── errors/                             # FSMError and subclasses
└── lint                                # lint() for config validation
Topic Description
State Machine StateMachine, from_yaml, from_dict, process, aprocess, parallel states
Guards GuardRegistry, builtins (equals, greater_than, in_list, all_of, any_of)
Actions ActionRegistry, ActionExecutor, execution modes
Orchestrator State store, delayed transitions, sandwich pattern
Stores StateStoreClient, InMemoryStateStore, SQLiteStateStore, PostgresStateStore, etc.
Errors FSMError, ConfigurationError, InvalidTransitionError, and others
REST API Swagger and in-app API Playground

Import patterns

# Core
from pystator import StateMachine, EntitySession, Orchestrator

# Guards and actions
from pystator import GuardRegistry, ActionRegistry, ActionExecutor

# Stores
from pystator import InMemoryStateStore, SQLiteStateStore, PostgresStateStore

# Errors
from pystator import FSMError, InvalidTransitionError, GuardRejectedError

# Lint
from pystator import lint, LintWarning