---
title: Talk to an agent
description: Record a voice message whose transcript the agent receives and you see beside the recording, dictate into the prompt box, or hold a hands-free conversation in talk mode. Speech goes through your organisation's own gateway.
section: agents
order: 8
audience: [user, operator, builder]
sources: [services/nodejs-cloud/lib/agents/voice.ts, services/nodejs-cloud/lib/agents/voice-pure.ts, services/nodejs-cloud/components/agents/voice, services/nodejs-cloud/app/api/workspace/agents/voice, services/nodejs-cloud/migrations/0472_agent_chat_voice.sql, services/nodejs-cloud/lib/voice/serve.ts]
features: []
---

The prompt box in Petawork Agents has two voice buttons at its right end: a **microphone** and a **voice** button (sound
bars). They show while the box is empty, where Send is once you have typed something. They are there when your
organisation has a provider that transcribes speech, and gone when it has none; see
[When there are no voice buttons](#when-there-are-no-voice-buttons).

## Send a voice message

In a [quick chat](/docs/agents/quick-chat.md) or a [chat with a bot](/docs/agents/bots.md#chat-with-a-bot):

1. Tap the microphone. The first time, your browser asks whether Petawork may use it.
2. The prompt row becomes the recorder: a timer, the live level of your voice, **Cancel** (or Esc) on the left and **Send**
   on the right. A recording is at most five minutes; at five minutes it ends and is sent as it is.
3. Tap Send. The message appears in the chat at once, as your bubble with a small player and **Transcribing…** under it.
4. When the words arrive they show under the player, and the agent receives them as your message. The agent gets the text,
   never the audio.

You do not choose a language: the speech model detects it. Where the model names the language it heard, the bubble says so
("Heard as French").

The recording stays on the message. Anyone who may read the chat (you, and an admin of your organisation) can play it and
read its words.

If the transcription fails, the bubble keeps the recording and says why, with two buttons:

- **Try again** sends the same recording to the speech model again.
- **Type it instead** discards the recording and puts the caret in the prompt box.

A recording with no speech in it is treated the same way.

## Dictate into the prompt box

Where a chat cannot keep a recording, the microphone dictates instead: your words are put into the prompt box, to read,
change and send like anything you typed. Nothing of the recording is kept. That is the case:

- on the new-chat screen, before a chat exists;
- in a code chat on a daemon and in a [computer chat](/docs/agents/computer-chats.md), whose messages are text only.

The recorder's right-hand button is then **Done** rather than Send.

## Talk mode

The voice button starts a hands-free conversation with the chat's agent. A bar appears under the chat's top bar with the
agent's picture, the level of your microphone as a dotted line, **settings**, **mute** and a red **hang up**. The prompt row
loses its two voice buttons while the conversation lasts.

The conversation goes in turns:

1. **Listening.** Speak. When you pause for a little over a second, your turn ends. Tap the dotted line to end it sooner
   (**Done**).
2. **Transcribing**, then **Thinking.** Your words are sent as an ordinary message, and the agent's answer streams into the
   chat as usual.
3. **Speaking.** When the answer is complete it is read aloud, if your organisation has a provider that speaks and you left
   **Speak answers** on. Start talking, or tap the dotted line, to stop it.
4. Listening again.

Code, tables, links and pictures in an answer are not read aloud, and at most the first 2,000 characters are spoken; the
whole answer is in the chat.

In the settings you choose whether answers are spoken, the voice, and (when your organisation serves more than one) the
transcription model. Your choices are kept in this browser.

Without a provider that speaks, talk mode still works: you talk, the answers are shown, and the bar says they are not spoken.

Talk mode does not keep recordings: each turn is transcribed and only its words are sent. Use the microphone when you want
the recording kept with the message.

## The microphone

- It is asked for only when you tap one of the two buttons, never when a page loads and never in the background.
- A voice message holds it for one recording. Send, Cancel, Esc and leaving the page all release it.
- Talk mode holds it from the tap on the voice button until you hang up or leave the chat. Your phone or browser shows its
  microphone indicator for as long.
- Mute keeps the conversation open and stops listening.

If the microphone is blocked for the site, the app says so; allow it in the browser's site settings and tap again. Recording
needs a secure (https) page.

## Where the audio goes

Speech to text and text to speech run through Petawork's own gateway, as you: the same path as
`POST /v1/audio/transcriptions` and `POST /v1/audio/speech` (the [speech API](/docs/voice/speech-api.md)), called inside the
cloud under your own Agents key. So:

- the audio goes only to a provider your organisation already routes to, on its key (or the platform's, where your plan
  allows platform keys);
- your model access, rate limits and budgets apply, and each request is in the spend log, billed per second of audio (speech
  to text) or per character (text to speech);
- the browser never talks to a provider.

### Which model transcribes

The app does not name one model. It asks which speech-to-text models your organisation's keys serve and tries the cheapest
priced one first, then the next, so a provider that is down does not lose your words. With an OpenAI key today that is
`gpt-transcribe` ($0.0045 a minute), then `whisper-1` ($0.006 a minute). A cheaper model your organisation adds later is
used first without a change to the app. In talk mode's settings you can pick one yourself.

A model without a row in the price table is tried after the priced ones, and not at all under a hard budget (a budget
cannot limit what it cannot price).

### Where recordings are kept

In Petawork's own file store, with the chat. The recording is not stored with the speech provider: none of the providers
the gateway serves keeps an uploaded recording and gives it back for playback (the transcription endpoints keep nothing and
take the bytes each time), so there is nothing there to play from.

Space stays small by limits:

| Limit | Value |
|---|---|
| One recording | 5 minutes, 4 MB (about 1.2 MB at the bitrate the app asks for) |
| Recordings a chat keeps | the newest 100 |
| A recording you made and never sent | removed after a day |

When a chat passes 100 recordings, the oldest recording is deleted. Its message keeps its words, and its player says
**Recording no longer available**. Deleting a chat deletes its recordings. Recordings count toward your organisation's file
storage.

The transcript is stored as the message's text, so it is there whatever happens to the recording.

## When there are no voice buttons

- Your organisation has no provider that transcribes speech. An admin adds one on the Providers page (an OpenAI, Mistral or
  ElevenLabs key, or any OpenAI-compatible server with a speech-to-text model).
- Your organisation is **sovereign only** (it keeps its models on its own machines). Daemons do not serve the audio paths
  yet, so a recording would have to go to a cloud provider, and it does not.
- Your role can read chats but not write to them.
- The chat is archived or ended.

While an agent is still answering in a quick chat, the buttons are disabled until it finishes.

## For builders

| Route | What |
|---|---|
| `GET /api/workspace/agents/voice` | what the signed-in member can do: `{voice: {transcribe, speak, limits}}`, each with its `model` and `models` (id and price). `?voices=1` adds the speech model's voices |
| `POST /api/workspace/agents/voice` | one recording as the raw bytes (WebM, MP4 or Ogg audio, read from the bytes), its length in `x-voice-ms`. Answers `{voice, text, language, model, error}`. `?keep=0` transcribes without keeping; `?retry=<id>` transcribes a kept, unsent recording again; `?model=` picks one of the organisation's models |
| `DELETE /api/workspace/agents/voice?id=` | a recording you made and have not sent |
| `POST /api/workspace/agents/voice/speech` | `{text, voice?}` spoken, as MP3 |
| `POST /api/workspace/agents/chats/{id}/prompt` | with `voice: <recording id>` beside `message` (the transcript), the message is a voice message |
| `GET /api/workspace/agents/chats/{id}/attachments/{recording id}` | the recording, to whoever may read the chat: `nosniff`, its audio type, `Range` supported |

These routes are for a person's browser and have no MCP tools: an agent has no microphone. An agent reads a voice message as
its text, with `agents_transcript_get`; the item carries `voice` (the recording's id, type, size, length and language).

The audit log records each recording with its size, length and model (`agents.voice_recorded`), never its words.
