LiveKit docs › Prebuilt components › Prebuilt tasks › GetEmailTask

---

# GetEmailTask

> Collect and validate an email address from the user with noisy voice transcription handling.

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

## Overview

Use `GetEmailTask` to reliably collect and validate an email address from the user.

`GetEmailTask` handles the following:

- Normalization of noisy voice transcription and spoken email patterns.
- Conversion of words like "dot," "underscore," "dash," "plus" into symbols (`.`, `_`, `-`, `+`).
- Recognition of patterns where users spell out words (for example, "john j o h n").

The task returns a `GetEmailResult` data class with one field: `email_address`.

### Basic usage

For a basic example, see the following code snippet:

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

# ... within your agent ...
email_result = await GetEmailTask(chat_ctx=self.chat_ctx)
print(f"Collected email: {email_result.email_address}")

```

### Custom implementation

By default `GetEmailTask` calls its `decline_email_capture()` tool when the user doesn't provide an email address. The following example customizes the task to instead collect alternative contact information:

```python
from livekit.agents.beta.workflows import GetEmailTask
from livekit.agents import function_tool, RunContext
    
@function_tool()
async def get_alternate_contact_info(context: RunContext, contact_method: str, contact_value: str) -> None:
    """Collect alternative contact information when email isn't available"""
    # Store the alternative contact info
    context.session.userdata.alternate_contact_method = contact_method
    context.session.userdata.alternate_contact_value = contact_value
    
    await context.session.generate_reply(
        instructions=f"Acknowledge that you've recorded their {contact_method}: {contact_value}. Let them know this will be used for communication instead of email."
    )

# Customize GetEmailTask with extra instructions and tools
# ... within your agent ...
@function_tool()
async def collect_contact_info(context: RunContext) -> str:

    """Collect email or alternative contact information"""
    email_result = await GetEmailTask(
        chat_ctx=context.session.chat_ctx,
        extra_instructions="If the user cannot provide an email, call get_alternate_contact_info() instead of decline_email_capture().",
        tools=[get_alternate_contact_info]
    )

    return f"Collected email: {email_result.email_address}"

```

### Parameters

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

- **`extra_instructions`** _(string)_ (optional): Additional instructions to append to the task's default instructions. Use this to customize behavior for specific use cases.

- **`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.

- **`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:37.978Z.
For the latest version of this document, see [https://docs.livekit.io/agents/prebuilt/tasks/get-email.md](https://docs.livekit.io/agents/prebuilt/tasks/get-email.md).

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