Skip to main content

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 snapshot
  • agent.rollback(...): restore a previous checkpoint
  • agent.branch(name): start an alternate reasoning path
  • agent.switch_branch(name): move between branches
  • agent.merge(source_branch): merge branch outcomes
  • agent.history(): inspect checkpoint timeline
  • agent.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

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)

Source distribution for agentstateprotocol 0.1.0
File Size Uploaded
agentstateprotocol-0.1.0.tar.gz 22.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentstateprotocol 0.1.0
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page