A multi-agent software engineering framework where architecture is decided before a single line of implementation is written. Agents implement independently, in parallel, even competitively — with no way to ship code that doesn't honor its contract.
pip install pact-agents
Every multi-agent coding framework has the same problem: how do you know the code is right? Advisory coordination doesn't work. "Looks good to me" doesn't scale.
Pact's answer: make the tests first, make them mechanical, and let agents iterate until they pass. No negotiation. No review boards. Pass or fail.
Code is cheap — agents generate it in minutes. Contracts are expensive — they encode hard-won understanding of what the system actually needs to do. Pact makes that inversion explicit.
"When a module fails in production, the response isn't 'debug the implementation.' It's: add a test that reproduces the failure, flush the implementation, and let an agent rebuild it. The contract got stricter. The next implementation can't have that bug."
Contracts accumulate the scar tissue of every production incident. They become the real engineering artifact.
No human judgment in the loop at verification time. The pipeline either passes or it doesn't.
When agents write the code, the contracts, tests, and verification become the real product.
Tasks decompose into 2-7 components. Each gets a typed interface contract and executable tests before any implementation begins.
Independent components implement concurrently. No agent waits on another. Semaphore-limited concurrency keeps costs predictable.
N agents race on the same component. Best implementation wins — scored by test pass rate and execution time. The contract is the judge.
Generate contracts, stubs, and implementations in Python, TypeScript, or plain JavaScript ES6 modules with JSDoc. Vitest for TS/JS, pytest for Python.
Route different roles to different LLMs. Opus for architecture, Sonnet for tests, GPT-4o for implementation. Anthropic, OpenAI, and Gemini supported.
Per-project spend tracking with content-aware token estimation. Set a budget, let agents work. Multi-window caps prevent runaway costs.
Stop after contracts and tests. Review the architecture. Then target specific components with pact build. Full control over what gets built and when.
Run pact audit after implementation to verify every requirement in your spec is covered. Get a gap report showing what's covered, partial, or missing.
The pipeline monitors its own coordination health. Detects the $50-planning-zero-output pattern, cascade failures, and budget stalls. Proposes remedies — you decide.
When health degrades, Pact pauses and proposes fixes via FIFO directive. No silent config changes. The system never reduces its own degrees of freedom without asking.
Agents do. The Sentinel watches production logs, detects errors, and attributes them to the right component via embedded PACT log keys.
It spawns a knowledge-flashed fixer agent loaded with the full contract and test context, adds a reproducer test, rebuilds the module, and verifies all tests pass. The contract ensures no regressions.
You review the contract change in the morning. Not the code.
Python 3.12+, two dependencies. pip install pact-agents and go.
Generates Python, TypeScript, or JavaScript.
Describe your task in task.md, set your standards in sops.md,
and let Pact decompose, contract, and build.
# Install from PyPI
pip install pact-agents
# Or with all LLM backends
pip install pact-agents[all-backends]
# Create a project
pact init my-project
# Edit my-project/task.md with your task
# Edit my-project/sops.md with your standards
# Run the pipeline
pact run my-project
# Or go step by step
pact run my-project --plan-only
pact components my-project
pact build my-project auth_module
Pact is one of three systems built to test the ideas in Beyond Code: Context, Constraints, and the New Craft of Software. The book covers the coordination, verification, and specification problems that motivated Pact's design.
Read the Book