Spaces:
Sleeping
Sleeping
|
Download deploy/LOCAL_LAPTOP_FASTAPI_GUIDE.md from divagr1925/AntiAtropos: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/spaces/divagr1925/AntiAtropos/resolve/main/deploy/LOCAL_LAPTOP_FASTAPI_GUIDE.md
- Command line
-
hf download hf://spaces/divagr1925/AntiAtropos/deploy/LOCAL_LAPTOP_FASTAPI_GUIDE.md
-
curl -L -o LOCAL_LAPTOP_FASTAPI_GUIDE.md https://huggingface.co/spaces/divagr1925/AntiAtropos/resolve/main/deploy/LOCAL_LAPTOP_FASTAPI_GUIDE.md
2.36 kB
Local Laptop Kubernetes Control with FastAPI
This guide uses your local manifest deploy/local-laptop.yaml and a lightweight server server/local_laptop_control.py.
1) Deploy local workloads
kubectl apply -f deploy/local-laptop.yaml
kubectl get deploy -n prod-sre
Expected deployments:
authcartcatalogcheckoutpayments
2) Set required environment variables
The controller requires KUBECONFIG and ANTIATROPOS_WORKLOAD_MAP.
$env:KUBECONFIG = "$HOME/.kube/config"
$env:ANTIATROPOS_K8S_NAMESPACE = "prod-sre"
$env:ANTIATROPOS_MIN_REPLICAS = "1"
$env:ANTIATROPOS_MAX_REPLICAS = "" # empty => unbounded scale-up
$env:ANTIATROPOS_SCALE_STEP = "3"
$env:ANTIATROPOS_WORKLOAD_MAP = '{"node-0":{"deployment":"payments","namespace":"prod-sre"},"node-1":{"deployment":"checkout","namespace":"prod-sre"},"node-2":{"deployment":"catalog","namespace":"prod-sre"},"node-3":{"deployment":"cart","namespace":"prod-sre"},"node-4":{"deployment":"auth","namespace":"prod-sre"}}'
If you already have these in .env, load them first.
3) Start lightweight FastAPI server
uvicorn server.local_laptop_control:app --host 0.0.0.0 --port 8010
4) Validate server health
Invoke-RestMethod http://localhost:8010/health
Check:
is_mockshould beFalsemapped_targetsshould includenode-0..node-4
5) Let your agent execute actions
The server accepts POST /step with:
action_type:NO_OP|SCALE_UP|SCALE_DOWN|REROUTE_TRAFFIC|SHED_LOADtarget_node_id:node-*parameter: float
Example:
Invoke-RestMethod -Method Post -Uri http://localhost:8010/step -ContentType "application/json" -Body '{"action_type":"SCALE_UP","target_node_id":"node-3","parameter":0.6}'
6) Verify Kubernetes effect
kubectl get deploy cart -n prod-sre
kubectl get deploy -n prod-sre
Notes
- This controller is intentionally minimal and does not provide simulator rewards.
- It is suitable for direct action execution tests from your agent.
- If you need OpenEnv-compatible
/reset+/step+ reward loop, use server/app.py inawsmode.