Cloud World Model RL Environments API
Manage reinforcement learning training environments. ## DigitalOcean RL Quickstart This walkthrough shows the complete episode lifecycle for a **DigitalOcean** simulation: **create → reset → step → observe**. DigitalOcean simulations use Droplet-based compute and Managed Database resources. The hybrid prediction engine automatically models provider-specific behaviour — Droplet cold-start overhead (~30 s provisioning latency on first request after a scale-out) and shared-tenant network jitter — so your agent learns realistic scaling dynamics without spending real cloud budget. **Step 1 — Create a DigitalOcean simulation** *(no auth required)* `POST /simulations` with resources that include at least one Droplet (`provider: "digitalocean"`, `type: "compute"`) and, optionally, a Managed PostgreSQL node and a Load Balancer. Record the returned `id` — this is your `simulationId`. **Step 2 — Mint an API key** *(no auth required for demo)* `POST /keys` → copy the `key` field from the response. **Step 3 — Create the RL environment** *(Bearer auth required)* ```http POST /rl/environments Authorization: Bearer Content-Type: application/json { "simulationId": "", "episodeConfig": { "maxSteps": 200, "targetTrafficPattern": "wave", "initialTraffic": 1500, "targetSLA": { "maxLatencyP95": 180, "maxErrorRate": 1.0 }, "costBudgetPerHour": 3.50 } } ``` The response contains the environment `id` and the initial `observation` — your agent's first view of the Droplet cluster state. **Step 4 — Training loop** *(Bearer auth required)* ``` repeat until done == true: POST /rl/environments/{environmentId}/step { "action": { "type": "adjust_threshold", "parameters": { "cpuThreshold": 65, "throughputThreshold": 70 } } } ← { t, obs, metrics, reward, reward_components, done, info } ``` **Step 5 — Reset for the next episode** ``` POST /rl/environments/{environmentId}/reset ``` **DigitalOcean-specific notes:** - `costPerHour` in observations reflects Droplet + Managed Database pricing from the `nyc3` region benchmark data. - `action.type: "scale_out"` provisions a new Droplet replica; the first observation after scaling models the ~30 s cold-start latency overhead automatically. - `action.type: "adjust_threshold"` tunes CPU/throughput triggers on the DigitalOcean autoscaling profile (default: CPU-weighted scoring, 180 s cooldown). - Droplet `s-2vcpu-4gb` (`maxThroughput: 1800 req/s`) is the recommended starting instance type for moderate workloads. Use `s-2vcpu-4gb-amd` for the Premium AMD NVMe variant (same vCPU/RAM, NVMe storage, slightly higher hourly rate). Upgrade to `c-4 CPU-Optimized` when your agent consistently saturates CPU. ## GCP RL Quickstart This walkthrough shows the complete episode lifecycle for a **GCP** simulation: **create → reset → step → observe**. GCP simulations use GCE compute instances and Cloud SQL for managed databases in the `us-central1` region. The hybrid prediction engine models GCP-specific behaviour including managed instance group warm-up latency (~45 s for the first scale-out) and Cloud SQL connection pooling characteristics. **Step 1 — Create a GCP simulation** *(no auth required)* `POST /simulations` with resources using `provider: "gcp"`. Include at least one GCE instance (`serviceFamily: "gce"`) and optionally a Cloud SQL node and Cloud Load Balancing frontend. Record the returned `id` — this is your `simulationId`. **Step 2 — Mint an API key** *(no auth required for demo)* `POST /keys` → copy the `key` field from the response. **Step 3 — Create the RL environment** *(Bearer auth required)* ```http POST /rl/environments Authorization: Bearer Content-Type: application/json { "simulationId": "", "episodeConfig": { "maxSteps": 150, "targetTrafficPattern": "ramp", "initialTraffic": 4000, "targetSLA": { "maxLatencyP95": 180, "maxErrorRate": 1.0 }, "costBudgetPerHour": 6.0 } } ``` **Step 4 — Training loop** *(Bearer auth required)* ``` repeat until done == true: POST /rl/environments/{environmentId}/step { "action": { "type": "adjust_threshold", "parameters": { "cpuThreshold": 68, "throughputThreshold": 72 } } } ← { t, obs, metrics, reward, reward_components, done, info } ``` **Step 5 — Reset for the next episode** ``` POST /rl/environments/{environmentId}/reset ``` **GCP-specific notes:** - `costPerHour` in observations reflects GCE `e2-standard-4` + Cloud SQL `db-standard-4` pricing from the `us-central1` region benchmark. - `action.type: "scale_out"` provisions a new GCE instance; managed instance group warm-up adds ~45 s latency overhead to the first observation after scaling. - `action.type: "adjust_threshold"` tunes the GCP autoscaling profile (default: CPU-weighted scoring, 120 s cooldown on Compute Engine autoscaler). - Upgrade GCE instances from `e2-standard-4` to `n2-standard-8` in the resource definition when your agent consistently saturates CPU. ## Azure RL Quickstart This walkthrough shows the complete episode lifecycle for an **Azure** simulation: **create → reset → step → observe**. Azure simulations use Azure VM compute and Azure SQL Database in the `East US` region. The hybrid prediction engine models Azure-specific behaviour including VM Scale Set provisioning latency (~60 s for the first scale-out) and Azure SQL DTU burst characteristics. **Step 1 — Create an Azure simulation** *(no auth required)* `POST /simulations` with resources using `provider: "azure"`. Include at least one Azure VM (`serviceFamily: "azure_vm"`, `size: "Standard_D4s_v3"`) and optionally an Azure SQL Database node and Azure Load Balancer. Record the returned `id`. **Step 2 — Mint an API key** *(no auth required for demo)* `POST /keys` → copy the `key` field from the response. **Step 3 — Create the RL environment** *(Bearer auth required)* ```http POST /rl/environments Authorization: Bearer Content-Type: application/json { "simulationId": "", "episodeConfig": { "maxSteps": 150, "targetTrafficPattern": "wave", "initialTraffic": 4500, "targetSLA": { "maxLatencyP95": 200, "maxErrorRate": 1.0 }, "costBudgetPerHour": 7.0 } } ``` **Step 4 — Training loop** *(Bearer auth required)* ``` repeat until done == true: POST /rl/environments/{environmentId}/step { "action": { "type": "adjust_threshold", "parameters": { "cpuThreshold": 70, "throughputThreshold": 75 } } } ← { t, obs, metrics, reward, reward_components, done, info } ``` **Step 5 — Reset for the next episode** ``` POST /rl/environments/{environmentId}/reset ``` **Azure-specific notes:** - `costPerHour` in observations reflects Azure VM `Standard_D4s_v3` + Azure SQL `General Purpose 4 vCores` pricing from the `East US` region benchmark. - `action.type: "scale_out"` provisions a new `Standard_D4s_v3` VM via VM Scale Set; the first observation after scaling models the ~60 s warm-up latency. - `action.type: "adjust_threshold"` tunes the Azure autoscaling profile (default: CPU-weighted scoring, 300 s cooldown on Azure Monitor autoscale). - Consider `Standard_F8s_v2` (compute-optimized) when your agent consistently saturates CPU on `Standard_D4s_v3`. ## OCI RL Quickstart This walkthrough shows the complete episode lifecycle for an **OCI** simulation: **create → reset → step → observe**. OCI simulations use OCI Compute (VM.Standard3.Flex) and Autonomous Database in the `us-ashburn-1` region. The hybrid prediction engine models OCI-specific behaviour including Flex OCPU scaling dynamics and Autonomous Database auto-scaling characteristics. **Step 1 — Create an OCI simulation** *(no auth required)* `POST /simulations` with resources using `provider: "oci"`. Include at least one OCI VM (`serviceFamily: "oci_vm"`, `size: "VM.Standard3.Flex"`) and optionally an Autonomous Database node and OCI Load Balancer. Record the returned `id`. **Step 2 — Mint an API key** *(no auth required for demo)* `POST /keys` → copy the `key` field from the response. **Step 3 — Create the RL environment** *(Bearer auth required)* ```http POST /rl/environments Authorization: Bearer Content-Type: application/json { "simulationId": "", "episodeConfig": { "maxSteps": 150, "targetTrafficPattern": "burst", "initialTraffic": 5000, "targetSLA": { "maxLatencyP95": 160, "maxErrorRate": 0.5 }, "costBudgetPerHour": 4.0 } } ``` **Step 4 — Training loop** *(Bearer auth required)* ``` repeat until done == true: POST /rl/environments/{environmentId}/step { "action": { "type": "adjust_threshold", "parameters": { "cpuThreshold": 65, "throughputThreshold": 70 } } } ← { t, obs, metrics, reward, reward_components, done, info } ``` **Step 5 — Reset for the next episode** ``` POST /rl/environments/{environmentId}/reset ``` **OCI-specific notes:** - `costPerHour` in observations reflects OCI `VM.Standard3.Flex` + Autonomous Database pricing from the `us-ashburn-1` region benchmark. - OCI VM.Standard3.Flex uses flexible OCPU/memory allocation; the simulation models 4 OCPUs / 64 GB RAM per instance by default. - Autonomous Database auto-scales OCPU and storage independently, so database cost varies with query load rather than staying fixed. - OCI typically offers the lowest per-OCPU compute cost among the five providers, making it attractive for cost-optimization agents.