> ## Documentation Index
> Fetch the complete documentation index at: https://docs.corti.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a wake-command agent

> Gate a Corti agent behind a spoken wake phrase and maintain a multi-turn conversation thread

<Warning>
  **Beta.** This is an experimental pattern under active development. It chains several capabilities — wake-word command recognition, wildcard intent capture, and threaded agent memory — so behavior and response quality can vary, and the approach may change. Treat it as a starting point for exploration rather than a production-ready recipe, and [reach out](mailto:help@corti.ai) to discuss your use case or share feedback.
</Warning>

<iframe className="w-full aspect-video rounded-xl" src="https://www.youtube.com/embed/0I2LVQsyemg?start=99&end=223" title="Build a Wake-Command Agent — walkthrough" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowFullScreen />

<Info>
  **Follow along with the runnable example.** This guide walks through the [wake-command agent example](https://github.com/corticph/corti-examples/tree/main/sdk/typescript/applets/src/applets/wake-command-agent) in `corti-examples` — bootstrap your build from it or use it as reference.
</Info>

Where the [on-demand](/stt/guides/agent-on-demand) and [second-pass](/stt/guides/agent-second-pass) agents run a single isolated pass, a **wake-command agent** holds a multi-turn dialogue. The user speaks a **wake phrase** to talk to it hands-free, and each turn is grounded in the ones before it through **threaded memory**.

<Note>
  This combines three earlier building blocks: a [Commands](/stt/guides/dictation-commands) wake trigger, a [Keyterm](/stt/guides/dictation-keyterms) to bias the wake word, and the agent lifecycle from [On-Demand Agent](/stt/guides/agent-on-demand).

  The prompts used here are mere examples - be sure to test and refine the prompt to support your specific needs.
</Note>

***

## Gate input with a wake command

Configure a dictation command whose phrases start with the wake word and capture the rest of the utterance in a **wildcard** `{intent}` variable. Add the wake word as a [keyterm](/stt/guides/dictation-keyterms) so it's recognized reliably. See the [wake-command agent example](https://github.com/corticph/corti-examples/tree/main/sdk/typescript/applets/src/applets/wake-command-agent) in `corti-examples` for the full `dictationConfig` and command event handler.

When the command fires, extract the spoken intent from the wildcard variable, falling back to stripping the wake prefix from the raw transcript text if the variable is empty.

<Tip>
  Offer an **auto-send** toggle: when on, a recognized intent is sent immediately; when off, it's staged in the text composer so the user can review or edit before sending. Either way, typed and spoken turns go through the same send path.
</Tip>

***

## Maintain a conversation thread

Multi-turn memory is the one real difference from the single-shot agents. Instead of omitting `contextId`, **thread it**: pass the current `contextId` with each `messageSend` call and update it from the response. That is what lets follow-up questions stay grounded in earlier turns. Start a new thread by sending without a `contextId`; the response returns one to use on the next turn.

<Note>
  See [Context & Memory](/agentic/context-memory) for how threads work in the Agentic Framework. If a stored `contextId` is no longer valid on the server (a `404`), start a fresh thread by resending without it rather than failing the turn.
</Note>

***

## Reset the conversation

To start over, call `client.agents.deleteContext(agentId, contextId)` to remove the thread on the server, then clear your local `contextId` and message list.

***

## Next steps

<CardGroup cols={2}>
  <Card title="On-Demand Agent" icon="robot" href="/stt/guides/agent-on-demand">
    The agent lifecycle and message API, for a single isolated pass.
  </Card>

  <Card title="Conversational Agent" icon="waveform" href="/stt/guides/agent-conversational">
    Always-on voice agent — no wake phrase, every utterance forwarded with speculative prefetch.
  </Card>

  <Card title="Context & Memory" icon="brain" href="/agentic/context-memory">
    How conversation threads and memory work in the Agentic Framework.
  </Card>

  <Card title="Example code" icon="github" href="https://github.com/corticph/corti-examples/tree/main/sdk/typescript/applets/src/applets/wake-command-agent">
    The complete, runnable wake-command agent example in `corti-examples`.
  </Card>
</CardGroup>

<Note>Please [contact us](mailto:help@corti.ai) for help or questions.</Note>
