# 00 First words

> Deepgram workshops › Build a voice agent › Mission 00
> Web version: https://workshops.deepgram.com/voice-agent/getting-started
> About 20 min (estimate). Check it: `make check 00` (offline, no key).

Get an agent talking back in a voice you picked.

- [Four layers](https://workshops.deepgram.com/voice-agent/getting-started/four-layers.md)
- [Say hello](https://workshops.deepgram.com/voice-agent/getting-started/say-hello.md)
- [Make it yours](https://workshops.deepgram.com/voice-agent/getting-started/make-it-yours.md)
- [Take it with you](https://workshops.deepgram.com/voice-agent/getting-started/take-it-with-you.md)

## Four layers

### See the four layers of a voice agent

**Goal:** Get a voice agent talking, then change its prompt and voice and hear what each change does.

**Time:** about 20 minutes. **You need:** headphones, if you have them. This mission works on any Deepgram key.

In this mission you work on Voice, with a little Thinking. You change settings and listen.

**How it works**

**Your agent has three parts.** It hears you (speech-to-text, or STT), thinks about what to say (a large language model, or LLM), and talks back (text-to-speech, or TTS). Each part has one setting:

- **Hearing** is `agent.listen`, set to Deepgram Flux STT (`flux-general-en`).
- **Thinking** is `agent.think`.
- **Voice** is `agent.speak`.

Timing, which decides when the agent takes its turn, is covered in Mission 1.

In the next lesson you tap **Start the agent**. Your browser then sends one Settings message, a block of JSON that holds every setting at once: the prompt (who the agent is), the greeting (its first line), and the voice.

```text
Settings                  One Settings message           Conversation
prompt, greeting, voice → sent when you tap Start    → what you hear back
```

**Settings in, conversation out.**

The agent reads that message once, at the start. When you change a setting, the button reads **Reconnect and apply**. Tap it to send the message again with your new settings. The conversation stays on screen so you can compare.

**Apply voice only** swaps the voice and its speed mid-call. Every other change goes out on **Reconnect and apply**, which always works.

## Say hello

### Start the agent and say hi

**Goal:** Hear your agent talk, then switch it to a different voice.

**You need:** headphones, if you have them.

**Do:** Put on headphones if you have them. Tap **Start the agent** and say hi, or type if it's loud.

**Listen for:** its greeting, then its answer.

**You should see:** the agent speak its greeting, then answer you, with both lines in the conversation. If it says nothing, check that your microphone is allowed in the browser, or type a line instead.

**Why headphones**

Headphones keep the agent's voice clear and let it hear only you.

_On the web page, this step has the agent console: talk or type to the agent there, or run the same mission in your own code._

**Check:** The agent talked back.

### Pick a new voice

**Do:** Pick a different **Voice**, tap **Apply voice only**, and say something.

**Listen for:** a new person on the same prompt.

**You should see:** the agent answer in the voice you picked, with the same prompt and conversation. If the voice did not change, check that the Voice menu shows a different voice, then tap **Apply voice only** again.

_On the web page, this step has the Settings panel; in your own code the same settings are in the start file._

_On the web page, this step shows the code panel with the matching code._

**Check:** It spoke in a voice you picked.

**How it works**

The prompt is two sentences: who the agent is, and how long its answers are. Leave it for the first run.

A typed line reaches the agent as text and gets the same answer a spoken one would. The event log under the conversation lists every message as it arrives, if you're curious.

Changing the voice changes one line of the Settings message: the voice in the `speak` block. The code panel shows it, with the voice you picked, on the **Settings JSON** tab. Lower down, the `ConversationText` handler prints both sides of the conversation. The checkpoints read that event.

## Make it yours

### Write your own prompt

**Goal:** Write your own prompt, hear the agent follow it, then swap its voice mid-call.

**You need:** the agent from the last lesson, still running or ready to start.

**Do:** Rewrite the **Prompt** in three lines: who it is, how it talks, one rule it keeps. Or start from this one:

```
You are Sam, the barista at a tiny cafe. Answer in one short sentence, then ask one question back. Never recommend decaf.
```

_On the web page, this step has the Settings panel; in your own code the same settings are in the start file._

### Test your prompt with a new question

**Do:** Tap **Reconnect and apply**, and ask it something the old agent couldn't answer.

_On the web page, this step has the agent console: talk or type to the agent there, or run the same mission in your own code._

**You should see:** the agent answer in the character you wrote. If it still sounds the same, make sure you tapped **Reconnect and apply** after editing the Prompt.

_On the web page, this step shows the code panel with the matching code._

**Check:** It's your agent now.

### Hard mode: swap the voice mid-call

**Do:** **Hard mode.** Mid-conversation, pick a new **Voice** and tap **Apply voice only**.

**Listen for:** the same call in a new voice.

**You should see:** the same conversation carry on in the new voice. If the voice did not change, make sure you picked a different Voice, then tap **Apply voice only** again.

_On the web page, this step has the Settings panel; in your own code the same settings are in the start file._

**Check:** Hard mode: a new voice, same call. (Optional.)

**How it works**

A good prompt has three parts. Who it is: a cafe barista, a museum guide, a very calm airline pilot. How it talks: short answers, one question at a time, no lists. One rule: something it always or never does.

Your prompt travels as one string, `agent.think.prompt`, in the same Settings message. The **Settings JSON** tab shows your sentences in it.

**Going further.** Two more settings sit at the bottom of the panel. **Speed** is how fast it talks. **Expressivity** is how much feeling it puts in: 0 is neutral, 2 is a performance. Nudge one, tap **Reconnect and apply**, and listen. Set them back to 1.0 and 0 before the next mission, so you know what normal sounds like.

**Hard mode check.** It looks for a reply before the swap and another after it, in the same call. That's how an app swaps voices without hanging up.

## Take it with you

### Rebuild your agent outside the workshop

**Goal:** Rebuild your agent outside the workshop, and keep your key safe when you ship it.

**You need:** a browser for the Playground, or a terminal and Python, TypeScript, or Java for the project.

**Do:** Pick one place to rebuild this agent:

- [Voice Agent Playground](https://playground.deepgram.com/voice-agent?utm_source=workshops&utm_medium=agent&utm_campaign=workshop-voice-agent&utm_content=md-first-words): the same settings panel, bigger.
- The attendee project, which has this mission as three TODOs: [Python](https://github.com/deepgram-devs/voice-agent-workshop/blob/main/python/missions/00-first-words/start.py) or [TypeScript](https://github.com/deepgram-devs/voice-agent-workshop/blob/main/typescript/missions/00-first-words/start.ts).
- New to this? Try the [todo voice agent starter](https://github.com/deepgram-devs/todo-voice-agent-workshop).

Building on LiveKit, Pipecat, Vapi, Twilio, or Telnyx? [PARTNERS.md](https://github.com/deepgram-devs/voice-agent-workshop/blob/main/PARTNERS.md) in the code project shows what carries over.

Keep your Deepgram API key on your server, never in a web page or app. The code below is the Settings message and the smallest program that sends it.

_On the web page, this step shows the code panel with the matching code._

**You should see:** the agent's reply to your typed line in the transcript. If nothing appears, check that `DEEPGRAM_API_KEY` is set, then run it again.

**Keep your key safe**

The program in the code panel runs from a terminal. Type a line and it answers in the transcript.

The [attendee project](https://github.com/deepgram-devs/voice-agent-workshop) has one folder per mission in Python, TypeScript, and Java, with an offline check that tells you when the TODOs are done. The [todo voice agent guide](https://workshops.deepgram.com/todo-voice-agent) walks through the simpler starter step by step.

Python can use your microphone; TypeScript and Java take typed input. After setup, every check runs offline.

On your own machine, the key stays with you. In anything you ship, such as a web page or a phone app, keep the key out of the code people download.

Put a small server of yours in between, the way this workshop does. The browser talks to your server, and your server holds the key and talks to Deepgram. Or have your server ask Deepgram for a short-lived token (`POST /v1/auth/grant`, 30 seconds by default) and hand that to the app.

**In production**

- **Watch:** the `Error` and `Warning` events, and how often a session closes before the agent's first reply.
- **Aim for:** `SettingsApplied` before any audio goes out, and a KeepAlive every 5 seconds or so whenever no audio is flowing.
- **Read:** the [Voice Agent docs](https://developers.deepgram.com/docs/voice-agent) for every Settings field.

**What you changed:** the Voice layer, with a little Thinking. One Settings message set who your agent is and how it sounds.
