An agent orchestration framework to grow your AI's context.
Project description
Image Credit: Gemini Pro, April 2026
Petri
An agent orchestration framework to grow your AI's context. Decomposes claims into DAGs of logical units and validates them bottom-up through a multi-agent adversarial review pipeline.
Cost Warning
Petri uses Claude via Claude Code, which costs money. Each node goes through 13 agents across multiple iterations, generating significant token usage. A single colony with 10+ nodes can produce thousands of LLM calls across Socratic analysis, research, critique, debate, red team, and evaluation phases.
The default model is claude-sonnet-4-6. You can switch models in petri.yaml or the setup wizard:
model:
name: claude-opus-4-6 # most capable, higher cost
Monitor your usage. Start with small claims to understand the cost profile before running large colonies.
Prerequisites
1. Python 3.11+
Petri requires Python 3.11 or later. Check your version:
python3 --version
If you need a newer version, uv can install one for you:
# Install uv (package manager)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create a virtual environment with Python 3.11
uv venv --python 3.11 .venv
source .venv/bin/activate # macOS/Linux
# .venv\Scripts\activate # Windows
2. Claude Code
Petri uses Claude Code as its agentic harness for inference.
Install: https://docs.anthropic.com/en/docs/claude-code
Verify it's working:
claude --version
Verify everything
petri inspect
This checks all prerequisites and reports what's missing.
Install
# Recommended (with uv)
uv pip install petri-grow
# Or with pip
pip install petri-grow
This installs the CLI and core library. Claude Code must be authenticated (see above).
Quickstart
# 1. Initialize a petri dish
mkdir my-research && cd my-research
petri init
# → Initialized petri dish 'my-research' at /path/to/my-research
# Model: claude-sonnet-4-6
# 2. Seed a colony from a claim
petri seed "A hotdog is a sandwich" --no-questions
# → Colony 'hotdog-sandwich' created with 6 nodes across 3 levels
# 3. Check status
petri check
# → Shows a table of all nodes with status PENDING
# 4. Grow nodes through the validation pipeline
petri grow --all
# → Processes nodes bottom-up: Socratic → Research → Critique → Red Team → Evaluation
# 5. Feed new evidence (requires nodes that have completed validation)
petri feed https://arxiv.org/abs/2026.12345
# → Ingests content, matches to relevant nodes, flags for re-validation
# 6. Analyze
petri analyze --graph # text tree / DOT export
petri analyze --dashboard # REST + SSE API on port 8090
petri analyze --scan --fix # contradiction scanner
# → --graph shows the colony DAG; --dashboard opens a live web UI
# 7. Stop
petri stop
# → Gracefully halts any active processing
See ARCHITECTURE.md for the full pipeline and state machine details.
CLI Reference
petri --help
| Command | Description | Key Flags |
|---|---|---|
petri init |
Create .petri/ directory with defaults |
--name |
petri seed <claim> |
Decompose a claim into a colony DAG | --no-questions, --colony |
petri check |
Show node statuses across colonies | --colony, --node, --json |
petri grow |
Run nodes through the validation pipeline | --all, --colony, --dry-run, --max-concurrent |
petri feed <source> |
Ingest new evidence and flag affected nodes | --colony, --auto-reopen |
petri analyze |
Visualization and diagnostics | --graph, --dashboard, --scan, --fix |
petri stop |
Gracefully halt active processing | --force |
petri inspect |
Check that all prerequisites are installed |
Typical workflow:
petri init-- one-time setuppetri seed "your claim"-- decompose into a colonypetri grow --all-- validate bottom-up (cells first, then parents)petri check-- inspect progresspetri feed <url>-- add evidence, re-open affected nodespetri grow --all-- re-validate impacted nodespetri analyze --graph-- view the final colony structure
Note:
petri grow --allprocesses all currently eligible nodes. For multi-level colonies, run it multiple times until all levels are resolved — cells validate first, unlocking their parents.
How It Works
Each node in the colony goes through:
- Socratic questioning -- Clarify terms, challenge assumptions, identify what evidence is needed
- Research phase -- Investigator gathers evidence, Freshness Checker verifies currency, Dependency Auditor checks prerequisites
- Critique phase -- Specialist agents assess in parallel, Node Lead mediates structured debates
- Convergence check -- All blocking verdicts must pass (mechanical check, no LLM)
- Circuit breaker -- Max 3 iterations per cycle; if not converged, flags for human guidance
- Red Team -- Dedicated adversarial phase builds the strongest case against the node
- Evidence Evaluation -- Neutral weighing of all evidence: VALIDATED, DISPROVEN, or DEFER
Every action is logged as an immutable event in the node's JSONL file, identified by a composite key ({dish}-{colony}-{level}-{seq}-{8hex}).
Architecture
- Multi-agent pipeline: lead orchestrators + specialists (blocking and advisory)
- Event sourcing: append-only JSONL per node, rolled up to SQLite for the dashboard
- Queue state machine: enforced transitions, file-locked for concurrency
- Harness-agnostic: core uses only stdlib + Pydantic; adapters bridge to Claude Code and future harnesses
See ARCHITECTURE.md for the full design, state machine diagram, and agent details.
Development
uv pip install -e ".[all]"
uv run pytest tests/
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
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 petri_grow-0.2.1.tar.gz.
File metadata
- Download URL: petri_grow-0.2.1.tar.gz
- Upload date:
- Size: 12.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d5f0de389057e2cf68d129a71ec128f04c93618285214eeabd6340d9c7fd837
|
|
| MD5 |
43bc47e6b44c991c0007171850bcb860
|
|
| BLAKE2b-256 |
0a5cb3daed3018946bfb97c33f627c5df68ef6e945766df920c15da1dfda74cb
|
Provenance
The following attestation bundles were made for petri_grow-0.2.1.tar.gz:
Publisher:
publish.yml on onthemarkdata/petri
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
petri_grow-0.2.1.tar.gz -
Subject digest:
6d5f0de389057e2cf68d129a71ec128f04c93618285214eeabd6340d9c7fd837 - Sigstore transparency entry: 1245970567
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@37c97c70618102144dbded3321a2088ae2153f55 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c97c70618102144dbded3321a2088ae2153f55 -
Trigger Event:
release
-
Statement type:
File details
Details for the file petri_grow-0.2.1-py3-none-any.whl.
File metadata
- Download URL: petri_grow-0.2.1-py3-none-any.whl
- Upload date:
- Size: 12.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7acdf9126ac367d2397a9f842125013a2a14f13be40f5f75208bfaf589daa397
|
|
| MD5 |
a8722c77bd72a6272bee68e6d9806a07
|
|
| BLAKE2b-256 |
149f1909141483a77af7d3d8d82e316b34a0263728f31f3d86c443ee1bef8fd0
|
Provenance
The following attestation bundles were made for petri_grow-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on onthemarkdata/petri
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
petri_grow-0.2.1-py3-none-any.whl -
Subject digest:
7acdf9126ac367d2397a9f842125013a2a14f13be40f5f75208bfaf589daa397 - Sigstore transparency entry: 1245970568
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@37c97c70618102144dbded3321a2088ae2153f55 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@37c97c70618102144dbded3321a2088ae2153f55 -
Trigger Event:
release
-
Statement type: