# Open AI

{% hint style="warning" %}
**Security Warning**

The current action shares the state with the OpenAI API, so it's not recommended for sensitive workspaces. Future versions will provide a mask method before sending the data.
{% endhint %}

### Description

The Ask Workspace action allows users to interact with OpenAI's GPT-4o model to ask questions and get assistance related to their Terraform Workspace. This action provides a chat interface where users can ask questions about their Workspace's Terraform state and receive helpful responses from the AI.

### Display Criteria

By default, this Action is disabled and when enabled will appear for all resources. If you want to display this action only for certain resources, please check [display criteria](#display-criteria).

### Setup

This action requires the following variables as [Workspace Variables](/2.21.0/user-guide/workspaces/variables.md#workspace-specific-variables) or [Global Variables](/2.21.0/user-guide/organizations/global-variables.md) in the Workspace Organization:

* **OPENAI\_API\_KEY**: The API key to authenticate requests to the OpenAI API. Please check [this guide](https://platform.openai.com/docs/quickstart/step-2-set-up-your-api-key) in how to get an OPEN AI api key

### Usage

* Navigate to the `Workspace` and click on the `Ask Workspace` button.

<figure><img src="/files/fUyBtFuxB8NEHYSQXWQF" alt=""><figcaption></figcaption></figure>

* Enter your questions and click the **Send** button or press the **Enter** key.

<figure><img src="/files/xo8zMLYKkZgOWYmmzLUS" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.terrakube.io/2.21.0/user-guide/workspaces/actions/built-in-actions/terrakube.open-ai.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
