Charging schedulers, fleet agents and home-energy bots

EV Charging Intelligence for AI Agents

EV agents need to decide when to charge by price, grid load and carbon signal.

Call one decision endpoint for a charging recommendation, or pull supporting forecasts for your own optimizer.

No API keysAgents discover the endpoint, receive HTTP 402, pay, and retry the same request.
USDC on Basex402 payment over Base Mainnet, chain 8453, asset USDC.
Demand sensorMissing data can be submitted through POST /demand/submit; optional 0.001 USDC gives priority listing.

What agents get

Recommended endpoints

EndpointPricePurpose
POST /energy/decision0.01 USDCEV, battery, and flexible-load agents buy this endpoint to receive an executable action with timing, expected value, confidence, and expiry.
POST /optimizer/cheapest-window0.005 USDCFlexible-load agents buy this endpoint to schedule a contiguous operating window at the lowest average electricity price.
GET /bundle/ev-chargingpublic discoveryMachine-readable discovery surface.
POST /price/forecast0.005 USDCEnergy-trading and flexible-load agents buy this endpoint to compare the next 24 hours of EPEX prices and volatility.
POST /carbon/now0.001 USDCAktuelle CO2-Intensität des deutschen Strommix.

Framework copy-paste examples

The snippets intentionally leave PAYMENT-SIGNATURE to your wallet/client, which creates the signed proof after reading the 402 response. X-Payment is accepted as a compatibility alias.

cURL: discover the 402 challenge

curl -i -X POST https://energy.netzhandwerker.de/energy/decision \
  -H "Content-Type: application/json" \
  -d '{"goal":"minimize_cost","device":"ev","location":"Germany","duration_hours":4}'

# On HTTP 402, let your x402 wallet/client create PAYMENT-SIGNATURE, then retry.
# Do not log or share the full payment proof.

Python requests: payment-aware wrapper

import requests

BASE = "https://energy.netzhandwerker.de"
BODY = {
         "goal": "minimize_cost",
         "device": "ev",
         "location": "Germany",
         "duration_hours": 4
       }

r = requests.post(f"{BASE}/energy/decision", json=BODY, timeout=20)
if r.status_code == 402:
    terms = r.json()
    print("payment required:", terms)
    # signed_payment = your_x402_client.sign(terms)
    # r = requests.post(f"{BASE}/energy/decision", json=BODY, headers={"PAYMENT-SIGNATURE": signed_payment}, timeout=20)

print(r.status_code, r.text[:500])

CrewAI: expose Energy Hub as a tool

import requests
from crewai.tools import tool

BASE = "https://energy.netzhandwerker.de"

@tool("energy_hub_decision")
def energy_hub_decision(goal: str, location: str = "DE") -> str:
    """Call Netzhandwerker Energy Research Hub and return structured energy context."""
    body = {"goal": goal, "location": location}
    r = requests.post(f"{BASE}/energy/decision", json=body, timeout=20)
    if r.status_code == 402:
        return "Payment required. Pass the 402 terms to your x402 wallet and retry with PAYMENT-SIGNATURE."
    r.raise_for_status()
    return r.text

LangGraph: one node that calls the paid API

import requests
from typing_extensions import TypedDict
from langgraph.graph import StateGraph, END

BASE = "https://energy.netzhandwerker.de"

class State(TypedDict):
    goal: str
    location: str
    result: str

def call_energy_hub(state: State):
    body = {"goal": state["goal"], "location": state.get("location", "DE")}
    r = requests.post(f"{BASE}/energy/decision", json=body, timeout=20)
    if r.status_code == 402:
        return {"result": "HTTP 402 received. Pay with x402, then retry the same call."}
    r.raise_for_status()
    return {"result": r.text}

graph = StateGraph(State)
graph.add_node("energy_hub", call_energy_hub)
graph.set_entry_point("energy_hub")
graph.add_edge("energy_hub", END)
app = graph.compile()

AutoGen-compatible async tool function

import requests

BASE = "https://energy.netzhandwerker.de"

async def energy_hub_tool(goal: str, location: str = "DE") -> str:
    """Register this function as a callable tool in your AutoGen agent/runtime."""
    body = {"goal": goal, "location": location}
    r = requests.post(f"{BASE}/energy/decision", json=body, timeout=20)
    if r.status_code == 402:
        return "Payment required. Forward the 402 body to an x402-capable wallet client."
    r.raise_for_status()
    return r.text

MCP client: list tools and call one tool

import requests

BASE = "https://energy.netzhandwerker.de"

list_tools = {"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}
print(requests.post(f"{BASE}/mcp", json=list_tools, timeout=20).json())

call_tool = {
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
        "name": "energy_decision",
        "arguments": {
                       "goal": "minimize_cost",
                       "device": "ev",
                       "location": "Germany",
                       "duration_hours": 4
                     }
    }
}
print(requests.post(f"{BASE}/mcp", json=call_tool, timeout=20).json())

Demand sensor: request a missing endpoint

import requests

BASE = "https://energy.netzhandwerker.de"
body = {
         "need": "EV charging forecast by region, plug-in time and required kWh",
         "desired_endpoint": "/requested/example",
         "desired_format": "json",
         "max_budget_usdc": 0.01,
         "recurring": true,
         "frequency": "daily",
         "use_case": "Charging schedulers, fleet agents and home-energy bots"
       }

r = requests.post(f"{BASE}/demand/submit", json=body, timeout=20)
print(r.status_code, r.json())

# Optional: pay the 0.001 USDC priority demand terms if your agent wants priority listing.

MCP tool names

energy_decision cheapest_window ev_charging_plan heating_plan flexibility_window battery_arbitrage buy_sell_signal today_summary submit_data_request

Honest scope: the API sells current German/EU energy intelligence and decision support. If your agent needs a missing endpoint, submit the need; implementation is not guaranteed.