# Keep an agent always on

Source: https://docs.vlayers.ai/reference/hosting/turn-agent-always-on

`POST /v1/agents/{id}/hosting/always-on` · scope `workspace:write`

Turns sleep off for the agent: its rooms stay up every hour and are billed at the room's hourly price for each (`hourlyUsd`; about 730 times that a month). This is the only way to turn always on: `PUT /v1/agents/{id}/hosting` refuses `sleepAfterIdleMinutes: null` for an agent that sleeps, so a person sees the price first. Refused with `always_on_full` when the plan's always-on rooms, or the server's share of them, are used up; the refusal is recorded on the agent. An agent already always on changes nothing.

Requires an API key with the `workspace:write` scope.

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string | yes | The agent id. Example: `"0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78"` |

## Request

cURL:

```bash
curl -X POST "https://api.vlayers.ai/v1/agents/$AGENT_ID/hosting/always-on" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY"
```

TypeScript:

```ts
import { VoiceLayer } from '@voicelayer/api';

const voicelayer = new VoiceLayer();

const { settings } = await voicelayer.hosting.turnAgentAlwaysOn('<agent-id>');
console.log(settings);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.hosting.turn_agent_always_on("<agent-id>")
print(result.settings)
```

## Response `200`

```json
{
  "agentId": "0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78",
  "settings": {
    "sizeClass": "small",
    "warmCount": 1,
    "maxInFlight": null,
    "sleepAfterIdleMinutes": null
  },
  "lastActiveAt": null,
  "isDefault": false,
  "classes": [
    {
      "sizeClass": "small",
      "allowed": true,
      "priceUsdPerHour": 0.03,
      "cpuGuaranteedMillicores": 250,
      "memoryMiB": 512,
      "maxInFlight": 8
    },
    {
      "sizeClass": "medium",
      "allowed": true,
      "priceUsdPerHour": 0.06,
      "cpuGuaranteedMillicores": 500,
      "memoryMiB": 1024,
      "maxInFlight": 16
    }
  ],
  "maxRooms": 5,
  "roomsInUse": 1,
  "concurrentCalls": 8,
  "hourlyUsd": 0.03,
  "rooms": [
    {
      "id": "room_0192f5d4-8b9c-7dae-8f3a-4b5c6d7e8f90",
      "workspaceId": "0192f5a1-5e6f-7a7b-8c8d-9e0f1a2b3c45",
      "environment": "prd",
      "agentId": "0192f5c2-6f7a-7b9c-8d1e-2f3a4b5c6d78",
      "versionId": "0192f5d5-9cad-7ebf-9a4b-5c6d7e8f9012",
      "manifestHash": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "imageDigest": "sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
      "replica": 0,
      "sizeClass": "small",
      "purpose": "warm",
      "state": "ready",
      "runtimeClass": "kata-clh-4-2",
      "shimVersion": "1.0.0",
      "replacementOf": null,
      "createdAt": "2026-10-20T15:04:05.000Z",
      "endedAt": null
    }
  ],
  "refusals": [],
  "walletEmpty": null,
  "logRetentionDays": 14
}
```
