LiveKit docs › Prebuilt components › Prebuilt tasks › GetNameTask

---

# GetNameTask

> Collect and validate a user's name from noisy voice transcription or text input.

Available in (BETA):
- [ ] Node.js
- [x] Python

## Overview

Use `GetNameTask` to collect a user's name with configurable parts. The task handles first, middle, and last names independently, with built-in support for noisy voice transcription.

`GetNameTask` handles the following:

- Configurable collection of first, middle, and last name parts.
- Normalization of spoken name patterns, including letter-by-letter spelling and phonetic alphabet input.
- Conversion of words like "dash" and "apostrophe" into symbols (`-`, `'`).
- Optional spelling verification where the agent spells back each name part letter by letter.
- Culturally diverse name patterns and special characters.

The task returns a `GetNameResult` data class with three optional fields: `first_name`, `middle_name`, and `last_name`. Only the fields you configure for collection are populated.

### Basic usage

For a basic example, see the following code snippet:

```python
from livekit.agents.beta.workflows import GetNameTask

# ... within your agent ...
name_result = await GetNameTask(
    first_name=True,
    last_name=True,
    chat_ctx=self.chat_ctx,
)
print(f"Collected name: {name_result.first_name} {name_result.last_name}")

```

### Usage with spelling verification

Enable spelling verification to have the agent spell back the name letter by letter before confirming:

```python
from livekit.agents.beta.workflows import GetNameTask
from livekit.agents import function_tool, RunContext

@function_tool()
async def collect_patient_name(context: RunContext) -> str:
    """Collect the patient's full name with spelling verification"""
    name_result = await GetNameTask(
        first_name=True,
        last_name=True,
        verify_spelling=True,
        chat_ctx=context.session.chat_ctx,
        extra_instructions="This is for a medical record, so accuracy is critical.",
    )
    return f"Patient name recorded: {name_result.first_name} {name_result.last_name}"

```

### Parameters

For a full list of parameters, see the [GetNameTask reference](https://docs.livekit.io/reference/python/livekit/agents/beta/workflows/index.html.md#livekit.agents.beta.workflows.GetNameTask).

- **`first_name`** _(bool)_ (optional) - Default: `True`: Whether to collect the user's first name.

- **`last_name`** _(bool)_ (optional) - Default: `False`: Whether to collect the user's last name.

- **`middle_name`** _(bool)_ (optional) - Default: `False`: Whether to collect the user's middle name.

- **`name_format`** _(string)_ (optional): Custom format string for the name parts. Uses `{first_name}`, `{middle_name}`, and `{last_name}` placeholders. Defaults to the enabled parts joined by spaces.

- **`verify_spelling`** _(bool)_ (optional) - Default: `False`: Whether to verify the spelling of the name by reading it back letter by letter.

- **`extra_instructions`** _(string)_ (optional) - Default: `""`: Additional instructions to append to the task's default instructions.

- **`chat_ctx`** _(ChatContext)_ (optional): The conversation history the task-specific LLM sees. If you omit it, the task runs with an empty context, with no memory of what was said earlier in the session. Pass the primary agent's chat context so the task can refer to prior turns and, when used inside a task group, so exchanges are summarized back into the main context.

- **`require_confirmation`** _(bool)_ (optional): Whether to read the name back to the user to confirm it before finalizing the task. For audio sessions this defaults to `True`, for text it defaults to `False`.

- **`tools`** _(list)_ (optional): Additional tools available to the task. Use this to add or substitute function tools.

---

This document was rendered at 2026-06-07T11:35:38.279Z.
For the latest version of this document, see [https://docs.livekit.io/agents/prebuilt/tasks/get-name.md](https://docs.livekit.io/agents/prebuilt/tasks/get-name.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).