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

# Domain

> In Rasa, your domain defines the universe in which your assistant operates.

In Rasa, your `domain` defines the universe in which your assistant operates.
Specifically, it lists:

* The `responses` that can be used as templated messages to send to a user.
* The custom `actions` that can be predicted by dialogue policies.
* The `slots` that act as your assistant's memory throughout a conversation.
* Session configuration parameters including inactivity timeout.

If you are building an NLU-based assistant, refer to the
[Domain documentation](https://legacy-docs-oss.rasa.com/docs/rasa/domain) to see how
intents, entities, slot mappings, and slot featurization can be configured in
your domain.

## Multiple Domain Files

The domain can be defined as a single YAML file or split across multiple files in a directory.
When split across multiple files, the domain contents will be read and automatically merged together.
You can also manage your responses, slots, custom actions in [Rasa Studio](https://rasa.com/docs/studio/intro.md).

Using the [command line interface](https://rasa.com/docs/reference/api/command-line-interface.md#rasa-train),
you can train a model with split domain files by running:

```bash theme={null}
rasa train --domain path_to_domain_directory
```

## Responses

Responses are templated messages that your assistant can send to your user.
Responses can contain rich content like buttons, images, and custom json payloads.
Every response is also an [action](https://rasa.com/docs/reference/config/domain.md#actions), meaning that it can be used directly in
an `action` step in a flow.
Responses can be defined directly in the domain file under the `responses` key.
For more information on responses and how to define them,
see [Responses](https://rasa.com/docs/reference/primitives/responses.md).

## Actions

[Actions](https://rasa.com/docs/reference/primitives/actions.md) are the things your bot can do.
For example, an action could:

* respond to a user,
* make an external API call,
* query a database, or
* just about anything!

All [custom actions](https://rasa.com/docs/reference/primitives/custom-actions.md) should be listed in your domain.

Rasa also has [default actions](https://rasa.com/docs/reference/primitives/default-actions.md) which you do not
need to list in your domain.

## Slots

Slots are your assistant's memory. They act as a key-value store
which can be used to store information the user provided (e.g. their home city)
as well as information gathered about the outside world (e.g. the result of a
database query). Check out the [Slots reference](https://rasa.com/docs/reference/primitives/slots.md) for more information.

## Session configuration

A conversation session represents the dialogue between the assistant and the user.
Conversation sessions can begin in three ways:

1. the user begins the conversation with the assistant,
2. the user sends their first message after a configurable period of inactivity, or
3. a manual session start is triggered with the `/session_start` intent message.

You can define the period of inactivity after which a new conversation
session is triggered in the domain under the `session_config` key.

Available parameters are:

* `session_expiration_time` defines the time of inactivity in minutes after which a
  new session will begin.
* `carry_over_slots_to_new_session` determines whether
  existing set slots should be carried over to new sessions.
* `start_session_after_expiry` (new in 3.16, default `true`) determines whether
  `action_session_start` runs when the next user message arrives after the session
  timer fires. When `false`, slots are preserved without a session boundary. See
  [Session Timer](https://rasa.com/docs/reference/config/session-management/session-timer.md#start_session_after_expiry).

The default session configuration looks as follows:

```yaml theme={null}
session_config:
  session_expiration_time: 60  # value in minutes, 0 means infinitely long
  carry_over_slots_to_new_session: true  # set to false to forget slots between sessions
  start_session_after_expiry: true  # new in 3.16; must be false when a2a_server is enabled
```

This means that if a user sends their first message after 60 minutes of inactivity, a
new conversation session is triggered, and that any existing slots are carried over
into the new session. Setting the value of `session_expiration_time` to `0` means
that sessions will not end (note that the `action_session_start` action will still
be triggered at the very beginning of conversations).

> [!WARNING]
>
> **Required for A2A sub-agent mode**
>
> When `a2a_server` is configured in `endpoints.yml`, set `start_session_after_expiry: false`.
> Resumed orchestrator `contextId` values map to the same Rasa `sender_id`; auto session restart would reset slots silently.
>
> See [A2A Server](https://rasa.com/docs/reference/integrations/a2a-server.md#session-configuration).

> [!NOTE]
>
> A session start triggers the default action `action_session_start`. Its default
> implementation moves all existing slots into the new session. Note that all
> conversations begin with an `action_session_start`. Overriding this action could
> for instance be used to initialize the tracker with slots from an external API
> call, or to start the conversation with a bot message. The docs on
> [Customizing the session start action](https://rasa.com/docs/reference/primitives/default-actions.md#customization) shows you how to do that.

## Select which actions should receive domain

> [!NOTE]
>
> **New in 3.4.3**
>
> You can control if an action should receive a domain or not.

To do this you must first enable selective domain in you endpoint configuration for
`action_endpoint` in `endpoints.yml`.

```yaml title="endpoints.yml" theme={null}
action_endpoint:
 url: "http://localhost:5055/webhook" # URL to your action server
 enable_selective_domain: true
```

**After selective domain for custom actions is enabled, domain will be sent only to
those custom actions which have specifically stated that they need it.**
To specify if an action needs the domain add `{send_domain: true}` to custom action in the list
of actions in `domain.yml`:

```yaml title="domain.yml" theme={null}
actions:
  - action_hello_world: {send_domain: True} # will receive domain
  - action_calculate_mass_of_sun # will not receive domain
  - validate_my_form # will receive domain
```


## Related topics

- [Retrieve the loaded domain](https://rasa.com/docs/reference/api/pro/http-api/domain/retrieve-the-loaded-domain.md)
- [Actions](https://rasa.com/docs/reference/integrations/action-server/actions.md)
- [Configuring Your Assistant](https://rasa.com/docs/pro/build/configuring-assistant.md)
- [Rasa MCP Tools API Reference](https://rasa.com/docs/reference/api/rasa-mcp-tools.md)
- [Twilio Voice](https://rasa.com/docs/reference/channels/twilio-voice.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.