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.3.1

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.3.1
File Size Uploaded Provenance Actions
anagrapheus-0.3.1.tar.gz 122.3 kB With provenance Details for anagrapheus-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 277.3 kB

Release files / anagrapheus-0.3.1.tar.gz

Download URL anagrapheus-0.3.1.tar.gz
Size 122.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1ea235c7b2d5f551f82c0d44505ca2e052528645ba0ee83f08bdaf45ff60f5cc
BLAKE2b-256 checksum
How to use checksums
2ba9114770f504cb93448918dc1ddcbd21818a6b7a0d15b577f6f8bc0f9b2cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 4, 2026.

Transparency log

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

Download URL anagrapheus-0.3.1-py3-none-any.whl
Size 155.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ec25e837f01cafda4b88e7838f7465173cb93441417d9d3a53338f2f6d256d4
BLAKE2b-256 checksum
How to use checksums
b1a863fbc0cbba4afce2e6eda8af4ad0e3524564000726ee6b627585cb07e037
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 4, 2026.

Transparency log

Security for anagrapheus 0.3.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anagrapheus-0.3.1.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 Nov 4, 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