Skip to content

Latest commit

Β 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

README.md

Grid Balancing Swarm

Autonomous energy trading using Agent OS

"Watch 100 DER agents negotiate grid stability in real-time."

🎬 Demo Video

Grid Balancing Demo

Script (60 seconds):

[0:00] "Grid operator announces price spike at 6 PM."
[0:10] [Dashboard: 100 DER agents activate]
[0:20] [Agents negotiating: Solar-01 bids 50kW @ $0.15]
[0:30] [Consensus forming: 15 agents reach agreement]
[0:40] [Grid frequency: 60.02 Hz - stable]
[0:50] "100 agents. 30 second negotiation. Zero policy violations."

πŸš€ Quick Start (One Command)

cd examples/grid-balancing
cp .env.example .env
docker-compose up

# Wait 30 seconds, then open:
# β†’ http://localhost:8082  (Demo UI)
# β†’ http://localhost:3002  (Grafana Dashboard - admin/admin)
# β†’ http://localhost:16688 (Jaeger Traces)

πŸ“Š Live Dashboard

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Grid Balancing - DER Coordination       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ DERs Active:             100            β”‚
β”‚ Grid Load:               450 MW         β”‚
β”‚ Grid Frequency:          60.02 Hz       β”‚
β”‚ Negotiations/sec:        1,247          β”‚
β”‚ Consensus Rate:          97.3%          β”‚
β”‚ Policy Violations:       0              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Overview

This demo simulates a distributed energy grid with 100 Distributed Energy Resources (DERs):

  • Solar panels
  • Home batteries
  • Electric vehicles

When the grid operator broadcasts a price signal, agents autonomously negotiate to balance supply and demand.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     GRID OPERATOR                                   β”‚
β”‚                  "Price spike at 6 PM"                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           β”‚ AMB (Agent Message Bus)
                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    100 DER AGENTS                                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”               β”‚
β”‚  β”‚ Solar-01 β”‚ β”‚Battery-15β”‚ β”‚  EV-42   β”‚ β”‚ Solar-99 β”‚  ...          β”‚
β”‚  β”‚ forecast β”‚ β”‚  trader  β”‚ β”‚ dispatch β”‚ β”‚ forecast β”‚               β”‚
β”‚  β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜               β”‚
β”‚       β”‚            β”‚            β”‚            β”‚                      β”‚
β”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                      β”‚
β”‚                          β”‚                                          β”‚
β”‚              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                              β”‚
β”‚              β”‚   IATP Policy Check   β”‚                              β”‚
β”‚              β”‚   (Signed Contracts)  β”‚                              β”‚
β”‚              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Agent Types

1. Forecast Agent

  • Predicts solar output using weather data
  • Publishes forecasts to AMB topic: grid/forecast

2. Trader Agent

  • Listens for grid operator price signals
  • Bids battery discharge capacity
  • Uses IATP to sign binding contracts

3. Dispatch Agent (Mute Agent)

  • Only acts when IATP-signed contract received
  • Controls actual battery discharge
  • Returns NULL if contract invalid

Key Features

Agent Message Bus (AMB)

  • 1,000+ messages/second throughput
  • Priority lanes for emergency signals
  • Backpressure to prevent cascade failures

Inter-Agent Trust Protocol (IATP)

  • Agents verify each other's signatures
  • No action without signed contract
  • Tamper-proof audit trail

Policy Enforcement

  • Max discharge limits enforced at kernel level
  • IPC Pipes: trader | policy_check("max_discharge") | dispatch
  • Shadow Mode for testing without real dispatch

Quick Start

# Run the demo
docker-compose up

# Or run locally
pip install -e .
python demo.py

# Run with 100 agents
python demo.py --agents 100

# Run with price spike simulation
python demo.py --scenario price_spike

Demo Scenarios

Scenario 1: Price Spike

Grid operator broadcasts high price signal. Agents compete to sell stored energy.

Scenario 2: Solar Surplus

Too much solar generation. Agents coordinate to store excess.

Scenario 3: Emergency

Grid frequency drops. Agents respond in <100ms with emergency discharge.

Metrics

Metric Value
Agents 100
Negotiations/minute 1,000+
Average latency 15ms
Policy violations 0
Grid stabilization time <30 seconds

License

MIT