# 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 `PAYMENT-SIGNATURE`. `X-Payment` is accepted as a compatibility alias.

Do not log or publish full payment proofs.

## Endpoints

- Discovery: https://energy.halowerk.com/.well-known/x402.json
- OpenAPI: https://energy.halowerk.com/openapi.json
- MCP: https://energy.halowerk.com/mcp
- Free signal index: GET https://energy.halowerk.com/predict/negative-price
- Buy exact signal: POST https://energy.halowerk.com/predict/negative-price
- Main decision endpoint: POST https://energy.halowerk.com/energy/decision

## 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.

Payment is intentionally generated at runtime. Use your x402 wallet/client to create `PAYMENT-SIGNATURE` after receiving the 402 response.