mellea-pratt (simple)
The "act fast" version of pratt: an agent loop over guarded actions
{pre, act, post}, extending Mellea's Instruct-Validate-Repair to open loops.
No automata compilation / improving search here.
from mellea_pratt import pratt_agent
agent = pratt_agent(actions=[
{"pre": pre_1, "act": act_1, "post": post_1},
...
], state={...}, goal=lambda s: ...)
result = agent.run() # result.status in {"goal", "deadlock", "max_steps", "error"}
Semantics (shielding, as in Verifiably Safe RL)
Each step:
enabled= actions whosepre(state)is true (an action that failedmax_attemptstimes since the last successful step is excluded);policy(enabled, state)picks one (first_enableddefault,random_policy(seed), orLLMPolicy(session)which asks a Mellea session to name an action);act(state)runs; it may mutatestateor return a dict of updates;post(state)is checked. On failure (or ifactraises),on_post_failuredecides:"rollback"(default; restore a deep-copy snapshot and count the failure),"raise"(PostconditionError), or"continue"(keep the state).
The loop stops when goal(state) holds, nothing is enabled (deadlock), or
max_steps attempts were made.
State
State is a dict with attribute access (s.x == s["x"]; use s["items"] for
keys that shadow dict methods), plus s.step, s.trace (list of TraceEntry,
including failed attempts) and s.history (names of successful actions).
Conditions
pre, post and goal may be a Python callable state -> bool, an English
string, or a mellea.Requirement. Strings/Requirements are judged by
condition_verifier=(condition: str, state) -> bool; without one a
MissingVerifierError is raised. LLMConditionVerifier(session) is a
Mellea-backed verifier (lazily starts a session; not needed by tests).
Run
uv pip install -e '.[test]'
pytest
python examples/coding_agent.py
Metadata
Release files for mellea-pratt 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mellea_pratt-0.1.0.tar.gz | 8.6 kB | Without provenance | Details for mellea_pratt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mellea_pratt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mellea_pratt-0.1.0-py3-none-any.whl |
Total release size: 17.0 kB
Release files / mellea_pratt-0.1.0.tar.gz
| Download URL | mellea_pratt-0.1.0.tar.gz |
|---|---|
| Size | 8.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ec5db6f53a23453ba11308a73a24cdbe015efb13695a6c619b7c58017040ed0b
|
|
BLAKE2b-256 checksum How to use checksums |
28d183029a5ceebdfb888eeb58452d020ecfa5d4f813348cbab813905a5488e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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}
|
Release files / mellea_pratt-0.1.0-py3-none-any.whl
| Download URL | mellea_pratt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d283f39c9fb39ea79895a84119b178254fc22ded4280769a2d84753fab11f6f
|
|
BLAKE2b-256 checksum How to use checksums |
081573592fb6f52ecb2717495e21abf9f76eda659b8203c92ff250cd4a80ae8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","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}
|
Security for mellea-pratt 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.