# AI Chat Interface

Ask a question in plain language and watch Studio translate it into executed queries, segment definitions, and production-ready files — all streamed in real time so you can see every decision the AI makes.

Note
The AI executes all actions inside a server-side sandbox. Every tool call (queries, API requests, file operations) is visible and expandable in the chat stream, so you can verify what happened before acting on results.

## Objective

Use the chat interface to send instructions, monitor AI execution in real time, and interact with responses through copy, edit, and stop actions.

## Prerequisites

- Signed in to Treasure AI Studio ([Getting Started](/products/ai-studio/getting-started))
- At least one database accessible in your Treasure AI account (for query-related tasks)


## Sending Messages

Type your message in the input area at the bottom of the screen and press **Enter** (or tap the **Send** button) to send.

### Web & Desktop

- Type in the message text area at the bottom of the screen
- Press **Enter** to send, or **Shift+Enter** for a new line
- The text area expands as you type, up to a maximum height


Before you type, the input shows a rotating example prompt (for instance, *"e.g. build a segment of high-value shoppers who haven't purchased in 30 days"*) to suggest the kinds of requests Studio handles.

Chat input area with text field, attach files button, model selector, and send button
### Mobile (iOS)

- Tap the text area labeled **"Ask anything..."**
- Tap the **Send** button (arrow icon) to send
- Use the **microphone button** to dictate your message instead of typing (see [Voice Input](/products/ai-studio/chat/voice-input))


## Starting a New Chat

### Web & Desktop

Click the **New Chat** button (message-square-plus icon) in the sidebar under **Chats**.

A new chat opens to a welcome screen with the prompt **"Welcome in. Every journey starts with a first step — where's yours?"** and category suggestions to help you get started:

- **Analyze data** — Explore and compare data across your account
- **Identify segments** — Find and target an audience
- **Plan email campaign** — Design an email send
- **Map journey** — Design a customer journey


Selecting a category offers example prompts you can send as-is or edit.

Landing page with suggestion pills for common actions
### Mobile (iOS)

Tap the **floating action button** (message-square-plus icon) at the bottom right of the chat list.

## How the AI Responds

When you send a message, Studio shows the AI's response as it generates in real time.

### Thinking Phase

Before responding, the AI may spend time reasoning about your request. While it does, a **"Thinking"** indicator appears. When the reasoning is relevant, it is shown in a collapsible block you can expand to follow how the AI planned its response — which tools to call, in what order, and how to structure a complex answer.

### Streaming Phase

The AI's text appears word by word as it generates. If the AI needs to execute actions (run a query, read a file, call an API), you see each tool call displayed inline as it happens.

**Tool calls display:**

- Tool name and status (running, completed, or failed)
- Expandable details showing the tool's input and output
- Real-time progress — you can watch queries execute and results return


### Stopping a Response

If you want to interrupt the AI mid-response:

- **Web & Desktop:** Click the **Stop** button (square icon) that replaces the Send button during generation
- **Mobile:** Tap the **Stop** button (square icon)


## Web Search

Studio's built-in agents can search the web in real time during a chat, automatically bringing current, real-world information into your conversation.

### When Web Search Runs

Studio's built-in agents decide on their own whether a web search is needed based on your prompt — there is no setting to turn on and no special command to type. If your question implies a need for recent or time-sensitive information, the agent recognizes this and searches the web before answering. Typical examples include:

- Recent market trends or industry news
- Competitor activity and announcements
- Any topic where up-to-date, real-world context matters


For requests that can be answered from your Treasure AI data or the AI's existing knowledge, no web search runs.

### What You See

When a web search runs, it appears inline in the chat stream as a tool call, just like a query or API request. You can expand the tool call to see the search activity, and the AI incorporates the results into its response. This keeps every action transparent — you can always verify when and why the AI reached out to the web.

Note
Web Search requires no configuration and is enabled automatically for every chat.

Technical Note
Web Search is powered by a hosted third-party web search capability. The AI invokes it as one of its tools; results are returned inline as a `Web search` tool call.

## Message Actions

### Copying a Response

Hover over any assistant message to reveal a **Copy** button. Click it to copy the full response text to your clipboard. A checkmark icon confirms the copy.

### Editing and Resending

Hover over any of your messages to reveal a **pencil icon**. Click it to edit your message:

1. The message text becomes editable in a text area
2. Modify your message
3. Click **Submit** to resend, or **Cancel** to discard changes


Technical Note
Editing a message rewinds the conversation to that point. All subsequent messages (yours and the AI's) are removed, and the AI generates a fresh response to your edited message.

## Chat States

| State | What You See | What It Means |
|  --- | --- | --- |
| **Active** | Normal input area | Chat is ready for messages |
| **Streaming** | Stop button, text appearing | AI is generating a response |
| **Thinking** | "Thinking" with bouncing dots | AI is reasoning before responding |
| **Waiting** | Loading indicator | Waiting for server response |
| **Question pending** | Question card above input | AI is asking you a question — answer before continuing |
| **Session ended** | Banner explaining why, with a **Resume** button | The working session was released (for example, after inactivity). Send a message or click **Resume** to continue |


### When the AI Asks a Question

Sometimes the AI needs more information before proceeding. When this happens, a **question card** appears in the chat with the AI's question and an input field for your answer.

- Type your answer and click **Submit**
- The regular chat input is disabled with the placeholder **"Answer the question above..."** until you respond


### When a Session Ends

To free resources, Studio releases a chat's working session after a period of inactivity (or if it was interrupted). When this happens:

- A banner explains why the session ended — for example, **"Session ended due to inactivity."**
- The full conversation history stays visible
- You can pick up where you left off: send a message, or click **Resume** to restart the session with its prior context


This ends the *working session*, not the chat. The conversation itself remains in your history until it is deleted (see [Chat Persistence & History](/products/ai-studio/chat/chat-history)).

## Sandbox Execution Environment

All AI actions execute in a server-side sandbox — not on your local machine. If the sandbox encounters an issue, you see:

> "The sandbox environment crashed unexpectedly and is restarting. Please wait a moment and try again. If the problem persists, contact support."


The sandbox restarts automatically. See [Security & Permissions](/products/ai-studio/security) for details on the execution environment.

## Adding Files to a Message

Adding a file is really an **upload plus a reference**: Studio uploads the file to the chat's workspace and appends its path to your message. The AI then opens the file from that path — so the file isn't attached to the message so much as placed where the AI can read it.

### Web & Desktop

- Click the **plus button** (+) in the chat input toolbar to pick a file
- Selected files appear as chips below the text area, each showing a file-type icon and name
- Click the **X** on a chip to remove one before sending
- When you send, each uploaded file's path is added to the end of your message


### Mobile (iOS)

Tap the **plus button** (+) to open the file menu with options:

- **File** — Browse and select documents
- **Camera** — Take a photo
- **Photos** — Select from your photo library


Selected files appear as pills below the text area. Tap the **X** on a pill to remove one.

> For details on supported file types and viewers, see [File Upload & Download](/products/ai-studio/files/file-upload-download) and [File Viewers](/products/ai-studio/files/file-viewers).


## Keyboard Shortcuts (Web & Desktop)

| Shortcut | Action |
|  --- | --- |
| **Enter** | Send message |
| **Shift+Enter** | New line in message |
| **Escape** | Cancel message edit |


## Verification

- [ ] Send a message and see the AI's "Thinking" indicator followed by a streaming response
- [ ] Expand a tool call to see its input and output
- [ ] Copy an assistant response to your clipboard


## Troubleshooting

| Issue | Solution |
|  --- | --- |
| Chat shows "Booting secure sandbox..." or "Initializing agent..." for a while | Studio is establishing the session. Wait a few seconds for the sandbox to initialize. If it persists, refresh the page or restart the app |
| AI response cuts off mid-sentence | Send a follow-up message asking the AI to continue. Studio compacts context automatically as the window fills (see [In-Session Memory](/products/ai-studio/chat/in-session-memory)); if a session is heavily loaded, start a new chat |
| Tool call shows an error | Expand the tool call to see the error details. Common causes: incorrect database name, expired session, or insufficient permissions |


## Next Steps

- [Chat Persistence & History](/products/ai-studio/chat/chat-history) — How conversations are saved and managed
- [Auto-Titled Conversations](/products/ai-studio/chat/chat-auto-titling) — How Studio names your chats
- [In-Session Memory](/products/ai-studio/chat/in-session-memory) — Context management for long conversations
- [Voice Input](/products/ai-studio/chat/voice-input) — Dictate messages on iOS