---
title: "Fetch an RL training environment"
method: GET
path: "/rl/environments/{environmentId}"
tags: ["Create"]
---

# Fetch an RL training environment

`GET /rl/environments/{environmentId}`

## Request

- Base URL: `https://www.cloudworldmodel.ai/api`
- URL: `https://www.cloudworldmodel.ai/api/rl/environments/{environmentId}`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-PAYMENT`
  - API key in header `PAYMENT-SIGNATURE`

Retrieve the current state and configuration of an RL environment

## Path parameters

- `environmentId` string, uuid, required

## Response `200`

Environment details

- RLEnvironment
  - `id` string, uuid
  - `simulationId` string, uuid
  - `episodeConfig` EpisodeConfig
    - `maxSteps` integer, required: Maximum steps per episode
    - `targetTrafficPattern` 'constant' | 'ramp' | 'burst' | 'step' | 'wave' | 'custom': Traffic pattern to simulate
    - `initialTraffic` number: Starting traffic load (requests/sec)
    - `targetSLA` object, required: Service-level objectives used to calculate the episode reward.
      - `maxLatencyP95` number, required: Target P95 latency threshold (ms)
      - `maxErrorRate` number, required: Target maximum error rate (%)
    - `costBudgetPerHour` number: Target cost budget per hour (USD)
    - `enableFailures` boolean: Whether to inject random failures
    - `tick_seconds` integer: Number of simulated seconds each step advances the simulation clock. Default is 60 (one simulated minute per step). Set higher values to model longer time horizons (e.g. 300 for 5-minute ticks, 3600 for hourly ticks). The value is fixed for the lifetime of the episode.
    - `unmodeled_cost_penalty_per_dimension` number: Reward penalty applied per active unmodeled cost dimension per step. The total penalty is -(count × this value) and is reported in `reward_components.unmodeled_cost` and `unmodeled_cost_penalty` in the step response. Default is 0.1.
    - `evalCostOverrides` object: Per-dimension cost override rates in USD per 1 000 RPS per hour. Supported keys: `egress` (outbound data-transfer fee charged whenever traffic > 0) and `cross_az_traffic` (inter-AZ data-transfer fee charged when resources in different Availability Zones are connected). When present, these rates are added to the simulated cost before computing the reward cost score, making previously unpriced dimensions visible in the reward signal. Primarily used by the `eval-episodes` endpoint to stress-test trained policies against real-world cost blind spots.
  - `currentStep` integer: Current step number in episode
  - `totalReward` number: Cumulative reward so far
  - `isActive` boolean: Whether episode is still running
  - `lastSimTimeHuman` string: Human-readable simulated elapsed time as of the last step or reset (e.g. "1h 30m"). Absent before the first step.
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `webhookDeliveryStatus` 'pending' | 'delivered' | 'failed': Webhook delivery status (for episode completion)
  - `webhookDeliveryAttempts` integer: Number of webhook delivery attempts made
  - `webhookDeliveryError` string: Error message if webhook delivery failed
  - `webhookDeliveredAt` string, date-time: Timestamp when webhook was successfully delivered
  - `idleExpiresAt` string, date-time: ISO 8601 timestamp at which this environment will be automatically expired due to inactivity. Computed as `lastActivityAt` (or `createdAt` if no step or reset has been called yet) plus the 2-hour idle TTL. Agents can use this value to schedule keep-alive calls (`POST /rl/environments/{environmentId}/step` or `POST /rl/environments/{environmentId}/reset`) before expiry.
  - `rewardWeights` RewardWeights: User-defined weights controlling how cost, resilience, latency, performance, and stability each contribute to the scalar reward returned on each RL step. Valid create-time keys: `cost`, `resilience`, `latency`, `performance`, `stability`. These are the weights you set when creating or resetting an environment — they are distinct from the step-response `reward_components` fields (`connection_pressure`, `unmodeled_cost`, `sla`) which are computed automatically. All values must be non-negative. They are automatically normalized to sum to 1.0 on the server side, so you may supply raw priority scores (e.g. `{ cost: 3, resilience: 1, latency: 1 }`) or pre-normalized fractions (e.g. `{ cost: 0.6, resilience: 0.2, latency: 0.2 }`). When omitted (the default), the agent uses the built-in weighting of latency: 0.35 / cost: 0.25 / resilience: 0.40 — optimized for balanced cloud workloads.
    - `cost` number, required: Weight assigned to cost optimization (staying within cost budget).
    - `resilience` number, required: Weight assigned to resilience (low error rates, stable resources, no SLA violations).
    - `latency` number, required: Weight assigned to latency performance (p95 latency relative to SLA target).
    - `performance` number: Weight assigned to throughput and capacity performance.
    - `stability` number: Weight assigned to autoscaling stability (penalizes thrashing and rapid oscillation).

## Other responses

- `404`: Resource not found

---

[API](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api.md) · [All operations](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cloudworldmodel/apis/cloud-world-model-agent-api/revisions/ecc3ad1ff07f?raw)
