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 13-agent adversarial review pipeline.
Cost Warning
Petri's multi-agent pipeline can be expensive with paid LLM models. Each node goes through 13 agents across multiple iterations, generating significant token usage.
By default, Petri uses gemma4:4b — a free, local model that requires no API keys or billing. This protects you from unexpected costs while you explore the framework.
All inference routes through Claude Code, which handles model routing automatically — local models via Ollama, cloud models via the Anthropic API. Switching models is opt-in via petri.yaml or the setup wizard:
model:
name: claude-sonnet-4-6
Understand the cost implications before switching to cloud models: a single colony with 10+ nodes can generate thousands of LLM calls across Socratic analysis, research, critique, debate, red team, and evaluation phases.
Prerequisites
- Claude Code — Petri uses Claude Code as its agentic harness.
- Ollama — Required for local models. Claude Code connects to Ollama automatically (setup guide).
# Install Ollama and pull the default model
ollama pull gemma4:4b
Install
uv pip install petri-grow
This installs the CLI and core library. No API keys required for local models.
Fallback (pip):
pip install petri-grow
Quickstart
# 1. Initialize
mkdir my-research && cd my-research
petri init
# 2. Seed a colony from a claim
petri seed "A hotdog is a sandwich"
# 3. Check status
petri check
# 4. Grow nodes through the validation pipeline
petri grow --all
# 5. Feed new evidence
petri feed https://arxiv.org/abs/2026.12345
# 6. Analyze
petri analyze --graph # text tree / DOT export
petri analyze --dashboard # REST + SSE API on port 8090
petri analyze --scan --fix # contradiction scanner
# 7. Stop
petri stop
See specs/001-petri/quickstart.md for the full walkthrough.
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 |
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:
- Research phase -- Investigator gathers evidence, Freshness Checker verifies currency
- Critique phase -- 6 specialist agents assess in parallel, Node Lead mediates 4 structured debates
- Convergence check -- All 6 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
- 13 agents: 3 lead orchestrators + 10 specialists (6 blocking, 4 advisory)
- Event sourcing: append-only JSONL per node, rolled up to SQLite for the dashboard
- Queue state machine: 13 states with enforced transitions, file-locked for concurrency
- Harness-agnostic: core uses only stdlib + Pydantic; adapters bridge to Claude Code and future harnesses
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.1.0.tar.gz.
File metadata
- Download URL: petri_grow-0.1.0.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 |
a977da57ca3c513f13d9fdced205de34ae8e93714d717796023117a9f829ccd4
|
|
| MD5 |
312dc428e598c48cf352d88b9699aa18
|
|
| BLAKE2b-256 |
1ccefec423be53d8d294b0b83c92848a175a8c96916dcf330ad0e092a233e6e3
|
Provenance
The following attestation bundles were made for petri_grow-0.1.0.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.1.0.tar.gz -
Subject digest:
a977da57ca3c513f13d9fdced205de34ae8e93714d717796023117a9f829ccd4 - Sigstore transparency entry: 1245632500
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@cf0933a984080706498377c91c143f58f2a77a20 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf0933a984080706498377c91c143f58f2a77a20 -
Trigger Event:
release
-
Statement type:
File details
Details for the file petri_grow-0.1.0-py3-none-any.whl.
File metadata
- Download URL: petri_grow-0.1.0-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 |
998c2a4ebb865de95c1e808dc7dd45a9e3c9f950a8d5c741dc95765ef0a02aa0
|
|
| MD5 |
5e287f88e88bfeaa3dfa8cceace3458e
|
|
| BLAKE2b-256 |
5a25b7be2821f37037072ea0d3adc0aacf8add9785e2a5c751e11198d9fbca2b
|
Provenance
The following attestation bundles were made for petri_grow-0.1.0-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.1.0-py3-none-any.whl -
Subject digest:
998c2a4ebb865de95c1e808dc7dd45a9e3c9f950a8d5c741dc95765ef0a02aa0 - Sigstore transparency entry: 1245632504
- Sigstore integration time:
-
Permalink:
onthemarkdata/petri@cf0933a984080706498377c91c143f58f2a77a20 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/onthemarkdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@cf0933a984080706498377c91c143f58f2a77a20 -
Trigger Event:
release
-
Statement type: