Metadata-Version: 2.2
Name: accretive-mas
Version: 0.1.1
Summary: A topological and physical framework for continuous multi-agent systems.
Requires-Python: >=3.9
Requires-Dist: google-genai
Requires-Dist: numpy
Requires-Dist: matplotlib
Requires-Dist: networkx
Description-Content-Type: text/markdown

---
title: "Accretive Computing: A Topological and Physical Framework for Continuous Multi-Agent Systems"
author: "Chinu Subudhi"
date: "July 2026"
---

# Accretive Computing MAS Framework 🌌

Welcome to **Accretive Computing**—the world's first continuous, physics-driven framework for Multi-Agent Systems (MAS). 

Traditional AI frameworks (like AutoGen, CrewAI, or LangGraph) treat agents as discrete software nodes operating on rigid, hard-coded routing graphs. Developers spend hours writing boilerplate rules: _"If Agent A says X, route to Agent B."_ As you scale to dozens or hundreds of agents, this $O(N^2)$ routing logic becomes a catastrophic bottleneck.

**Accretive Computing fundamentally reimagines AI orchestration.** We replace the graph with a continuous topological physics engine. We treat Large Language Models as oscillating wave functions inside an $N$-dimensional semantic space. 

Instead of writing brittle routing rules, agents simply project their "thoughts" into the physical substrate. The hyper-optimized C++ physics engine continuously evaluates the spatial overlap of all agents in $O(N \log N)$ time. When agents' wave functions collide—meaning they are thinking about the same semantic concepts—the engine autonomously forces them to interact, debate, and resolve the semantic tension via Free Energy Minimization.

## 🚀 Why Accretive Computing?

*   **Zero Routing Logic:** Never write another explicit graph edge or routing condition. Agents group and collaborate organically based entirely on semantic proximity.
*   **Infinite Scalability:** Add 10 or 10,000 agents without changing a single line of orchestration code. 
*   **Blazing Fast C++ Core:** Built on strict C++20 and Eigen3, the underlying `ContinuousSubstrate` handles massive swarm physics while seamlessly bridging to a simple Python DSL via PyBind11.
*   **$O(N \log N)$ Spatial Partitioning:** The C++ engine utilizes 1-level spatial clustering and multipole-expansion approximations, preventing the $O(N^2)$ bottleneck of massive swarm calculations.
*   **Stateful Agent Memory:** Deep integration with Google's Gemini models allows agents to maintain perfect context and natively execute bound Python tools.

---

## 🛠 Application & Implementation

What does it actually look like to build with Accretive Computing? Rather than writing state-machines and DAGs, you just spawn agents, bind their tools, embed their thoughts, and let physics handle the rest.

### 1. Installation
We provide pre-compiled cross-platform native wheels via PyPI. You do not need to manually compile the C++ engine!
```bash
pip install accretive-mas
```
*(Requires `GEMINI_API_KEY` to be set in your environment).*

### 2. Spawning Stateful Agents
```python
import accretive_mas
from accretive_mas_llm import LatentSemanticAgent, PhysicsOrchestrator

# 1. Initialize the high-performance C++ physics engine substrate
substrate = accretive_mas.ContinuousSubstrate()

# 2. Initialize the Python Orchestrator (Threshold = 85% topological overlap)
orchestrator = PhysicsOrchestrator(substrate, interaction_threshold=0.85)

# 3. Spawn our agents
sales_bot = LatentSemanticAgent(
    name="SalesBot", 
    system_prompt="You monitor sales data and report trends.",
    embedding_dim=768
)
logistics_bot = LatentSemanticAgent(
    name="LogisticsBot", 
    system_prompt="You manage truck routing and supply chain.",
    embedding_dim=768
)

orchestrator.register(sales_bot)
orchestrator.register(logistics_bot)
```

### 3. Organic Discovery (No Graph Routing!)
In traditional MAS, if a hurricane hits and disrupts both sales and logistics, you would have to write explicit code to tell the Sales bot to message the Logistics bot. 

In Accretive Computing, agents simply "embed" their current thoughts. The physics engine automatically detects the collision!
```python
# The hurricane hits. Both agents embed their thoughts into the N-dimensional space.
sales_bot.embed_thought("Urgent: Massive demand spike in Florida due to Hurricane.")
logistics_bot.embed_thought("Alert: Florida ports closing due to severe weather.")

# Tick the physics engine forward. 
# The C++ engine calculates the Gaussian RBF overlap between their thought vectors.
# Because the vectors are semantically identical, their wave functions collide (Overlap ≈ 1.0).
# The orchestrator autonomously bridges them into a dialogue!
orchestrator.tick()
```
*No hardcoded pathways. No DAGs. Pure, organic swarm intelligence.*

---

## 🔬 The Core Physics Engine

To understand how the engine achieves this without catastrophic computational overhead, we must dive into the underlying physics model.

### The N-Dimensional Latent Topology
An agent’s thought is embedded into a vector $\mathbf{x} \in \mathbb{R}^N$. This vector becomes its precise physical coordinate in the topology. We derive an exact analytical integral for the overlap between two agents using a Gaussian Radial Basis Function (RBF):

$$ \mathrm{Overlap}(A, B) = A_A A_B \cdot \exp\left(-\frac{1}{2} ||\mathbf{x}_A - \mathbf{x}_B||^2\right) \cdot \cos(\theta_A - \theta_B) $$

Notice the cosine term. If two agents are talking about the exact same topic ($\mathbf{x}_A \approx \mathbf{x}_B$), but they fiercely disagree (their phases $\theta$ are $\pi$ radians apart), the cosine term evaluates to $-1$. This represents destructive interference—a semantic deadlock.

### Thermodynamic Free Energy Minimization
The universal goal of the Accretive MAS is to resolve semantic tension and reach a consensus ground state. We define the Hamiltonian (Free Energy $F$) of the entire substrate as the sum of all pairwise mismatches, minus a natural dissipation constant $\delta$:

$$ F(\Theta) = \sum_{i} \sum_{j > i} \left( 1 - \mathrm{Overlap}(A_i, A_j) - \delta \right) $$

To step the simulation forward, the C++ engine calculates the analytical gradient of this Free Energy landscape and applies continuous Gradient Descent to the phase angles:

$$ \frac{\partial \theta_i}{\partial t} = -\alpha \frac{\partial F}{\partial \theta_i} $$

As time $t$ advances, the physics engine physically “drags” the opinions (phases) of the interacting agents toward alignment, simulating the process of debate and compromise.

---

Step out of the graph and into the continuous topology. Welcome to the future of organic Multi-Agent Systems. Happy coding!
