convergentAI 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- convergentai-1.0.0/LICENSE +21 -0
- convergentai-1.0.0/PKG-INFO +222 -0
- convergentai-1.0.0/README.md +186 -0
- convergentai-1.0.0/pyproject.toml +77 -0
- convergentai-1.0.0/python/convergent/__init__.py +270 -0
- convergentai-1.0.0/python/convergent/__main__.py +126 -0
- convergentai-1.0.0/python/convergent/_serialization.py +98 -0
- convergentai-1.0.0/python/convergent/agent.py +262 -0
- convergentai-1.0.0/python/convergent/async_backend.py +73 -0
- convergentai-1.0.0/python/convergent/benchmark.py +543 -0
- convergentai-1.0.0/python/convergent/codegen_demo.py +580 -0
- convergentai-1.0.0/python/convergent/constraints.py +331 -0
- convergentai-1.0.0/python/convergent/contract.py +563 -0
- convergentai-1.0.0/python/convergent/coordination_config.py +50 -0
- convergentai-1.0.0/python/convergent/demo.py +380 -0
- convergentai-1.0.0/python/convergent/economics.py +333 -0
- convergentai-1.0.0/python/convergent/flocking.py +306 -0
- convergentai-1.0.0/python/convergent/gates.py +531 -0
- convergentai-1.0.0/python/convergent/gorgon_bridge.py +386 -0
- convergentai-1.0.0/python/convergent/governor.py +419 -0
- convergentai-1.0.0/python/convergent/intent.py +244 -0
- convergentai-1.0.0/python/convergent/matching.py +190 -0
- convergentai-1.0.0/python/convergent/protocol.py +269 -0
- convergentai-1.0.0/python/convergent/py.typed +0 -0
- convergentai-1.0.0/python/convergent/replay.py +211 -0
- convergentai-1.0.0/python/convergent/resolver.py +433 -0
- convergentai-1.0.0/python/convergent/rust_backend.py +165 -0
- convergentai-1.0.0/python/convergent/score_store.py +384 -0
- convergentai-1.0.0/python/convergent/scoring.py +190 -0
- convergentai-1.0.0/python/convergent/semantic.py +346 -0
- convergentai-1.0.0/python/convergent/signal_backend.py +244 -0
- convergentai-1.0.0/python/convergent/signal_bus.py +275 -0
- convergentai-1.0.0/python/convergent/sqlite_backend.py +227 -0
- convergentai-1.0.0/python/convergent/sqlite_signal_backend.py +216 -0
- convergentai-1.0.0/python/convergent/stigmergy.py +317 -0
- convergentai-1.0.0/python/convergent/triumvirate.py +299 -0
- convergentai-1.0.0/python/convergent/versioning.py +280 -0
- convergentai-1.0.0/python/convergent/visualization.py +213 -0
- convergentai-1.0.0/python/convergentAI.egg-info/PKG-INFO +222 -0
- convergentai-1.0.0/python/convergentAI.egg-info/SOURCES.txt +65 -0
- convergentai-1.0.0/python/convergentAI.egg-info/dependency_links.txt +1 -0
- convergentai-1.0.0/python/convergentAI.egg-info/requires.txt +13 -0
- convergentai-1.0.0/python/convergentAI.egg-info/top_level.txt +1 -0
- convergentai-1.0.0/setup.cfg +4 -0
- convergentai-1.0.0/tests/test_async_backend.py +174 -0
- convergentai-1.0.0/tests/test_benchmark_gates_demo.py +677 -0
- convergentai-1.0.0/tests/test_benchmarks.py +193 -0
- convergentai-1.0.0/tests/test_cli.py +177 -0
- convergentai-1.0.0/tests/test_contract.py +1053 -0
- convergentai-1.0.0/tests/test_convergence.py +738 -0
- convergentai-1.0.0/tests/test_coverage_push.py +1041 -0
- convergentai-1.0.0/tests/test_delegation_factory.py +30 -0
- convergentai-1.0.0/tests/test_flocking.py +301 -0
- convergentai-1.0.0/tests/test_gorgon_bridge.py +389 -0
- convergentai-1.0.0/tests/test_hooks.py +241 -0
- convergentai-1.0.0/tests/test_protocol.py +485 -0
- convergentai-1.0.0/tests/test_rust_backend.py +264 -0
- convergentai-1.0.0/tests/test_scoring.py +500 -0
- convergentai-1.0.0/tests/test_semantic.py +568 -0
- convergentai-1.0.0/tests/test_signal_backend.py +364 -0
- convergentai-1.0.0/tests/test_signal_bus.py +508 -0
- convergentai-1.0.0/tests/test_sqlite_backend.py +424 -0
- convergentai-1.0.0/tests/test_sqlite_signal_backend.py +320 -0
- convergentai-1.0.0/tests/test_stigmergy.py +265 -0
- convergentai-1.0.0/tests/test_three_layer.py +1105 -0
- convergentai-1.0.0/tests/test_triumvirate.py +530 -0
- convergentai-1.0.0/tests/test_visualization.py +246 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AreteDriver
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: convergentAI
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Multi-agent coherence and coordination for AI systems
|
|
5
|
+
Author: AreteDriver
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/AreteDriver/convergent
|
|
8
|
+
Project-URL: Repository, https://github.com/AreteDriver/convergent
|
|
9
|
+
Project-URL: Issues, https://github.com/AreteDriver/convergent/issues
|
|
10
|
+
Keywords: multi-agent,ai,orchestration,convergence,intent-graph
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Rust
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
31
|
+
Provides-Extra: llm
|
|
32
|
+
Requires-Dist: anthropic>=0.39.0; extra == "llm"
|
|
33
|
+
Provides-Extra: rust
|
|
34
|
+
Requires-Dist: maturin<2.0,>=1.0; extra == "rust"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# Convergent
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
[](https://github.com/AreteDriver/convergent/actions/workflows/ci.yml)
|
|
42
|
+
[](https://opensource.org/licenses/MIT)
|
|
43
|
+
[](https://www.python.org/downloads/)
|
|
44
|
+
[]()
|
|
45
|
+
[]()
|
|
46
|
+
|
|
47
|
+
## Why This Exists
|
|
48
|
+
|
|
49
|
+
- **Problem:** Parallel AI agents generating code independently produce incompatible outputs. Agent A builds `User` with `int` IDs while Agent B uses `UUID`. Code fails to merge. 2-3 rework cycles before anything integrates.
|
|
50
|
+
- **Audience:** Multi-agent orchestration frameworks, distributed systems with autonomous agents, anyone running parallel AI code generation.
|
|
51
|
+
- **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.
|
|
52
|
+
|
|
53
|
+
## What It Does
|
|
54
|
+
|
|
55
|
+
- **Intent graph** — Shared, append-only graph of architectural decisions. Agents publish intents (what they build, what they need) and query for overlaps
|
|
56
|
+
- **Structural matching** — Detect when two agents plan to build the same interface based on name, kind, and tag similarity
|
|
57
|
+
- **Stability scoring** — Evidence-weighted confidence (test passes, code commits, downstream consumers) determines which intent wins conflicts
|
|
58
|
+
- **Constraint enforcement** — Hard requirements that must hold (type checks pass, no circular deps) validated by subprocess gates
|
|
59
|
+
- **Triumvirate voting** — Phi-weighted consensus engine with configurable quorum (ANY, MAJORITY, UNANIMOUS)
|
|
60
|
+
- **Stigmergy** — Trail markers that agents leave for future agents, with exponential decay (inspired by ant pheromone trails)
|
|
61
|
+
- **Flocking** — Emergent group behavior from local rules: alignment (adopt patterns), cohesion (detect drift), separation (avoid file conflicts)
|
|
62
|
+
- **Zero dependencies** — Pure Python, stdlib only. Optional Rust acceleration via PyO3
|
|
63
|
+
|
|
64
|
+
## Quickstart
|
|
65
|
+
|
|
66
|
+
### Prerequisites
|
|
67
|
+
|
|
68
|
+
- Python 3.10+
|
|
69
|
+
|
|
70
|
+
### Install
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install convergent
|
|
74
|
+
# or from source:
|
|
75
|
+
git clone https://github.com/AreteDriver/convergent.git
|
|
76
|
+
cd convergent
|
|
77
|
+
pip install -e .
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Run
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from convergent import IntentResolver, PythonGraphBackend, Intent, InterfaceSpec
|
|
84
|
+
|
|
85
|
+
resolver = IntentResolver(backend=PythonGraphBackend())
|
|
86
|
+
|
|
87
|
+
# Agent A publishes what it's building
|
|
88
|
+
resolver.publish(Intent(
|
|
89
|
+
intent_id="auth-service",
|
|
90
|
+
agent_id="agent-a",
|
|
91
|
+
description="JWT authentication service",
|
|
92
|
+
interfaces=[
|
|
93
|
+
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
|
|
94
|
+
],
|
|
95
|
+
))
|
|
96
|
+
|
|
97
|
+
# Agent B checks for overlapping work before starting
|
|
98
|
+
overlaps = resolver.find_overlapping(Intent(
|
|
99
|
+
intent_id="user-module",
|
|
100
|
+
agent_id="agent-b",
|
|
101
|
+
description="User management",
|
|
102
|
+
interfaces=[
|
|
103
|
+
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
|
|
104
|
+
],
|
|
105
|
+
))
|
|
106
|
+
# → overlaps shows agent-a already owns the User class
|
|
107
|
+
# → agent-b adopts agent-a's schema instead of building its own
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Usage Examples
|
|
111
|
+
|
|
112
|
+
### Example 1: Persistent intent graph with SQLite
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from convergent import IntentResolver, SQLiteBackend
|
|
116
|
+
|
|
117
|
+
# WAL mode, concurrent reads, persistent across restarts
|
|
118
|
+
resolver = IntentResolver(backend=SQLiteBackend("./intents.db"))
|
|
119
|
+
resolver.publish(intent)
|
|
120
|
+
|
|
121
|
+
# Inspect from CLI
|
|
122
|
+
# python -m convergent inspect ./intents.db --format table
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Example 2: Consensus voting
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from convergent import GorgonBridge, CoordinationConfig
|
|
129
|
+
|
|
130
|
+
bridge = GorgonBridge(CoordinationConfig(db_path="./coordination.db"))
|
|
131
|
+
|
|
132
|
+
# Request a vote
|
|
133
|
+
request_id = bridge.request_consensus(
|
|
134
|
+
task_id="pr-42",
|
|
135
|
+
question="Should we merge this PR?",
|
|
136
|
+
context="All tests pass, adds new auth endpoint",
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
# Agents vote (phi-weighted by historical trust)
|
|
140
|
+
bridge.submit_agent_vote(
|
|
141
|
+
request_id, "agent-1", "reviewer", "claude:sonnet",
|
|
142
|
+
"approve", 0.9, "LGTM"
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
decision = bridge.evaluate(request_id)
|
|
146
|
+
# → DecisionOutcome.APPROVED
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Example 3: Enrich agent prompts with coordination context
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
context = bridge.enrich_prompt(
|
|
153
|
+
agent_id="agent-1",
|
|
154
|
+
task_description="implement auth",
|
|
155
|
+
file_paths=["src/auth.py"],
|
|
156
|
+
)
|
|
157
|
+
# → Returns stigmergy markers + flocking constraints + phi score context
|
|
158
|
+
# → Inject into agent's system prompt for coordination-aware generation
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
```text
|
|
164
|
+
Gorgon (orchestrator)
|
|
165
|
+
│
|
|
166
|
+
▼
|
|
167
|
+
┌── Convergent ───────────────────────────────────────┐
|
|
168
|
+
│ │
|
|
169
|
+
│ Coordination Protocol (Phase 3) │
|
|
170
|
+
│ ┌────────────┐ ┌───────────┐ ┌─────────┐ │
|
|
171
|
+
│ │ Triumvirate │ │ Stigmergy │ │Flocking │ │
|
|
172
|
+
│ │ (voting) │ │ (trails) │ │ (swarm) │ │
|
|
173
|
+
│ └──────┬──────┘ └─────┬─────┘ └────┬────┘ │
|
|
174
|
+
│ └───────┬───────┴─────────────┘ │
|
|
175
|
+
│ ▼ │
|
|
176
|
+
│ Intent Graph + Intelligence (Phase 1-2) │
|
|
177
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
178
|
+
│ │ Resolver │ Contracts │ Governor │ Gates │ │
|
|
179
|
+
│ └──────────────────────────────────────────┘ │
|
|
180
|
+
│ ▼ │
|
|
181
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
182
|
+
│ │ Python (memory) │ SQLite │ Rust (opt) │ │
|
|
183
|
+
│ └──────────────────────────────────────────┘ │
|
|
184
|
+
└──────────────────────────────────────────────────────┘
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Key components:**
|
|
188
|
+
|
|
189
|
+
| Component | Purpose |
|
|
190
|
+
|-----------|---------|
|
|
191
|
+
| `IntentResolver` | Query the intent graph, detect overlaps, resolve conflicts |
|
|
192
|
+
| `MergeGovernor` | Three-layer decision authority: constraints → intents → economics |
|
|
193
|
+
| `Triumvirate` | Phi-weighted voting with configurable quorum levels |
|
|
194
|
+
| `StigmergyField` | Trail markers with exponential decay for indirect agent communication |
|
|
195
|
+
| `FlockingCoordinator` | Alignment, cohesion, separation rules for emergent coordination |
|
|
196
|
+
| `GorgonBridge` | Single entry point for orchestrator integration |
|
|
197
|
+
|
|
198
|
+
## Testing
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
# Python-only (no Rust needed)
|
|
202
|
+
PYTHONPATH=python pytest tests/ -v
|
|
203
|
+
|
|
204
|
+
# With optional Rust acceleration
|
|
205
|
+
maturin develop --release && pytest tests/ -v
|
|
206
|
+
|
|
207
|
+
# Lint
|
|
208
|
+
ruff check python/ tests/ && ruff format --check python/ tests/
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
800+ tests, 99% coverage, CI green.
|
|
212
|
+
|
|
213
|
+
## Roadmap
|
|
214
|
+
|
|
215
|
+
- **v1.0.0** (current): Stable API contract, published to PyPI, PEP 561 py.typed
|
|
216
|
+
- **v0.6.0**: Pluggable signal bus (SQLite cross-process + filesystem), decision history query API
|
|
217
|
+
- **v0.5.0**: Coordination protocol (triumvirate voting, stigmergy, flocking, signal bus)
|
|
218
|
+
- **v0.4.0**: CLI inspector, async backend, Rust backend parity
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
# Convergent
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
[](https://github.com/AreteDriver/convergent/actions/workflows/ci.yml)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://www.python.org/downloads/)
|
|
8
|
+
[]()
|
|
9
|
+
[]()
|
|
10
|
+
|
|
11
|
+
## Why This Exists
|
|
12
|
+
|
|
13
|
+
- **Problem:** Parallel AI agents generating code independently produce incompatible outputs. Agent A builds `User` with `int` IDs while Agent B uses `UUID`. Code fails to merge. 2-3 rework cycles before anything integrates.
|
|
14
|
+
- **Audience:** Multi-agent orchestration frameworks, distributed systems with autonomous agents, anyone running parallel AI code generation.
|
|
15
|
+
- **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.
|
|
16
|
+
|
|
17
|
+
## What It Does
|
|
18
|
+
|
|
19
|
+
- **Intent graph** — Shared, append-only graph of architectural decisions. Agents publish intents (what they build, what they need) and query for overlaps
|
|
20
|
+
- **Structural matching** — Detect when two agents plan to build the same interface based on name, kind, and tag similarity
|
|
21
|
+
- **Stability scoring** — Evidence-weighted confidence (test passes, code commits, downstream consumers) determines which intent wins conflicts
|
|
22
|
+
- **Constraint enforcement** — Hard requirements that must hold (type checks pass, no circular deps) validated by subprocess gates
|
|
23
|
+
- **Triumvirate voting** — Phi-weighted consensus engine with configurable quorum (ANY, MAJORITY, UNANIMOUS)
|
|
24
|
+
- **Stigmergy** — Trail markers that agents leave for future agents, with exponential decay (inspired by ant pheromone trails)
|
|
25
|
+
- **Flocking** — Emergent group behavior from local rules: alignment (adopt patterns), cohesion (detect drift), separation (avoid file conflicts)
|
|
26
|
+
- **Zero dependencies** — Pure Python, stdlib only. Optional Rust acceleration via PyO3
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
### Prerequisites
|
|
31
|
+
|
|
32
|
+
- Python 3.10+
|
|
33
|
+
|
|
34
|
+
### Install
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install convergent
|
|
38
|
+
# or from source:
|
|
39
|
+
git clone https://github.com/AreteDriver/convergent.git
|
|
40
|
+
cd convergent
|
|
41
|
+
pip install -e .
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Run
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from convergent import IntentResolver, PythonGraphBackend, Intent, InterfaceSpec
|
|
48
|
+
|
|
49
|
+
resolver = IntentResolver(backend=PythonGraphBackend())
|
|
50
|
+
|
|
51
|
+
# Agent A publishes what it's building
|
|
52
|
+
resolver.publish(Intent(
|
|
53
|
+
intent_id="auth-service",
|
|
54
|
+
agent_id="agent-a",
|
|
55
|
+
description="JWT authentication service",
|
|
56
|
+
interfaces=[
|
|
57
|
+
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
|
|
58
|
+
],
|
|
59
|
+
))
|
|
60
|
+
|
|
61
|
+
# Agent B checks for overlapping work before starting
|
|
62
|
+
overlaps = resolver.find_overlapping(Intent(
|
|
63
|
+
intent_id="user-module",
|
|
64
|
+
agent_id="agent-b",
|
|
65
|
+
description="User management",
|
|
66
|
+
interfaces=[
|
|
67
|
+
InterfaceSpec(name="User", kind="class", tags=["auth", "model"]),
|
|
68
|
+
],
|
|
69
|
+
))
|
|
70
|
+
# → overlaps shows agent-a already owns the User class
|
|
71
|
+
# → agent-b adopts agent-a's schema instead of building its own
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Usage Examples
|
|
75
|
+
|
|
76
|
+
### Example 1: Persistent intent graph with SQLite
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from convergent import IntentResolver, SQLiteBackend
|
|
80
|
+
|
|
81
|
+
# WAL mode, concurrent reads, persistent across restarts
|
|
82
|
+
resolver = IntentResolver(backend=SQLiteBackend("./intents.db"))
|
|
83
|
+
resolver.publish(intent)
|
|
84
|
+
|
|
85
|
+
# Inspect from CLI
|
|
86
|
+
# python -m convergent inspect ./intents.db --format table
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Example 2: Consensus voting
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from convergent import GorgonBridge, CoordinationConfig
|
|
93
|
+
|
|
94
|
+
bridge = GorgonBridge(CoordinationConfig(db_path="./coordination.db"))
|
|
95
|
+
|
|
96
|
+
# Request a vote
|
|
97
|
+
request_id = bridge.request_consensus(
|
|
98
|
+
task_id="pr-42",
|
|
99
|
+
question="Should we merge this PR?",
|
|
100
|
+
context="All tests pass, adds new auth endpoint",
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
# Agents vote (phi-weighted by historical trust)
|
|
104
|
+
bridge.submit_agent_vote(
|
|
105
|
+
request_id, "agent-1", "reviewer", "claude:sonnet",
|
|
106
|
+
"approve", 0.9, "LGTM"
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
decision = bridge.evaluate(request_id)
|
|
110
|
+
# → DecisionOutcome.APPROVED
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Example 3: Enrich agent prompts with coordination context
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
context = bridge.enrich_prompt(
|
|
117
|
+
agent_id="agent-1",
|
|
118
|
+
task_description="implement auth",
|
|
119
|
+
file_paths=["src/auth.py"],
|
|
120
|
+
)
|
|
121
|
+
# → Returns stigmergy markers + flocking constraints + phi score context
|
|
122
|
+
# → Inject into agent's system prompt for coordination-aware generation
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Architecture
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
Gorgon (orchestrator)
|
|
129
|
+
│
|
|
130
|
+
▼
|
|
131
|
+
┌── Convergent ───────────────────────────────────────┐
|
|
132
|
+
│ │
|
|
133
|
+
│ Coordination Protocol (Phase 3) │
|
|
134
|
+
│ ┌────────────┐ ┌───────────┐ ┌─────────┐ │
|
|
135
|
+
│ │ Triumvirate │ │ Stigmergy │ │Flocking │ │
|
|
136
|
+
│ │ (voting) │ │ (trails) │ │ (swarm) │ │
|
|
137
|
+
│ └──────┬──────┘ └─────┬─────┘ └────┬────┘ │
|
|
138
|
+
│ └───────┬───────┴─────────────┘ │
|
|
139
|
+
│ ▼ │
|
|
140
|
+
│ Intent Graph + Intelligence (Phase 1-2) │
|
|
141
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
142
|
+
│ │ Resolver │ Contracts │ Governor │ Gates │ │
|
|
143
|
+
│ └──────────────────────────────────────────┘ │
|
|
144
|
+
│ ▼ │
|
|
145
|
+
│ ┌──────────────────────────────────────────┐ │
|
|
146
|
+
│ │ Python (memory) │ SQLite │ Rust (opt) │ │
|
|
147
|
+
│ └──────────────────────────────────────────┘ │
|
|
148
|
+
└──────────────────────────────────────────────────────┘
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Key components:**
|
|
152
|
+
|
|
153
|
+
| Component | Purpose |
|
|
154
|
+
|-----------|---------|
|
|
155
|
+
| `IntentResolver` | Query the intent graph, detect overlaps, resolve conflicts |
|
|
156
|
+
| `MergeGovernor` | Three-layer decision authority: constraints → intents → economics |
|
|
157
|
+
| `Triumvirate` | Phi-weighted voting with configurable quorum levels |
|
|
158
|
+
| `StigmergyField` | Trail markers with exponential decay for indirect agent communication |
|
|
159
|
+
| `FlockingCoordinator` | Alignment, cohesion, separation rules for emergent coordination |
|
|
160
|
+
| `GorgonBridge` | Single entry point for orchestrator integration |
|
|
161
|
+
|
|
162
|
+
## Testing
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
# Python-only (no Rust needed)
|
|
166
|
+
PYTHONPATH=python pytest tests/ -v
|
|
167
|
+
|
|
168
|
+
# With optional Rust acceleration
|
|
169
|
+
maturin develop --release && pytest tests/ -v
|
|
170
|
+
|
|
171
|
+
# Lint
|
|
172
|
+
ruff check python/ tests/ && ruff format --check python/ tests/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
800+ tests, 99% coverage, CI green.
|
|
176
|
+
|
|
177
|
+
## Roadmap
|
|
178
|
+
|
|
179
|
+
- **v1.0.0** (current): Stable API contract, published to PyPI, PEP 561 py.typed
|
|
180
|
+
- **v0.6.0**: Pluggable signal bus (SQLite cross-process + filesystem), decision history query API
|
|
181
|
+
- **v0.5.0**: Coordination protocol (triumvirate voting, stigmergy, flocking, signal bus)
|
|
182
|
+
- **v0.4.0**: CLI inspector, async backend, Rust backend parity
|
|
183
|
+
|
|
184
|
+
## License
|
|
185
|
+
|
|
186
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "convergentAI"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Multi-agent coherence and coordination for AI systems"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "AreteDriver" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["multi-agent", "ai", "orchestration", "convergence", "intent-graph"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 5 - Production/Stable",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Rust",
|
|
26
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
27
|
+
"Topic :: Software Development :: Libraries",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
dependencies = []
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
dev = [
|
|
34
|
+
"pytest>=7.0",
|
|
35
|
+
"pytest-asyncio>=0.21",
|
|
36
|
+
"pytest-benchmark>=4.0",
|
|
37
|
+
"ruff>=0.1.0",
|
|
38
|
+
"mypy>=1.0",
|
|
39
|
+
]
|
|
40
|
+
llm = [
|
|
41
|
+
"anthropic>=0.39.0",
|
|
42
|
+
]
|
|
43
|
+
rust = [
|
|
44
|
+
"maturin>=1.0,<2.0",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/AreteDriver/convergent"
|
|
49
|
+
Repository = "https://github.com/AreteDriver/convergent"
|
|
50
|
+
Issues = "https://github.com/AreteDriver/convergent/issues"
|
|
51
|
+
|
|
52
|
+
[tool.setuptools.packages.find]
|
|
53
|
+
where = ["python"]
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
asyncio_mode = "auto"
|
|
58
|
+
|
|
59
|
+
[tool.ruff]
|
|
60
|
+
target-version = "py310"
|
|
61
|
+
line-length = 100
|
|
62
|
+
|
|
63
|
+
[tool.ruff.lint]
|
|
64
|
+
select = ["E", "F", "W", "I", "N", "UP", "B", "A", "SIM"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint.per-file-ignores]
|
|
67
|
+
"python/convergent/contract.py" = ["N818"] # ContractViolation is the public API name
|
|
68
|
+
|
|
69
|
+
[tool.coverage.run]
|
|
70
|
+
omit = [
|
|
71
|
+
"python/convergent/semantic.py",
|
|
72
|
+
"python/convergent/demo.py",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.mypy]
|
|
76
|
+
python_version = "3.10"
|
|
77
|
+
strict = true
|