Skip to main content

anagrapheus

CI PyPI Python License: BSD-3-Clause

An event-sourced timeline, belief store and identity layer for long-running LLM agents. One append-only event log is the authoritative record of a run; per-agent beliefs, entity identity, a consolidated history and assembled prompts are all projections of it that can be dropped and rebuilt. Every model call made through PinnedModel, and every tool wrapped with pinned_tool, is pinned to the log, so a recorded run replays offline, exactly, without reaching the model, and a run whose prompts have changed reports where it diverged instead of quietly drawing new answers.

It is for Python developers building agents and simulations that run for many turns and hold private beliefs about each other: negotiations, games, interactive fiction. It builds on pydantic-ai for the model call and works with any provider pydantic-ai supports.

Installation

anagrapheus needs Python 3.14 or later.

pip install anagrapheus  # or: uv add anagrapheus

The base install runs offline. To call a real provider, add its extra: anagrapheus[anthropic] or anagrapheus[openai] (the OpenAI SDK, also used for OpenAI-compatible routes such as OpenRouter).

Documentation

anentropic.github.io/anagrapheus has a getting-started tutorial, how-to guides for each layer, explanations of the design, and the API reference.

A worked example, a four-round EU and UK negotiation that uses every layer, lives in examples/negotiation/. From a clone, run it offline with uv run python -m examples.negotiation.

Development

See DEVELOP.md for the full guide.

Setup

# Install dependencies (the dev group includes the anthropic and openai extras)
uv sync --dev

# Install git hooks
prek install

Quality gates

Before committing, run the hooks:

prek run --all-files  # file hygiene, ruff lint and format, uv lock, basedpyright, blacken-docs

The hooks do not run the tests. Run each gate individually with:

uv run basedpyright         # Type checking (strict mode)
uv run ruff check           # Linting
uv run ruff format --check  # Formatting
uv run pytest               # Tests

uv run pytest skips the live smoke tests, which reach a real provider. Opt in with uv run pytest -m tier3, which needs an API key for at least one of the routes in tests/tier3.

Docs

uv sync --dev --group docs
just docs-serve  # or: just docs-build

Both recipes regenerate CHANGELOG.md with git-cliff before building.

License

BSD-3-Clause. See LICENSE.

Metadata

Release files for anagrapheus 0.2.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 anagrapheus 0.2.0
File Size Uploaded Provenance
anagrapheus-0.2.0.tar.gz 118.9 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for anagrapheus 0.2.0
File Interpreter ABI Platform
anagrapheus-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 269.6 kB

Release files / anagrapheus-0.2.0.tar.gz

Download URL anagrapheus-0.2.0.tar.gz
Size 118.9 kB
Tags Source
SHA-256 checksum
How to use checksums
86ea1c65c5adc13e66b1f5c5e3a039de3861c6742b76c0514b5c8b78f2a33805
BLAKE2b-256 checksum
How to use checksums
b1f352b3eeecd4ef6268351112678b019f2d6dc1f840aa149f358bcaca165ad3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Release files / anagrapheus-0.2.0-py3-none-any.whl

Download URL anagrapheus-0.2.0-py3-none-any.whl
Size 150.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b07ca7b3f553cb9c37daf071ff9bba200d04dfd917245e05e7a86ac417c47ffb
BLAKE2b-256 checksum
How to use checksums
0f7a0c05878f83586b3a1f09cbefc0bf42fa6a609adaacc816af2adb614ae7c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

Security for anagrapheus 0.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anagrapheus-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 19, 2026.

Transparency log

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.

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