Multi-agent coherence and coordination for AI systems
Project description
Convergent
Coordination library for multi-agent AI systems. Agents share an intent graph, detect overlaps before building, and converge on compatible outputs — eliminating rework cycles from parallel code generation.
Why This Exists
- Problem: Parallel AI agents generating code independently produce incompatible outputs. Agent A builds
UserwithintIDs while Agent B usesUUID. Code fails to merge. 2-3 rework cycles before anything integrates. - Audience: Multi-agent orchestration frameworks, distributed systems with autonomous agents, anyone running parallel AI code generation.
- Outcome: Agents publish what they're building to a shared intent graph. Before starting work, they check for overlaps and adopt existing decisions. Compatible output on first try. Zero rework.
What It Does
- Intent graph — Shared, append-only graph of architectural decisions. Agents publish intents (what they build, what they need) and query for overlaps
- Structural matching — Detect when two agents plan to build the same interface based on name, kind, and tag similarity
- Stability scoring — Evidence-weighted confidence (test passes, code commits, downstream consumers) determines which intent wins conflicts
- Constraint enforcement — Hard requirements that must hold (type checks pass, no circular deps) validated by subprocess gates
- Triumvirate voting — Phi-weighted consensus engine with configurable quorum (ANY, MAJORITY, UNANIMOUS)
- Stigmergy — Trail markers that agents leave for future agents, with exponential decay (inspired by ant pheromone trails)
- Flocking — Emergent group behavior from local rules: alignment (adopt patterns), cohesion (detect drift), separation (avoid file conflicts)
- Zero dependencies — Pure Python, stdlib only. Optional Rust acceleration via PyO3
Quickstart
Prerequisites
- Python 3.10+
Install
pip install convergentAI
# or from source:
git clone https://github.com/AreteDriver/convergent.git
cd convergent
pip install -e .
Run
from convergent import IntentResolver, PythonGraphBackend, Intent, InterfaceSpec
resolver = IntentResolver(backend=PythonGraphBackend())
# Agent A publishes what it's building
resolver.publish(Intent(
intent_id="auth-service",
agent_id="agent-a",
description="JWT authentication service",
interfaces=[
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
],
))
# Agent B checks for overlapping work before starting
overlaps = resolver.find_overlapping(Intent(
intent_id="user-module",
agent_id="agent-b",
description="User management",
interfaces=[
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
],
))
# → overlaps shows agent-a already owns the User class
# → agent-b adopts agent-a's schema instead of building its own
Usage Examples
Example 1: Persistent intent graph with SQLite
from convergent import IntentResolver, SQLiteBackend
# WAL mode, concurrent reads, persistent across restarts
resolver = IntentResolver(backend=SQLiteBackend("./intents.db"))
resolver.publish(intent)
# Inspect from CLI
# python -m convergent inspect ./intents.db --format table
Example 2: Consensus voting
from convergent import GorgonBridge, CoordinationConfig
bridge = GorgonBridge(CoordinationConfig(db_path="./coordination.db"))
# Request a vote
request_id = bridge.request_consensus(
task_id="pr-42",
question="Should we merge this PR?",
context="All tests pass, adds new auth endpoint",
)
# Agents vote (phi-weighted by historical trust)
bridge.submit_agent_vote(
request_id, "agent-1", "reviewer", "claude:sonnet",
"approve", 0.9, "LGTM"
)
decision = bridge.evaluate(request_id)
# → DecisionOutcome.APPROVED
Example 3: Enrich agent prompts with coordination context
context = bridge.enrich_prompt(
agent_id="agent-1",
task_description="implement auth",
file_paths=["src/auth.py"],
)
# → Returns stigmergy markers + flocking constraints + phi score context
# → Inject into agent's system prompt for coordination-aware generation
Architecture
Gorgon (orchestrator)
│
▼
┌── Convergent ───────────────────────────────────────┐
│ │
│ Coordination Protocol (Phase 3) │
│ ┌────────────┐ ┌───────────┐ ┌─────────┐ │
│ │ Triumvirate │ │ Stigmergy │ │Flocking │ │
│ │ (voting) │ │ (trails) │ │ (swarm) │ │
│ └──────┬──────┘ └─────┬─────┘ └────┬────┘ │
│ └───────┬───────┴─────────────┘ │
│ ▼ │
│ Intent Graph + Intelligence (Phase 1-2) │
│ ┌──────────────────────────────────────────┐ │
│ │ Resolver │ Contracts │ Governor │ Gates │ │
│ └──────────────────────────────────────────┘ │
│ ▼ │
│ ┌──────────────────────────────────────────┐ │
│ │ Python (memory) │ SQLite │ Rust (opt) │ │
│ └──────────────────────────────────────────┘ │
└──────────────────────────────────────────────────────┘
Key components:
| Component | Purpose |
|---|---|
IntentResolver |
Query the intent graph, detect overlaps, resolve conflicts |
MergeGovernor |
Three-layer decision authority: constraints → intents → economics |
Triumvirate |
Phi-weighted voting with configurable quorum levels |
StigmergyField |
Trail markers with exponential decay for indirect agent communication |
FlockingCoordinator |
Alignment, cohesion, separation rules for emergent coordination |
GorgonBridge |
Single entry point for orchestrator integration |
Testing
# Python-only (no Rust needed)
PYTHONPATH=python pytest tests/ -v
# With optional Rust acceleration
maturin develop --release && pytest tests/ -v
# Lint
ruff check python/ tests/ && ruff format --check python/ tests/
800+ tests, 99% coverage, CI green.
Roadmap
- v1.0.0 (current): Stable API contract, published to PyPI, PEP 561 py.typed
- v0.6.0: Pluggable signal bus (SQLite cross-process + filesystem), decision history query API
- v0.5.0: Coordination protocol (triumvirate voting, stigmergy, flocking, signal bus)
- v0.4.0: CLI inspector, async backend, Rust backend parity
License
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 convergentai-1.1.0.tar.gz.
File metadata
- Download URL: convergentai-1.1.0.tar.gz
- Upload date:
- Size: 161.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df6ad1a596d557fec591bc76337271baddec142e20dd9ee4c96f763bd792609a
|
|
| MD5 |
d59be98980ef0c50cfd1f990b78923e9
|
|
| BLAKE2b-256 |
21ebd96af240548521eaa9524693ca1aec80a97e711ecbe9ee767a3a2cc2ee3a
|
Provenance
The following attestation bundles were made for convergentai-1.1.0.tar.gz:
Publisher:
publish.yml on AreteDriver/convergent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convergentai-1.1.0.tar.gz -
Subject digest:
df6ad1a596d557fec591bc76337271baddec142e20dd9ee4c96f763bd792609a - Sigstore transparency entry: 963751998
- Sigstore integration time:
-
Permalink:
AreteDriver/convergent@ee20372eeabc715ee522c568da50085279106379 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/AreteDriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee20372eeabc715ee522c568da50085279106379 -
Trigger Event:
push
-
Statement type:
File details
Details for the file convergentai-1.1.0-py3-none-any.whl.
File metadata
- Download URL: convergentai-1.1.0-py3-none-any.whl
- Upload date:
- Size: 108.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cdf0d7057ead7d08a968a3075eb17c43dc24bd29d6c5a2605037b616becdf92
|
|
| MD5 |
b99ffcaabcbd95ba7aa4efd54a666efe
|
|
| BLAKE2b-256 |
e5cc40b35d56e1e0e1d09b1411d19bafb42b428a0569a07ac6d9beecf96a736e
|
Provenance
The following attestation bundles were made for convergentai-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on AreteDriver/convergent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
convergentai-1.1.0-py3-none-any.whl -
Subject digest:
2cdf0d7057ead7d08a968a3075eb17c43dc24bd29d6c5a2605037b616becdf92 - Sigstore transparency entry: 963752071
- Sigstore integration time:
-
Permalink:
AreteDriver/convergent@ee20372eeabc715ee522c568da50085279106379 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/AreteDriver
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@ee20372eeabc715ee522c568da50085279106379 -
Trigger Event:
push
-
Statement type: