AgentStateProtocol
Checkpointing and recovery protocol for AI agents.
AgentStateProtocol lets an agent save state at each reasoning step, branch into alternatives, and roll back safely after failures.
Install
pip install agentstateprotocol
Quick Start
from agentstateprotocol import AgentStateProtocol
agent = AgentStateProtocol("my-agent")
agent.checkpoint(
state={"task": "summarize quarterly report", "stage": "parsed"},
metadata={"confidence": 0.91},
description="Initial parse",
logic_step="parse_input",
)
agent.checkpoint(
state={"task": "summarize quarterly report", "stage": "drafted"},
metadata={"confidence": 0.86},
description="Draft generated",
logic_step="draft_summary",
)
# Roll back one step if needed
agent.rollback()
Core Operations
agent.checkpoint(...): save a state snapshotagent.rollback(...): restore a previous checkpointagent.branch(name): start an alternate reasoning pathagent.switch_branch(name): move between branchesagent.merge(source_branch): merge branch outcomesagent.history(): inspect checkpoint timelineagent.visualize_tree(): show decision tree
Decorators
from agentstateprotocol.decorators import agentstateprotocol_step
@agentstateprotocol_step("analyze")
def analyze(state):
return {"result": "ok", **state}
Storage
from agentstateprotocol.storage import FileSystemStorage, SQLiteStorage
file_storage = FileSystemStorage(".agentstateprotocol")
sqlite_storage = SQLiteStorage(".agentstateprotocol/agentstateprotocol.db")
CLI
agentstateprotocol demo
agentstateprotocol log
agentstateprotocol tree
agentstateprotocol branches
agentstateprotocol diff <checkpoint_a> <checkpoint_b>
agentstateprotocol metrics
Project
- Repository: https://github.com/ekessh/agentstateprotocol
- License: MIT
Release files for agentstateprotocol 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 | |
|---|---|---|---|
| agentstateprotocol-0.1.0.tar.gz | 22.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| agentstateprotocol-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.2 kB
Release files / agentstateprotocol-0.1.0.tar.gz
| Download URL | agentstateprotocol-0.1.0.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b93f2d6ac8f88da26ffbd6d8be6e837ad8cb6c4b4c6966c3f3be40ec25c9721
|
|
BLAKE2b-256 checksum How to use checksums |
5b77aea42505dc09434b7537f91d94339b45e04ce0e0bce4362251069f5c78bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / agentstateprotocol-0.1.0-py3-none-any.whl
| Download URL | agentstateprotocol-0.1.0-py3-none-any.whl |
|---|---|
| Size | 24.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65421cac9a847a2f2a556a86b5243fe0a4da7e87e755aa72939be562711b9bef
|
|
BLAKE2b-256 checksum How to use checksums |
6e7cc4ef17d71f98f7f42288741c15e537c4e77b57213d19e49d784cb20fa12c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|