# Email Action

The Email Action allows agents to automatically send completed form submissions and conversation records directly to your inbox upon completion of an interaction.

For example:

- A restaurant concierge instantly emails reservation details to the host desk when a guest finishes booking.
- A customer inquiry agent forwards structured contact details and requirements to your sales team inbox.
- A support triage assistant delivers ticket details without requiring you to monitor a dashboard.

## Configuration

Actions are configured declaratively in the agent's YAML specification under the `actions:` section.

Configure the `email:` block under `actions:` in your agent's declarative YAML definition:

```yaml
actions:
  email:
    to: 'Reservations Team <reservations@example.com>'
    on:
      includeTranscript: true
```

You can view and edit the YAML definition by opening your agent in the [Agents](/agents) dashboard and selecting the **Code** tab.

### Configuration Options

| Field                  | Type    | Default      | Description                                                                                                                                           |
| :--------------------- | :------ | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------- |
| `to`                   | string  | _(Required)_ | Recipient email address. Supports standard emails (`alice@example.com`) or RFC 5322 formatted names (`"Alice Smith" <alice@example.com>`).            |
| `enabled`              | boolean | `true`       | When `to` is specified, the action is enabled by default. Set to `false` to temporarily pause email delivery without deleting the configured address. |
| `on.formCompleted`     | boolean | `true`       | Automatically sends an email when all required fields of a conversational form agent (`kind: form`) have been collected.                              |
| `on.includeTranscript` | boolean | `false`      | When enabled, appends the full conversation transcript to the email alongside the extracted form fields.                                              |
| `on.sessionEnded`      | boolean | `false`      | Sends an email when a chat session closes or goes idle, even if no form was completed.                                                                |

### Form Data Section

Extracted form data is presented as a clean, human-readable nested key-value list with indented sub-items, based on the agent's form output schema. This guarantees that complex or nested form structures (such as addresses, guest lists, or multi-field options) remain easy to read:

```markdown
- **Party**:
  - **Size**: 4
  - **Outdoor Seating**: Yes
- **Contact**:
  - **Name**: Alice Smith
  - **Phone**: +1 555 0199
- **Special Requests**: Window table if available
```
