MacroSwarm
Overview
MacroSwarm is FNSE’s hierarchical agent orchestration engine. It manages populations of specialized agents that collaborate through structured message passing to achieve complex objectives.
Agent Roles
| Role | Purpose | Typical Count |
|---|---|---|
| Explorer | Discovers new solution spaces, generates diverse hypotheses | 30% |
| Optimizer | Refines promising solutions, gradient-based improvement | 25% |
| Critic | Evaluates solutions, identifies flaws, assigns quality scores | 20% |
| Synthesizer | Combines best ideas, creates hybrid solutions | 15% |
| Coordinator | Manages consensus, resolves conflicts, tracks global state | 10% |
Tick-Based Execution
Each simulation epoch runs for max_ticks or until convergence. Each tick follows this sequence:
sequenceDiagram
participant Scheduler
participant Agents
participant GraphRAG
participant SkillCompiler
participant MessageBus
participant Evaluator
participant Safeguards
Scheduler->>Agents: Wake agents for tick N
par Agent Think Phase
Agents->>GraphRAG: Query relevant knowledge
Agents->>SkillCompiler: Execute skills
end
Agents->>MessageBus: Publish messages
MessageBus->>Agents: Deliver messages
Agents->>Evaluator: Report results
Evaluator->>Safeguards: Check divergence/loss
Safeguards-->>Scheduler: Continue or halt
Tick Phases
- Wake — Scheduler activates agents based on role and priority
- Think — Agents query GraphRAG, execute skills, form decisions
- Act — Agents execute skills, produce outputs
- Communicate — Messages published to shared bus
- Evaluate — Loss computed, convergence checked
- Safeguard — Circuit breakers, divergence monitoring
- Checkpoint — State persisted to Redis (every N ticks)
Message Passing
Agents communicate via typed messages on Redis-backed channels:
# Message structure
{
"message_id": "msg_abc123",
"sender_id": "agent_exp_001",
"recipient": "broadcast", # or specific agent_id
"type": "proposal", # proposal, critique, synthesis, consensus
"payload": {...},
"tick": 42,
"timestamp": "2024-01-15T10:30:00Z"
}Message Types
- proposal — New solution or hypothesis
- critique — Evaluation of another agent’s proposal
- synthesis — Combined solution from multiple proposals
- consensus — Agreement on global direction
- alert — Safeguard-triggered warning
Consensus Protocols
MacroSwarm supports multiple consensus mechanisms:
Weighted Voting (Default)
Each role has a weight; Coordinator breaks ties.
Quorum-Based
Requires N-of-M agents to agree before committing.
Byzantine Fault Tolerant
For production deployments requiring adversarial resistance.
Dynamic Scaling
Agents can be added/removed mid-epoch through the MacroSwarm interface (not directly via REST API).
Configuration
macro_swarm:
max_agents: 100
min_agents: 5
default_roles:
- explorer
- optimizer
- critic
- synthesizer
- coordinator
role_distribution:
explorer: 0.30
optimizer: 0.25
critic: 0.20
synthesizer: 0.15
coordinator: 0.10
tick_interval_ms: 100
max_ticks: 1000
convergence_threshold: 0.01
checkpoint_interval_ticks: 10
message_ttl_seconds: 300API Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET | /health | Health check |
POST | /epochs | Create new epoch |
GET | /epochs | List all epochs |
GET | /epochs/{id} | Get epoch status |
POST | /epochs/{id}/tick | Advance epoch by one tick |
POST | /epochs/{id}/run | Run epoch to completion |
POST | /epochs/{id}/stop | Stop running epoch |
GET | /epochs/{id}/result | Get epoch result |
DELETE | /epochs/{id} | Delete epoch |
GET | /epochs/{id}/agents | List all agents in epoch |
GET | /epochs/{id}/agents/{agent_id} | Get agent state |
POST | /epochs/{id}/skills | Compile new skill |
GET | /epochs/{id}/skills | List skills for epoch |
GET | /epochs/{id}/skills/{skill_id} | Get skill details |
POST | /epochs/{id}/graph/seed | Seed graph entities |
POST | /epochs/{id}/graph/query | Query graph |
GET | /epochs/{id}/graph/stats | Get graph stats |
GET | /epochs/{id}/safeguards/status | Safeguard status |
GET | /epochs/{id}/alerts | Alert history |
POST | /epochs/{id}/alerts/{alert_id}/acknowledge | Acknowledge alert |
Next Steps
- GraphRAG Guide — Knowledge retrieval for agents
- SkillCompiler Guide — Skills agents execute
- Safeguards Guide — Safety during execution