Project Info
Inspiration
Energy costs represent 30-40% of AI infrastructure spend at the hyperscale companies. Yet workload routing is static; we route code and models to regions without considering the actual physical state of the grid. Electricity wholesale prices swing 10x intraday, and cooling efficiency is thermodynamically linked to ambient temperature; even the materials used to produce power are not the same across the country. California runs 100% renewels during solar peaks; Texas burns coal at night, meanwhile, nobody is optimising for this. We asked, What if routing decisions were made in real time, physics-aware, and carbon-conscious? What it Does Ingests live grid data from 3 US datacenter regions (San Jose/CAISO, Ashburn/PJM, Austin/ERCOT): wholesale prices, carbon intensity, 24-hour forecasts, and ambient temperature. Scores regions on normalized cost, facility efficiency (PUE), carbon, and latency. Presets for Training (carbon-first), Inference (latency-first), Batch (cost-first). Claude's agent decides which region to route to—now or defer to a cleaner hour—with reasoning backed by actual numbers. The model judges; C++ does the math. Takes real action: Opens a GitHub PR with a Kubernetes manifest pinned to the chosen region, or boots a real Fly.io machine in that region. Verifiable. Auto-cleaned. Fleet autopilot routes entire job queues autonomously, accumulating savings with Claude-written explanations.
How we built it
Layer 1: Data Ingestion (Node.js/Next.js) Parallel API calls via Promise.allSettled() 3-second timeouts per API Graceful fallbacks to historical data Layer 2: Optimization Engine (C++ → WebAssembly) Priority queue for O(1) optimal region lookup Thermodynamic PUE scaling based on live temperature Compiled via Emscripten: 10x faster than JavaScript Layer 3: Autonomous Agent (Claude Sonnet 4.6) Tool-use pattern with 5 callable functions Claude autonomously chains tools and makes routing decisions Explains reasoning and acknowledges risks Layer 4: Dashboard (React/Tailwind/Recharts) Real-time region matrix, cost calculator, carbon forecast Claude's full analysis with risk warnings *Layer 5: MCP * -fully built MCP allowing calls from agents and AI, fully autonomous workflow
Challenges we ran into
Finding real price data: Our first source (EIA) returns demand in MWH, not price, so we switched to GridStatus.io real-time LMP/SPP feed. Finding real price data: Our first source (EIA) returns demand in MWH, not price, so we switched to GridStatus.io real-time LMP/SPP feed. Score normalizations: carbon intensity (hundreds) initially swamped price and PUE, so weights and presents didn't change the ranking until we normalized every factor onto a common scale. Score normalizations: carbon intensity (hundreds) initially swamped price and PUE, so weights and presents didn't change the ranking until we normalized every factor onto a common scale. Making the agent fast: a multi-step tool chain, extended thinking took 30-40 seconds. We preloaded all the data into one forced tool call and dropped to 7 seconds while not losing any decision quality. Making the agent fast: a multi-step tool chain, extended thinking took 30-40 seconds. We preloaded all the data into one forced tool call and dropped to 7 seconds while not losing any decision quality. Free tier rate limits: GridStatus 1-req/s + monthly quota forced sequential cached fetching. Free tier rate limits: GridStatus 1-req/s + monthly quota forced sequential cached fetching.
Accomplishments we're proud of
Built a full loop system: not just a dashboard that recommends, but an agent that decides within guardrails and provisions real compute in the region that the math determined was the most optimal. Built a full loop system: not just a dashboard that recommends, but an agent that decides within guardrails and provisions real compute in the region that the math determined was the most optimal. A real Fly.io machine booting in the agent-selected region. A real Fly.io machine booting in the agent-selected region.
What we learned
LLMs can't do it all, using an LLM or agent where it would be truly beneficial and not just to say we have it in our tech stack. -Guardrails belong in code, not in a prompt: filter the choice before the model -Context is king: pre-loading data into one call is dramatically faster than letting the agent fetch it step by step
What's next
f3or Gridmind LLMs can't do it all, using an LLM or agent where it would be truly beneficial and not just to say we have it in our tech stack. -Guardrails belong in code, not in a prompt: filter the choice before the model -Context is king: pre-loading data into one call is dramatically faster than letting the agent fetch it step by step What's next f3or Gridmind Bring your own cloud: each enterprise connects their own system so the agent can route into the customer's infrastructure ( Slurm, AWS/GCP), not a pooled account) Bring your own cloud: each enterprise connects their own system so the agent can route into the customer's infrastructure ( Slurm, AWS/GCP), not a pooled account)
GridMind
Carbon- and cost-aware compute routing. GridMind watches the live electricity grid and routes compute workloads to the cheapest, cleanest region and time — then an AI agent decides and takes real action, all within hard policy guardrails.
🔗 Live demo: https://gridmind-six.vercel.app
The problem
AI and large-scale compute are exploding in both cost and carbon. But where and when you run a workload matters enormously:
- Wholesale electricity prices swing wildly by region and by hour — sometimes negative (surplus solar in California) and sometimes 3–5× higher elsewhere on the same grid.
- Grid carbon intensity varies just as much: a job in California at midday can be ~50 gCO₂/kWh while the same job in another region is ~400.
Yet teams typically pick a cloud region once, statically, and run everything there — leaving real money and emissions on the table. GridMind closes that gap.
What it does
Live grid data → Agent decides (where + when) → Guardrails → Real action
(price/carbon/ (Claude, with reasoning (policy enforced (GitHub PR
forecast/latency) + deterministic scoring) in code) or real deploy)
- Pulls live data — real-time wholesale prices (GridStatus.io), grid carbon intensity + 24h forecast (Electricity Maps), and weather (OpenWeatherMap) for three real regions: San Jose (CAISO), Ashburn (PJM), Austin (ERCOT).
- Scores every region on a normalized blend of cost, efficiency (PUE), carbon, and latency — weights are tunable, with presets for Training (carbon-first), Inference (latency-first), and Batch (cost-first).
- An AI routing agent (Claude) chooses the region and whether to run now or defer to a cleaner upcoming hour, and explains its reasoning.
- Guardrails are enforced in code — policy constraints (allowed regions, max latency, max carbon) hard-filter the candidates before the model sees them, so it physically cannot violate them. All cost/CO₂ numbers are recomputed deterministically: the model judges, the code does the arithmetic.
- It takes real action:
- GitOps PR — opens a real GitHub pull request with a Kubernetes manifest pinned to the chosen region.
- Real deploy — boots an actual Fly.io machine in the chosen region (
sjc/iad/dfw), then auto-destroys it.
- Fleet Autopilot — a continuous scheduler routes a queue of jobs to the best region/time on its own, accumulating savings, with periodic LLM-written operator briefings.
How the agent works
/api/decideruns the routing agent. It pre-loads the live conditions, forecast, and projected costs, then makes a single forced-tool call (Claude Sonnet 4.6) that returns a structured decision — fast (~7s) and deterministic in shape.- Guardrails in code, not the prompt: the policy filter removes disallowed regions up front; if none qualify, it returns a clean refusal without calling the model.
- Deterministic recompute: the agent picks the region and timing; the server recomputes the cost, CO₂, and savings, so the displayed numbers are always trustworthy.
- Right tool for the job: Claude is used where judgment matters (the decision, the operator briefings). The fleet scheduler routes deterministically in its hot loop — no LLM per job — so it scales, with the LLM reserved for the human-facing narrative.
Architecture
flowchart LR
GS[GridStatus.io<br/>prices] --> D
EM[Electricity Maps<br/>carbon + forecast] --> D
OW[OpenWeatherMap] --> D
subgraph Core["lib/gridmind (shared core)"]
D[data.ts<br/>fetchers + cache] --> S[scoring.ts<br/>normalized weights + latency]
D --> E[economics.ts]
D --> SC[scheduler.ts]
end
subgraph API["pages/api"]
AGG[aggregate / weather / forecast]
SCORE[score]
DECIDE[decide → Claude]
SCHED[schedule]
BRIEF[briefing → Claude]
PR[deploy-pr → GitHub]
FLY[deploy-fly → Fly.io]
end
Core --> API
UI[Dashboard: Overview · Routing Agent · Fleet Autopilot] --> API
DECIDE --> PR
DECIDE --> FLY
- Single source of truth in
lib/gridmind/— every route and the agent reuse the same scoring, data, and economics functions. - Three-tab UI (
components/): Overview (live monitoring), Routing Agent (single-job decide → real action), Fleet Autopilot (autonomous scheduler + briefings).
Tech stack
- Next.js 16 (Pages Router) · React 19 · TypeScript · Tailwind CSS v4
- Anthropic SDK (Claude Sonnet 4.6) for the routing agent and operator briefings
- GridStatus.io, Electricity Maps, OpenWeatherMap for live grid + weather data
- Real actions via the GitHub and Fly.io Machines REST APIs
- Deployed on Vercel (auto-deploys on push; data endpoints edge-cached with stale-while-revalidate)
Integrations — how systems plug in
GridMind is API-first: a dashboard is for evaluating and observing, but real adoption is GridMind embedded in your pipeline.
- REST API —
POST /api/decide(agentic decision) andPOST /api/schedule(fast deterministic batch routing) return{region, run_now, defer_hours, projected, savings}. Call them from your orchestration code:curl -s -X POST https://gridmind-six.vercel.app/api/schedule \ -H 'content-type: application/json' \ -d '{"jobs":[{"id":"job1","mw":50,"hours":12,"flexible":true,"profile":"training"}]}' - MCP server (
mcp/) — exposes GridMind as tools (get_grid_conditions,route_workload,deploy_to_region,open_deployment_pr) so any agent — Claude Code, Claude Desktop, your own — can observe → route → act. Seemcp/README.md. - GitOps — the agent opens a real pull request with a Kubernetes manifest pinned to the chosen region; merge to deploy. Drops into existing CI/CD.
Roadmap: Kubernetes scheduler plugin, Slurm/Airflow/Ray operators, Terraform provider, and a CLI — so workloads are placed with no human in the loop.
Run locally
npm install
cp .env.example .env.local # then fill in your keys
npm run dev # http://localhost:3000
Required environment variables (see .env.example):
| Variable | Used for |
|---|---|
ANTHROPIC_API_KEY | the routing agent + operator briefings |
GRIDSTATUS_API_KEY | real-time wholesale electricity prices |
ELECTRICITY_MAPS_AUTH_TOKEN | grid carbon intensity + 24h forecast |
OPENWEATHERMAP_API_KEY | regional weather |
GITHUB_TOKEN | (optional) GitOps PR action — Contents + Pull requests: R/W |
FLY_API_TOKEN | (optional) real Fly.io deploy — a deploy token |
Without the optional tokens, the agent still decides and explains; the deploy buttons just won't fire. Without the data keys, prices/carbon fall back to representative constants.
Roadmap (productionization)
- Bring-your-own-cloud: per-tenant credential vaults so the agent deploys into the customer's infrastructure (Kubernetes / cloud / Slurm), not a shared account.
- More regions — a full multi-ISO fleet view.
- MCP server — expose GridMind's capabilities as tools any agent can call.
- Closed-loop learning — measure predicted vs. actual and adjust future decisions.
- Eval pipeline — automated guardrail / optimality / consistency tests.
Built at a hackathon. The deploys target a demo Fly.io account; in production each company connects its own cloud.
Analysis
View
Metric
- 19
- 19
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- AnthropicIn code
- C++In code
- CSSIn code
- JavaScriptIn code
- Next.jsIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
- Node.jsClaimed
- VercelClaimed
8 of 10 appear in the indexed code. 2 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- Claude CodeConfig · Commits
- CodexConfig
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
242 KB
Source files
37
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
saosin06/Gridmind
58 files · 616 KB · @ 243b3e3
Structure
Interface
9 files · 16%Screens, components and styles rendered to the user.
API & routing
12 files · 21%Request entry points: routes, handlers and controllers.
Application logic
11 files · 19%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript53%
- JavaScript38%
- Markdown5%
- CSS2%
- C++1%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
package.json
npm · 15- @anthropic-ai/sdk
- next
- react
- react-dom
- react-markdown
- recharts
- remark-gfm
- +8 more
mcp/package.json
npm · 2- @modelcontextprotocol/sdk
- zod
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.