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.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 anagrapheus 0.1.0
File Size Uploaded
anagrapheus-0.1.0.tar.gz 116.4 kB Details

Built distribution (wheel)

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

Total release size: 264.6 kB

Release files / anagrapheus-0.1.0.tar.gz

Download URL anagrapheus-0.1.0.tar.gz
Size 116.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8b6db15c0e46fdb8e9ced0d13028c463307dbdedb4c093bf7891d101e40643d9
BLAKE2b-256 checksum
How to use checksums
17bff5db1c70c4087341943f19057cdef77216904152029d7046bfa37f0cb32c
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 13, 2026.

Transparency log

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

Download URL anagrapheus-0.1.0-py3-none-any.whl
Size 148.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0099260c3bd2714a66a3231714b07a15fb9ff34edbc57321322503ca398b9ecd
BLAKE2b-256 checksum
How to use checksums
c6e0e45271ecb7898726b036eec1bd3255fedb9e9c022ecb4e28d708ea38dac9
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 13, 2026.

Transparency log

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