# See how fast an agent answers

Source: https://docs.vlayers.ai/reference/agents/get-agent-latency

`GET /v1/agents/{id}/latency` · scope `workspace:read`

Averages what the agent's recent calls measured, over the last 30 days: how long the caller waited from the end of their words to the first sound of the answer (`endToEnd`), and the parts of it: `listening` (noticing the caller stopped, and transcribing), `thinking` (the language model) and `speaking` (the voice's first audio). Whole milliseconds. `avgMs` is `null` until a call has been measured. When `realtime` is true most turns were answered by a speech-to-speech model, which folds listening and speaking into the model.

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

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

## Request

cURL:

```bash
curl "https://api.vlayers.ai/v1/agents/$AGENT_ID/latency" \
  -H "Authorization: Bearer $VOICELAYER_API_KEY"
```

TypeScript:

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

const voicelayer = new VoiceLayer();

const { avgMs } = await voicelayer.agents.getLatency('<agent-id>');
console.log(avgMs);
```

Python:

```python
from voicelayer import VoiceLayer

vl = VoiceLayer()

result = vl.agents.get_latency("<agent-id>")
print(result.avg_ms)
```

## Response `200`

```json
{
  "windowDays": 30,
  "calls": 42,
  "turns": 311,
  "avgMs": {
    "endToEnd": 1320,
    "listening": 410,
    "thinking": 640,
    "speaking": 270
  },
  "realtime": false
}
```
