LiveKit docs › Prebuilt components › Prebuilt tasks › GetDOBTask

---

# GetDOBTask

> Collect and validate a date of birth from the user with spoken date handling.

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

## Overview

Use `GetDOBTask` to collect a user's date of birth with support for various spoken and written date formats. The task validates the date and optionally collects a time of birth.

`GetDOBTask` handles the following:

- Normalization of spoken dates in formats like "January fifteenth, nineteen ninety" or "01 15 1990."
- Conversion of spoken ordinals and numbers to their numeric form.
- Handling of two-digit years (for example, "90" becomes 1990).
- Validation that the date is not in the future.
- Optional collection of time of birth.

The task returns a `GetDOBResult` data class with two fields: `date_of_birth` (`datetime.date`) and `time_of_birth` (`datetime.time | None`).

### Basic usage

For a basic example, see the following code snippet:

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

# ... within your agent ...
dob_result = await GetDOBTask(chat_ctx=self.chat_ctx)
print(f"Date of birth: {dob_result.date_of_birth}")

```

### Usage with time of birth

Enable time collection for use cases like birth records or astrology applications:

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

@function_tool()
async def collect_birth_info(context: RunContext) -> str:
    """Collect the user's date and time of birth"""
    dob_result = await GetDOBTask(
        include_time=True,
        chat_ctx=context.session.chat_ctx,
    )
    result = f"Date of birth: {dob_result.date_of_birth}"
    if dob_result.time_of_birth:
        result += f", Time: {dob_result.time_of_birth}"
    return result

```

### Parameters

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

- **`include_time`** _(bool)_ (optional) - Default: `False`: Whether to also ask for and collect the user's time of birth. The time is optional for the user even when enabled.

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

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