# Codatum Agent (Beta)

{% hint style="warning" %}
This feature is currently in beta. Specifications are subject to change without notice.
{% endhint %}

AI Agent is a feature that autonomously performs data analysis and creates or edits Notebooks based on natural language instructions. It can reference catalog and Notebook contents to carry out analysis aligned with your intent.

{% hint style="info" %}
Information included in requests to Codatum Agent is not used for training purposes. However, information that may include Notebook contents and parts of your data sources will be sent to the selected LLM platform. Please review your organization's internal AI usage policy before use.
{% endhint %}

## Key Features

* Natural language instruction execution:
  * Simply enter instructions in the chat, and AI Agent will autonomously perform the necessary operations.
* Content reference:
  * References catalog and Notebook contents to execute query creation and more.
* Table exploration:
  * Automatically explores tables suitable for analysis based on catalog information and table column details.
* Notebook creation and editing:
  * In addition to returning analysis results in the chat, AI Agent can also create new Notebooks or edit existing ones.

## How to Use

The Agent can be used in two different screens, each with two available modes.

* Where to launch
  * **Chat panel**: Launch from the Agent icon in the UI. When viewing a Notebook, it appears as a side panel on the right.
    * Since it uses the currently open Notebook as context, the chat panel is recommended when running Agent while referencing a specific Notebook.
  * **Full-screen**: Launch from the side panel in the UI.
    * For data exploration or Notebook creation without referencing a specific Notebook, full-screen mode makes it easier to view chat content.
* Modes
  * **ASK mode**: Performs data analysis including query execution, but does not create or edit Notebooks. Use this when you want to ask questions about your data.
    * When running Agent from the chat panel, ASK mode is recommended if you do not want to edit the Notebook.
  * **Agent mode**: Executes all operations including Notebook creation, editing, and chart additions. Use this when you want to create Notebooks or add charts.

### Permission Scope

Operations by Codatum Agent are executed within the permission scope of the user running the Agent.

* Editor
  * Can perform a wide range of operations including SQL execution and Notebook editing
* Viewer
  * Can only view Notebook contents and previously executed data

Notebooks the Agent can explore and connections available to the Agent are also limited to what the executing user has access to.

{% hint style="info" %}
There is currently no feature to set custom permission scopes for the Agent. If there is data you do not want the Agent to access, you should take operational precautions such as manually approving each SQL execution. You can limit the exploration scope to some extent by specifying it in the agent context file.
{% endhint %}

### Agent Context

You can click the "book" icon in the upper left of the text box to view the context being passed to the Agent.

### Specifying Context

Use `@` to specify the context for AI Agent to reference.

| View                        | Available Context                            |
| --------------------------- | -------------------------------------------- |
| While viewing a Notebook    | Tables, Notebooks, Saved Queries, SQL Blocks |
| Full-screen and other views | Tables, Notebooks, Saved Queries             |

## Agent Screen

### Icons

The following actions are available from the icons in the upper right of the Agent chat panel:

* New chat
  * Leave the current chat and start a new one.
    * As context grows, token consumption efficiency decreases. It is recommended to start a new chat when switching to a different analysis.
* Chat history
  * View the history of past chats.
* Session info
  * Check usage details such as start time and total tokens used.
  * You can also navigate from the chat panel to full-screen mode here.
* Close
  * Close the chat panel.

The following action is available from the bottom of the chat input area:

* Send feedback
  * You can send feedback to the Codatum team.
    * If you check "Include conversation log" or "Include page context," please make sure your conversation does not contain any sensitive information.

### Agent Settings

The following settings are available from the Agent settings at the bottom of the text box:

* Switch between ASK mode / Agent mode
* Switch preferred connection:
  * You can select the connection to use preferentially.
  * When set to the default Auto, the agent selects the most appropriate connection.
* User settings
  * Line break with Enter
  * Auto-approve tool execution:
    * You can configure whether SQL queries are automatically executed per connection.
    * For BigQuery, you can also set an upper limit on the query read size that can be auto-executed, based on dry run results.
  * Auto-load agent context:
    * You can configure whether agent context files are automatically loaded.
  * Switch AI profile:
    * You can select which of your configured AI profiles to use.
    * Each AI profile can have its own model and context notebook settings, allowing you to switch between models and contexts depending on your use case.
    * See also: [AI Profile](https://docs.codatum.com/ai-assist/ai-profile)
  * Language

## Agent Context File

You can create an agent context folder at the following levels:

* Workspace
* Team space
* Private folder

You can also create an agent context page for individual Notebooks by adding a page named `.agent`.

By adding SQL blocks to a context file, you can pass information such as how specific metrics are calculated to the Agent as context.

## Unsupported Pages

AI Agent is currently not available on the following pages:

* Notebook Home
* Query
* Catalog
* Workflow
* Report

## Data Privacy

Requests to Codatum Agent are not used for training purposes. When executing requests to the Agent, parts of your Notebook contents and data may be sent to the LLM endpoint as context.

{% hint style="info" %}
For inquiries about the AI Agent feature, please contact us via chat or `support@codatum.com`.
{% endhint %}
