# Netzhandwerker Energy Hub Agent Examples

Copy-paste starter code for agents that call the Netzhandwerker Energy Research Hub.

The API is pay-per-call with x402. First call paid endpoints without a payment proof to receive HTTP 402 terms. Your wallet/client signs the payment, then retries with `X-Payment`.

Do not log or publish full payment proofs.

## Endpoints

- Discovery: https://energy.netzhandwerker.de/.well-known/x402.json
- OpenAPI: https://energy.netzhandwerker.de/openapi.json
- MCP: https://energy.netzhandwerker.de/mcp
- Cheapest paid smoke test: GET https://energy.netzhandwerker.de/demo/paid-sample
- Main decision endpoint: POST https://energy.netzhandwerker.de/energy/decision
- Demand sensor: POST https://energy.netzhandwerker.de/demand/submit

## Run

```bash
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python basic_x402_probe.py
python mcp_client.py
```

## Files

- `basic_x402_probe.py` probes a paid endpoint and prints the 402 terms.
- `crewai_energy_tool.py` wraps the API as a CrewAI tool.
- `langgraph_energy_node.py` wraps the API as a LangGraph node.
- `autogen_energy_tool.py` provides an AutoGen-compatible async tool function.
- `mcp_client.py` lists MCP tools and calls one paid tool.
- `demand_submit.py` submits a missing endpoint request without payment.

Payment is intentionally left as a placeholder. Use your x402 wallet/client to create `X-Payment`.