> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://help.sigmacomputing.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://help.sigmacomputing.com/_mcp/server.

# Example representation: Workbook with an AI column (Beta)

> Example Sigma code representation of a workbook with an AI column.

> **Note**
>
> This documentation describes one or more public beta features that are in development. Beta features are subject to quick, iterative changes; therefore the current user experience in the Sigma service can differ from the information provided in this page.
>
> This page should not be considered official published documentation until Sigma removes this notice and the beta flag on the corresponding feature(s) in the Sigma service. For the full beta feature disclaimer, see [Beta features](/docs/sigma-product-releases#beta-features).

This is an example representation of a workbook, retrieved using the [Get a workbook](/reference/get-workbook) endpoint with the query parameter `includeContents=true`. Representations like this one can be used to create a workbook from code using the [Create a workbook](/reference/create-workbook) endpoint. Each page in this example library includes the code representation of the workbook and step-by-step instructions to create it in the Sigma UI.

Consult this example and others in the [Workbook representation example library](/docs/workbook-representation-example-library) to:

* Troubleshoot the formatting of a particular feature in code representation
* Relate a feature from the Sigma UI to its representation in code
* Provide context to AI tools used to create workbooks from code

> **Warning**
>
> This example representation cannot be used as-is. All identifying details, such as IDs, names, and URLs, have been replaced with randomized ID values or generic substitutions. The format of these contents, like the length of ID values, is preserved for demonstrative purposes. However, this representation cannot be directly used without modification to the base URL, connection details, and more. For more information, see [Create and manage workbooks from code](/docs/manage-workbooks-as-code).

## System and user requirements

To complete the steps in this example, you must meet the user requirements listed below for creating the workbook in the UI and creating it from code.

The ability to create this workbook in the Sigma UI requires the following:

* You must be assigned an [account type](/docs/account-type-and-license-overview) with the **Create, edit, and publish workbooks** and **Create AI column** permissions enabled.
* You must have access to a connection that meets the requirements to [Create an AI column](/docs/create-ai-columns#system-and-user-requirements).

The ability to create a workbook from code requires the following:

* You must be assigned an [account type](/docs/account-type-and-license-overview) with the **Create, edit, and publish workbooks** permission enabled.
* You must have developer credentials for the Sigma API. For more information, see [Get started with the Sigma REST API](/reference/get-started-sigma-api).

This example uses a table from the [Sigma Sample Connection](/docs/sigmas-sample-connection). Your organization might have disabled access to the Sigma sample connection. If so, you can contact an admin to enable it, or use a table from another connection to follow along with this example.

## Create the example workbook in the Sigma UI

This example shows a workbook containing a table with an AI column.

To create this workbook in the Sigma UI:

1. Go to the **Home** page.

2. Select ![](https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/button-add.svg) **Create new** > **Workbook**.

   A new workbook opens.

3. From the **Add element** bar, select **Data** > **Table**.

4. In the **Select source** modal, search for the table `BIKE_TRIPS` in the `EXAMPLES.CITY_BIKE` schema.

   > **Tip**
   >
   > You can't create AI columns on the [Sigma sample connection](/docs/sigmas-sample-connection). To follow this example, use a table from a connection configured to use AI columns.

5. Add a filter to the table to only view data for trips starting from the **Sullivan Pl & Bedford Ave**:
   1. Select **Filters** (![](https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/filter.svg)) in the element toolbar.
   2. Select **Add filter...** to add a new filter.
   3. Search for and select the **Start Station Name** column.
   4. Search for and select **Sullivan Pl & Bedford Ave**.

6. From the table, select the down arrow ![](https://sigma-docs-screenshots.s3.us-west-2.amazonaws.com/Icons/caret.svg) to open the column menu.

7. In the column menu, select **Add column via** > **AI column**….

   The **Add AI column** modal opens.

8. For **Column name**, enter `Federal holidays`.

9. For **Prompt**, enter the following prompt:

   `For trips starting at [Starttime], describe whether that day is a US federal holiday.`

   > **Info**
   >
   > To reference the *Starttime* column dynamically, press `=` on the keyboard to open the **Source column** modal, and select it.

10. Select the **JSON format** tab.

11. Add the following two fields:

    | Name           | Type        | Description                                       |
    | :------------- | :---------- | :------------------------------------------------ |
    | `is_us_hol`    | **Logical** | `Return true if the date is a US federal holiday` |
    | `holiday_name` | **Text**    | `Name the holiday on this date`                   |

12. Select the **Don't run automatically** checkbox.

13. Select **Save**.

14. In the document header, select **Save as**.

15. Enter a name for the workbook, such as `ai-column`.

16. Select **Save**.

## Get a code representation of this workbook

To get a representation of this workbook, follow the steps in [Get the code representation of a workbook](/docs/get-the-code-representation-of-a-workbook).

The code representation of this workbook appears like the following:

#### YAML representation

```yaml
workbookId: 2d518e4f-39f6-4c2d-a66b-51b46a5aab89
workbookUrlId: 82sOYLdgu7nHGOHNbkf58B
createdBy: oCBuTsBtUXL0EOImtEKFt3EWbWwP7
updatedBy: oCBuTsBtUXL0EOImtEKFt3EWbWwP7
createdAt: '2026-09-25T18:22:15.680Z'
updatedAt: '2026-11-04T21:43:12.733Z'
name: ai-column
url: https://aws-api.sigmacomputing.com/org-name/workbook/82sOYLdgu7nHGOHNbkf58B
path: My Documents/<folder-name>
latestVersion: 6
ownerId: oCBuTsBtUXL0EOImtEKFt3EWbWwP7
isArchived: false
contents:
  schemaVersion: 1
  elements:
    - id: R8g7yYArbR
      kind: table
      source:
        connectionId: 009aa77c-f62a-4955-b41d-5c923e8691bf
        kind: warehouse-table
        path:
          - EXAMPLES
          - CITY_BIKE
          - BIKE_TRIPS
      columns:
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/TRIPDURATION
          formula: '[BIKE_TRIPS/Tripduration]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/STARTTIME
          formula: '[BIKE_TRIPS/Starttime]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/STOPTIME
          formula: '[BIKE_TRIPS/Stoptime]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_ID
          formula: '[BIKE_TRIPS/Start Station Id]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_NAME
          formula: '[BIKE_TRIPS/Start Station Name]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_LATITUDE
          formula: '[BIKE_TRIPS/Start Station Latitude]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_LONGITUDE
          formula: '[BIKE_TRIPS/Start Station Longitude]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_ID
          formula: '[BIKE_TRIPS/End Station Id]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_NAME
          formula: '[BIKE_TRIPS/End Station Name]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_LATITUDE
          formula: '[BIKE_TRIPS/End Station Latitude]'
        - id: inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_LONGITUDE
          formula: '[BIKE_TRIPS/End Station Longitude]'
      filters:
        - id: 87EoqTiHFm
          columnId: inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_NAME
          kind: list
          mode: include
          values:
            - Sullivan Pl & Bedford Ave
      order:
        - inode-iKDBQFBcmE1fikQlrU7bdl/TRIPDURATION
        - inode-iKDBQFBcmE1fikQlrU7bdl/STARTTIME
        - inode-iKDBQFBcmE1fikQlrU7bdl/STOPTIME
        - inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_ID
        - inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_NAME
        - inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_LATITUDE
        - inode-iKDBQFBcmE1fikQlrU7bdl/START_STATION_LONGITUDE
        - inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_ID
        - inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_NAME
        - inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_LATITUDE
        - inode-iKDBQFBcmE1fikQlrU7bdl/END_STATION_LONGITUDE
    - id: BgEbKqIbQP
      kind: table
      source:
        elementId: R8g7yYArbR
        kind: table
      columns:
        - id: oUncGjxsVZ
          formula: '[BIKE_TRIPS/Tripduration]'
        - id: SQzDVDabwb
          formula: '[BIKE_TRIPS/Starttime]'
        - id: jbaIozL1YA
          formula: '[BIKE_TRIPS/Stoptime]'
        - id: A6o5khAP9e
          formula: '[BIKE_TRIPS/Start Station Id]'
        - id: 9jyH5i8TJF
          formula: '[BIKE_TRIPS/Start Station Name]'
        - id: g8BGz3iywc
          formula: '[BIKE_TRIPS/Start Station Latitude]'
        - id: aoMpb2xa8A
          formula: '[BIKE_TRIPS/Start Station Longitude]'
        - id: Aju5QYqCBe
          formula: '[BIKE_TRIPS/End Station Id]'
        - id: fAFjOyWQuZ
          formula: '[BIKE_TRIPS/End Station Name]'
        - id: OQ2VY0oQy3
          formula: '[BIKE_TRIPS/End Station Latitude]'
        - id: XGljl9Bj5N
          formula: '[BIKE_TRIPS/End Station Longitude]'
        - id: ai-zO0dwn9xCV
          ai:
            type: complete
            model: claude-haiku-4-5
            prompt: For trips starting on {{[BIKE_TRIPS/Starttime]}},  describe whether that day is a US federal holiday.
            run: manual
            responseFormat:
              is_us_hol:
                type: boolean
                description: Return true if the date is a US federal holiday
              holiday_name:
                type: text
                description: Name the holiday on this date
          name: Federal holidays
      order:
        - oUncGjxsVZ
        - SQzDVDabwb
        - jbaIozL1YA
        - A6o5khAP9e
        - 9jyH5i8TJF
        - g8BGz3iywc
        - aoMpb2xa8A
        - Aju5QYqCBe
        - fAFjOyWQuZ
        - OQ2VY0oQy3
        - XGljl9Bj5N
        - ai-zO0dwn9xCV
  pages:
    - id: 8TnXzuGHLB
      name: Page 1
  kind: workbook
  layout: |
    <?xml version="1.0" encoding="utf-8"?>
    <Page type="grid" gridTemplateColumns="repeat(24, 1fr)" gridTemplateRows="auto" id="8TnXzuGHLB">
      <Element elementId="R8g7yYArbR" gridColumn="1 / 25" gridRow="1 / 21"/>
      <Element elementId="BgEbKqIbQP" gridColumn="1 / 25" gridRow="21 / 41"/>
    </Page>
documentVersion: 6

```

## Representing an AI column

#### AI column representation

```yaml
...
columns:
- id: ai-zO0dwn9xCV
  ai:
    type: complete
    model: claude-haiku-4-5
    prompt: For trips starting on {{[BIKE_TRIPS/Starttime]}},  describe whether that
      day is a US federal holiday.
    run: manual
    responseFormat:
      is_us_hol:
        type: boolean
        description: Return true if the date is a US federal holiday
      holiday_name:
        type: text
        description: Name the holiday on this date
  name: Federal holidays
...
```