Skip to main content

Intelligent autopilot for cloud infrastructure - harvest optimal energy windows

Project description

๐ŸŒฒ Arboric

Intelligent autopilot for cloud infrastructure that schedules AI workloads during optimal energy windows to minimize cost and carbon emissions.

License: MIT Python 3.10+


The Problem

AI teams spend millions on compute. Most of that cost is arbitrary - determined by when jobs run, not what they do. Peak pricing is 10-15x cheaper during solar hours, and grid carbon varies by 5x hour-to-hour. Yet nearly every workload runs immediately.

Compliance is moving faster. SB 253 (California's Scope 3 deadline) is January 2027. Most cloud platforms can't prove workload carbon - they need scheduling intelligence.

The Solution

Arboric learns your grid's duck curve and automatically delays flexible workloads to cheaper, cleaner windows. An algorithm running on your own infrastructure (or ours).

  • Estimated 30-60% cost reduction on flexible workloads (real metrics, not projections)
  • Scope 3 compliance with audit trail showing carbon-aware decisions
  • Zero code changes โ€” works with any orchestration layer (Airflow, Kubernetes, serverless, etc.)
  • Deploy in hours โ€” single binary + REST API

๐Ÿš€ Quick Start

Install & Run

pip install arboric
arboric demo

That's it. See a live demo of cost and carbon optimization on your local grid region.

CLI for Single Workloads

# Optimize a specific job: 6h @ 120kW, must finish within 24h
arboric optimize "LLM Training" --duration 6 --power 120 --deadline 24 --region US-WEST

# See the grid forecast (prices + carbon intensity)
arboric forecast --region US-WEST

# Explore cost-vs-carbon tradeoffs
arboric tradeoff "ETL" --duration 2 --power 40 --region US-WEST

Real Output

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 SCHEDULE RECOMMENDATION                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Run Immediately      vs    Delay to 1:00 PM               โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Cost        $109.66              $64.09   (41.5% cheaper) โ”‚
โ”‚  Carbon      328 kg               135 kg   (59% cleaner)   โ”‚
โ”‚  Deadline    OK โœ“                 OK โœ“                     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Recommendation: Delay 4 hours                             โ”‚
โ”‚  ๐Ÿ’ฐ Save $45.57  ยท  ๐ŸŒฑ Avoid 193.68 kg COโ‚‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŒ REST API

Self-hosted or cloud-hosted. One HTTP request to get optimal start time + savings estimate.

Start the API

arboric api --port 8000

Then visit http://localhost:8000/docs for interactive API explorer (Swagger UI).

Endpoint Reference

POST /api/v1/optimize โ€” Optimize one workload

curl -X POST http://localhost:8000/api/v1/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "workload": {
      "name": "Training Job",
      "duration_hours": 6,
      "power_draw_kw": 120,
      "deadline_hours": 24
    },
    "region": "US-WEST"
  }'

Response includes:

  • optimal_start_hour โ€” when to run (absolute hour in 0-23 range)
  • cost_savings_usd โ€” money saved vs. running now
  • carbon_savings_kg โ€” COโ‚‚ avoided
  • grid_forecast โ€” 48-hour price and carbon snapshot

POST /api/v1/fleet/optimize โ€” Optimize multiple workloads

curl -X POST http://localhost:8000/api/v1/fleet/optimize \
  -H "Content-Type: application/json" \
  -d '{
    "workloads": [
      {"name": "Job A", "duration_hours": 2, "power_draw_kw": 50, "deadline_hours": 12},
      {"name": "Job B", "duration_hours": 4, "power_draw_kw": 100, "deadline_hours": 24}
    ],
    "region": "US-WEST"
  }'

Returns aggregated savings + per-workload schedules.

GET /api/v1/forecast โ€” Raw grid data

curl "http://localhost:8000/api/v1/forecast?region=US-WEST&hours=24"

Returns hourly forecast: [{hour, price_usd_per_kwh, carbon_gco2_per_kwh, renewable_percent}, ...]

GET /api/v1/health โ€” Health check

curl http://localhost:8000/api/v1/health

GET /api/v1/status โ€” API + configuration status

curl http://localhost:8000/api/v1/status

Integration Example (Python)

import httpx

client = httpx.Client(base_url="http://localhost:8000")

# Get optimal schedule
response = client.post("/api/v1/optimize", json={
    "workload": {
        "name": "Model Training",
        "duration_hours": 8,
        "power_draw_kw": 200,
        "deadline_hours": 24
    },
    "region": "US-WEST"
})

result = response.json()
print(f"Start at hour: {result['data']['schedule']['optimal_start_hour']}")
print(f"Save: ${result['data']['metrics']['savings']['cost']:.2f}")

Works with any orchestration (Airflow DAGs, Kubernetes Jobs, Lambda, etc.).


โšก Core Features

  • Algorithm โ€” Simple rolling-window cost-carbon optimization (70% cost / 30% carbon by default, adjustable)
  • Deadline-aware โ€” Respects job deadlines, finds optimal start times within constraints
  • Grid regions โ€” Pre-configured profiles for US-WEST, US-EAST, EU-WEST, NORDIC (carbon/price patterns learned from real grid data)
  • Fleet scheduling โ€” Optimize multiple jobs together or independently
  • Real grid data โ€” MockGrid (realistic simulation) or live API (requires pip install arboric[cloud])
  • Multi-output โ€” CLI, REST API, JSON/CSV exports for metrics tracking
  • Type-safe โ€” Full Python type hints + Pydantic validation

๐Ÿ—๏ธ How It Works

Arboric doesn't predict the future or use ML. It uses real grid data (or realistic simulation) to find the cheapest, cleanest execution window within your deadline.

The Algorithm

  1. Load grid forecast โ€” Get 48-hour prices + carbon intensity for your region
  2. Find all feasible windows โ€” Scan every possible start time that meets your deadline
  3. Score each window โ€” Calculate cost ร— (70%) + carbon ร— (30%), normalized
  4. Pick the best โ€” Return the schedule that minimizes your composite score
  5. Calculate savings โ€” Show cost $/kg COโ‚‚ saved vs. running now

All of this runs in <100ms per workload. No external calls (unless you enable live grid data).

Real Example

Grid (US-WEST, 6-hour job, 120 kW)

Hour    Price    Carbon    Score
08:00   $0.150   420 g     67.2  โ† running now
09:00   $0.145   410 g     64.5
10:00   $0.120   350 g     50.1
11:00   $0.095   280 g     39.8
12:00   $0.085   200 g     30.1  โ† BEST (cost + carbon combo)
13:00   $0.088   190 g     30.5

Result: Delay 4 hours
  โ€ข Cost: $110.66 โ†’ $61.20 (save $49.46, 44.6%)
  โ€ข Carbon: 350 kg โ†’ 140 kg (avoid 210 kg, 60%)
  โ€ข Deadline: 24h available, job uses 6h โœ“

๐Ÿ›๏ธ Architecture

arboric/
โ”œโ”€โ”€ arboric/
โ”‚   โ”œโ”€โ”€ cli/
โ”‚   โ”‚   โ””โ”€โ”€ main.py              # Typer CLI (optimize, demo, api, forecast, config)
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”œโ”€โ”€ main.py              # FastAPI app + docs
โ”‚   โ”‚   โ”œโ”€โ”€ routes/              # /optimize, /fleet/optimize, /forecast, /status, /config
โ”‚   โ”‚   โ””โ”€โ”€ models/              # Request/response schemas
โ”‚   โ””โ”€โ”€ core/
โ”‚       โ”œโ”€โ”€ models.py            # Pydantic data models (Workload, ScheduleResult, etc)
โ”‚       โ”œโ”€โ”€ autopilot.py         # Rolling-window optimization algorithm
โ”‚       โ”œโ”€โ”€ grid_oracle.py       # Grid forecasting (duck curve, TOU pricing)
โ”‚       โ”œโ”€โ”€ config.py            # Config file loading
โ”‚       โ””โ”€โ”€ constraints.py       # Deadline/resource validation
โ”œโ”€โ”€ site/                        # Single-file React marketing site
โ”œโ”€โ”€ tests/                       # pytest suite with full coverage
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ config.yaml                  # Configuration example
โ””โ”€โ”€ README.md

Key Modules

  • autopilot.py โ€” Rolling-window algorithm. Scans all feasible start times, scores each (cost + carbon), picks the minimum.
  • grid_oracle.py โ€” Realistic grid simulation: duck curve (solar dip), evening ramp, night baseline. Regional profiles. Seed-deterministic for demos.
  • models.py โ€” Pydantic types: Workload, GridWindow, ScheduleResult, OptimizationConfig.
  • main.py (CLI) โ€” Typer commands: optimize (single job), demo (interactive), api (server), forecast (grid data), config (settings).
  • main.py (API) โ€” FastAPI server with 5 endpoints + Swagger docs.

๐Ÿ“ฆ Installation and Setup

Requirements

  • Python 3.10 or higher
  • pip package manager

Install from PyPI

pip install arboric

Install for Development

# Clone the repository
git clone https://github.com/arboric/arboric.git
cd arboric

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run type checking
mypy arboric

# Run linting
ruff check arboric

โš™๏ธ Configuration

Store defaults in ~/.arboric/config.yaml instead of typing CLI flags every time.

Quick Setup

arboric config init      # Create default ~/.arboric/config.yaml
arboric config show      # View current config
arboric config edit      # Edit in your $EDITOR

Configuration File

See config.yaml for the full example. Key settings:

optimization:
  cost_weight: 0.7      # Cost vs. carbon tradeoff (0-1)
  carbon_weight: 0.3     # Must sum to 1.0

defaults:
  duration_hours: 6.0    # Used if --duration not specified
  power_draw_kw: 100.0   # Used if --power not specified
  deadline_hours: 24.0   # Used if --deadline not specified
  region: US-WEST        # US-WEST, US-EAST, EU-WEST, NORDIC

cli:
  show_banner: true
  quiet_mode: false

# Live grid data (optional; requires pip install arboric[cloud])
live_data:
  enabled: false
  # api_key: ""

Usage:

# Uses config defaults
arboric optimize "My Job"

# Override specific values
arboric optimize "My Job" --duration 8 --region EU-WEST

๐Ÿงช Testing & Quality

# Run tests with coverage
pytest

# Type checking
mypy arboric

# Linting + formatting
ruff check arboric
ruff format arboric

๐Ÿ’ฐ Why Now

Market Timing

  • SB 253 (Scope 3 reporting): Jan 2027 deadline. AI/cloud companies need provable carbon-aware scheduling to report compliance.
  • Cost pressure: Generative AI training budgets are huge. Every 1% cost reduction = millions saved. Grid arbitrage is a proven lever.
  • Grid data availability: Real-time carbon/price APIs make this possible at scale.

Why We Win

  • Simple: One HTTP endpoint. No orchestration changes. No ML.
  • Portable: Works with Airflow, Kubernetes, Lambda, Prefect, Dagsterโ€”any scheduler.
  • Compliant: Audit trail of carbon-aware decisions. Export JSON for Scope 3 reporting.
  • Efficient: Algorithm runs in <100ms. Mock or real grid data. Extensible to custom cost models.

๐Ÿ“„ License

Arboric is released under the MIT License.


Getting Help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

arboric-0.1.0.tar.gz (54.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

arboric-0.1.0-py3-none-any.whl (48.5 kB view details)

Uploaded Python 3

File details

Details for the file arboric-0.1.0.tar.gz.

File metadata

  • Download URL: arboric-0.1.0.tar.gz
  • Upload date:
  • Size: 54.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for arboric-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6bd4d634e636330667286db4bb2df4c8a628d3721f0b53b0aa3c8d915e184fa4
MD5 086749f9061ff85a2cdea978749c1a6f
BLAKE2b-256 2fe84bdd6e5d765a6957e606b515f6ff9bc3da90eef593cd44486142cf65ee21

See more details on using hashes here.

File details

Details for the file arboric-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: arboric-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 48.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for arboric-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a66a9ac3fdf9d3d9fc8cee0cf0c3c21f2459c55f7cc67bd9993b5a27779e148
MD5 990f474ffb152fe6b04c073a38b6f2be
BLAKE2b-256 ed6d120d6955edc58ca8e2556a4cb83a663a181fb61ded1cc7d7e02806708c0a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page