feat: anton_state SDK + artifact lifecycle integration for stateful artifacts#259
Open
StpMax wants to merge 6 commits into
Open
feat: anton_state SDK + artifact lifecycle integration for stateful artifacts#259StpMax wants to merge 6 commits into
StpMax wants to merge 6 commits into
Conversation
StpMax
marked this pull request as ready for review
July 20, 2026 11:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds durable state support for
fullstack-stateful-appartifacts on the anton side(ENG-704): a
STATESDK with twointerchangeable drivers, and its integration into the artifact lifecycle
(backend template, generation rules, publish bundle, local runs).
1.
anton_state— the STATE SDK (new top-level package)One async
StoreAPI (get / put / delete / query, TTL, conditional writes /optimistic locking) over two drivers behind a common
Driverprotocol:sqlite3, WAL mode, items stored as JSON.passed via
backend.STATE; capped retries, throttle →StateThrottled.boto3 is imported lazily — the local SQLite path needs no boto3 at all.
Parity by construction — the API is the intersection of both backends, and
known divergences are eliminated in driver code rather than left to generation
prompts:
cap, TTL must be an epoch-seconds number);
ConsistentRead=Trueby default on base-table reads → read-after-write behavesthe same locally and in the cloud;
see expired "zombies" identically;
float ↔ Decimalconversion in the DynamoDB driver (numbers round-trip as plainPython numbers on both drivers);
don't combine TTL with conditional writes on the same key.
Schema is a single source of truth:
state_manifest.json(declarative,pydantic-validated) is read both by backend code (
open_store()/StateSchema.from_manifest) and by the publish/provisioning pipeline — code andprovisioned table cannot drift by construction. Migrations are out of scope for
v1 (key-schema must match on republish; enforced by the provisioning gate in
mindshub_services).
Driver selection mirrors
SECRETS:backend.STATE is None→ SQLite;{table, region, credentials}dict (overlaid by the cloud runner) → DynamoDB.2. Lifecycle integration
anton_statepackage into every fullstack bundle(version-locked, no package index needed at runtime); ships
state_manifest.jsonin the bundle and duplicates it in the publish payloadfor the provisioning pipeline; defensively excludes
.anton_state.db(+
-wal/-shm) from bundles.anton_stateisn't installed — the launcher injects an isolated PYTHONPATHdir exposing only the
anton_statepackage (symlink, copy fallback), soanton's own dependencies never shadow the backend venv's. Covers
cowork-server too (it calls
launch_artifact_backend).prompts.py): module-levelSTATE = Noneslot symmetricto
SECRETS, aget_store()pattern with__file__-relative paths; includedonly for
fullstack-stateful-app.STATEis positioned for light state (counters,settings, sessions, simple keyed documents); heavy/relational needs go to an
external connected database — not forced into KV.
Packaging note
anton_stateis added to[tool.hatch.build.targets.wheel].packages— not topublish it standalone, but because anton itself imports it at runtime
(
publisher._vendor_anton_state,backend_launcher._anton_state_pythonpath_dir):the wheel is the source both vendoring and local injection copy from. New deps
(
boto3,moto) are dev-only; anton's runtime dependencies are unchanged.Out of scope (follow-ups in other repos)
boundaries), runner
backend.STATEoverlay, table provisioning at publish:mindshub_services+terraformPRs.Until those land, published stateful artifacts get
STATE = Nonein the cloud;local behavior is fully functional.
Testing
pytest tests/test_anton_state/ tests/test_publisher_state.py tests/test_backend_launcher_env.py tests/test_prompts_state.pywrites, optimistic locking, TTL zombies, GSI queries, number round-trips;
schema);
checks;