Multi-agent coordination through stigmergy - agents coordinate via environmental traces, not explicit messaging
Project description
Anthills ๐
Multi-agent coordination without explicit messaging.
Inspired by ant colonies, where simple agents leave chemical trails (pheromones) that other agents sense and respond to โ creating emergent swarm intelligence.
The Idea
Most multi-agent frameworks require explicit coordination: Agent A tells Agent B what to do. Message passing. Explicit protocols.
Anthills does the opposite. Agents:
- Perceive the shared environment (pheromone board)
- Think independently using Claude
- Act on the environment (call tools)
- Leave traces for other agents to sense
No explicit messaging. No central coordinator. Just local behavior creating emergent coordination.
Agent A finds research โ leaves trace
Agent B senses trace โ builds on it
Agent C senses both โ generates code
All coordinating like an ant colony.
Why This Matters
- Scalable: Add more agents, they self-organize
- Resilient: Agents fail independently, others adapt
- Simple: Each agent is dumb; intelligence emerges
- Transparent: You can see what agents are sensing/doing
Quick Start
pip install -r requirements.txt
export ANTHROPIC_API_KEY="sk-..."
python examples/research_agents.py
How It Works
The Pheromone Board
Shared memory where agents leave traces:
pheromone.deposit("research", {
"topic": "LLM reasoning",
"findings": ["extended thinking works", "costs are high"],
"source": "agent_research"
})
Agent Loop
agent = Agent(name="researcher", tools=[web_search, read_file])
while not done:
traces = pheromone.read("research") # Perceive
next_action = agent.think(traces) # Think
result = agent.act(next_action) # Act
pheromone.deposit("research", result) # Leave trace
Example: Two Agents, No Explicit Messaging
Agent A (Researcher):
- Reads pheromone board
- Thinks: "I should research X"
- Acts: calls web_search
- Deposits: "Found 3 papers"
Agent B (Synthesizer):
- Reads pheromone board
- Senses A's deposit: "3 papers found"
- Thinks: "I should synthesize these"
- Acts: calls code_exec to process
- Deposits: "Synthesis complete"
No message passing. No protocol. Just traces in the environment.
Examples
research_agents.pyโ Two agents researching a topic togethert1d_simulation.pyโ Type 1 Diabetes pathophysiology model (see below)debug_agents.pyโ Three agents debugging code collaborativelybuild_agents.pyโ Agents building a feature end-to-end
Real-World Application: Type 1 Diabetes Simulation
[NEW] Anthills models the multi-agent dynamics of Type 1 Diabetes.
The Biology
T1D emerges from anthills-like coordination failure:
BetaCells โ ImmuneSystem (no direct messaging)
โ (sense pheromones)
Glucose, Insulin, Cytokines, Antigens
โ
Local responses โ Emergent autoimmunity
- Genetic predisposition โ HLA genes increase autoimmune risk
- Environmental trigger โ Viral infection breaks tolerance
- Beta cell autoimmunity โ Immune attacks insulin-producing cells (no central controller)
- Positive feedback โ Cell death โ more inflammation โ more attack
- Clinical T1D โ ~80% beta cell loss โ insulin-dependent diabetes
Run the Simulation
python examples/t1d_simulation.py
This runs two scenarios:
- High-risk: Genetic predisposition + viral trigger โ Fast T1D onset
- Low-risk: Genetic resistance, no trigger โ Slower/no progression
The output shows day-by-day progression of glucose, insulin, inflammation, and beta cell count.
Project Structure
anthills/
โโโ README.md
โโโ requirements.txt
โโโ anthills/
โ โโโ __init__.py
โ โโโ agent.py # Base Agent class
โ โโโ pheromone.py # Shared environment
โ โโโ tools.py # Tool definitions
โ โโโ llm.py # Claude integration
โโโ examples/
โ โโโ research_agents.py
โ โโโ debug_agents.py
โ โโโ build_agents.py
โโโ tests/
โโโ test_agent.py
Philosophy
This is not a general-purpose agent framework. It's a specific take: agents coordinating through environmental traces, not explicit messaging.
Use it when you want:
- Multiple agents collaborating on complex tasks
- Self-organization without central orchestration
- Transparent, auditable agent behavior
- Resilience to individual agent failures
Roadmap
- Multi-pheromone types (strength, TTL, priority)
- Agent memory (persistent traces)
- Visualization (see the pheromone board in real-time)
- Streaming agent responses
- More tools (code execution, file I/O, external APIs)
Building This in Public
This project is being built on Twitter: @braz_builds
Daily updates on architecture, insights, and use cases.
Built with Claude + Python + Anthills vibes ๐
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 anthills-0.1.0.tar.gz.
File metadata
- Download URL: anthills-0.1.0.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d29f1d3e19f2a1873c114c6b75711d2f6cee53c2c573e526b1e2d98179bf7ba
|
|
| MD5 |
71c54c29c0aec1c1bd8bc5d44fd144e1
|
|
| BLAKE2b-256 |
9f5b43dd0847c0f6e84ff22e9ebc2c2f4356b81378634bd90524b7e17b13c4e6
|
Provenance
The following attestation bundles were made for anthills-0.1.0.tar.gz:
Publisher:
publish.yml on t1dm-ai/anthills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anthills-0.1.0.tar.gz -
Subject digest:
2d29f1d3e19f2a1873c114c6b75711d2f6cee53c2c573e526b1e2d98179bf7ba - Sigstore transparency entry: 1059217056
- Sigstore integration time:
-
Permalink:
t1dm-ai/anthills@d7094a2460b157dcc6e24e6cc50043ccff978d7f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/t1dm-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7094a2460b157dcc6e24e6cc50043ccff978d7f -
Trigger Event:
release
-
Statement type:
File details
Details for the file anthills-0.1.0-py3-none-any.whl.
File metadata
- Download URL: anthills-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.6 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 |
111f9aebda5c0d963613f30a55fe8f712bbac9b83759933c625b09397f61a1ee
|
|
| MD5 |
dfbd5c4765627985d6742149b1ad355b
|
|
| BLAKE2b-256 |
296a8a22480774e39bbcded55059e3104204f0896ec72c838a3d2ec1b2022ba2
|
Provenance
The following attestation bundles were made for anthills-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on t1dm-ai/anthills
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
anthills-0.1.0-py3-none-any.whl -
Subject digest:
111f9aebda5c0d963613f30a55fe8f712bbac9b83759933c625b09397f61a1ee - Sigstore transparency entry: 1059217082
- Sigstore integration time:
-
Permalink:
t1dm-ai/anthills@d7094a2460b157dcc6e24e6cc50043ccff978d7f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/t1dm-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d7094a2460b157dcc6e24e6cc50043ccff978d7f -
Trigger Event:
release
-
Statement type: