Checkpointing and recovery protocol for AI agents
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
agentstateprotocol-0.1.0.tar.gz
(22.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentstateprotocol-0.1.0.tar.gz.
File metadata
- Download URL: agentstateprotocol-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b93f2d6ac8f88da26ffbd6d8be6e837ad8cb6c4b4c6966c3f3be40ec25c9721
|
|
| MD5 |
00219a68a0d6d842bba3f6b2b3427a29
|
|
| BLAKE2b-256 |
5b77aea42505dc09434b7537f91d94339b45e04ce0e0bce4362251069f5c78bc
|
File details
Details for the file agentstateprotocol-0.1.0-py3-none-any.whl.
File metadata
- Download URL: agentstateprotocol-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65421cac9a847a2f2a556a86b5243fe0a4da7e87e755aa72939be562711b9bef
|
|
| MD5 |
269ffe9b608fd718275d83f2739cc5dc
|
|
| BLAKE2b-256 |
6e7cc4ef17d71f98f7f42288741c15e537c4e77b57213d19e49d784cb20fa12c
|