Skip to main content

A deterministic finite state machine for modeling workflows that guide AI agents.

Project description

markov-protocols

A Finite State Machine capable of modeling workflows to provide guidance to an AI agent with determinism.

A standalone Python module providing the state-machine mechanism, meant to be reused across other Python projects.

Status

Slices 1–3 complete — the engine is functionally whole:

  • Definition — conditions, references, metadata, the State interface with three concrete state types, transitions, the registry, and Workflow.compile().
  • RuntimeBlackboard, the Event history, Directive materialization, and Session.start/update with the write + fast-forward passes.
  • Integrity — a correction (ValueChanged) reopens the states that depend on it, strict-rewinds to the earliest one, clears reopened actions' outputs so they re-run, and flags had_executed for host compensation. All derived from history — no parallel bookkeeping.

See docs/DESIGN.md for the full architecture and build plan.

Development

Managed with uv.

uv sync            # create the environment and install dev tools
uv run pytest      # run the test suite
uv run ruff check  # lint
uv run mypy        # type-check

Layout

src/markov_protocols/
    __init__.py        # curated public API
    result.py          # Result[T, E] / ErrorType — the error-handling pattern
    base.py            # StrictModel / StrictOpenModel
    slug.py            # deterministic title -> id
    conditions/        # the typed boolean vocabulary + pure evaluator
    references.py      # Ref + resolve + referenced_fields
    definition/        # metadata, State interface + concrete states, Transition,
                       #   registry, Workflow.compile()
    runtime/           # Blackboard, Event history, Session + update() pipeline
tests/                 # one property-focused module per unit

Conventions

  • Operations return a Result[T, E] instead of raising exceptions.
  • Target Python 3.13+.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

markov_protocols-0.1.0.tar.gz (20.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

markov_protocols-0.1.0-py3-none-any.whl (31.4 kB view details)

Uploaded Python 3

File details

Details for the file markov_protocols-0.1.0.tar.gz.

File metadata

  • Download URL: markov_protocols-0.1.0.tar.gz
  • Upload date:
  • Size: 20.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for markov_protocols-0.1.0.tar.gz
Algorithm Hash digest
SHA256 41bfb948d77e9172639a5b4e027933d73926d43209aa9fc791d83ba3015bc6e8
MD5 b1a8474d1e87308dd2fe747c03467d56
BLAKE2b-256 643d77e70811e91d73ad6150a8da7072514b9b3c7956fdf4b3f81f39cb9b45e8

See more details on using hashes here.

File details

Details for the file markov_protocols-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markov_protocols-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for markov_protocols-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52161f8a209cec88b75e8880dfbdb86fb1f5e044ab480a2152e01bd6fe48813a
MD5 5a11ce3608a87c1553c47a214f9f5a00
BLAKE2b-256 7be43842a0f6f0fde7c8f24488dcdb369b3dd8663c2c2b564bd0202781f7ee57

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page