> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsolve.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents

> Build AI chat experiences that understand your data.

## What is an Agent?

An Agent is an AI-powered chat interface that:

* Converts natural language questions into SQL
* Analyzes results and provides insights
* Creates visualizations from query results
* Learns from examples (Golden Assets)

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/agent-overview.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=d4e8ea68193b911a9ec7dbd6835cfd7f" alt="Agent chat interface" width="2930" height="1808" data-path="images/ai-agent-builder/agent-overview.png" />
</Frame>

## Agent Components

### Data Model Link

Every agent is linked to a specific data model version. This ensures:

* The agent knows what tables and columns exist
* Changes to the data model don't break the agent
* You can test with different data model versions

### System Prompt

A custom prompt that shapes how the agent responds:

* Company context and terminology
* Response style preferences
* Special instructions

### Golden Assets

Example queries and charts that teach the agent:

* How to write SQL for common questions
* What visualizations to create
* Correct terminology and calculations

### Evaluations (Evals)

Test sets to verify agent accuracy:

* Known question-answer pairs
* SQL validation
* Result comparison

## Creating an Agent

1. Navigate to your project's **Agents** tab
2. Click **Create Agent**
3. Enter a name and description
4. Select the data model to use
5. Click **Create**

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/create-agent.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=24774aecd3f493584837d0c9a32977e9" alt="Create agent dialog" width="1078" height="890" data-path="images/ai-agent-builder/create-agent.png" />
</Frame>

## Configuring Your Agent

### Setting the System Prompt

1. Open your agent
2. Go to the **System Prompt** tab in the sidebar
3. Write instructions for the agent
4. Click **Save**

Example system prompt:

```
You are a data analyst for an e-commerce company.
Use clear, business-friendly language.
When users ask about "revenue," they mean gross_sales minus refunds.
Always include date ranges in your analysis.
```

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/system-prompt.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=753b88207d887370b833f15d27804226" alt="System prompt editor" width="1250" height="1398" data-path="images/ai-agent-builder/system-prompt.png" />
</Frame>

### Adding Golden Assets

Golden Assets are example queries that improve accuracy:

1. Go to the **Assets** tab
2. Click **Add Asset**
3. Enter the question and corresponding SQL
4. Optionally add a chart configuration
5. Click **Save**

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/golden-assets.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=7dea5707c7c07d5b3bc3e0376cfe1b6f" alt="Golden assets list" width="1224" height="1830" data-path="images/ai-agent-builder/golden-assets.png" />
</Frame>

**Tip:** The more golden assets you add for common questions, the more consistent your agent becomes.

### Creating Evaluations

1. Go to the **Tests** tab
2. Click **Add Test**
3. Enter a question
4. Enter the expected SQL or answer
5. Save and run the test

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/agent-tests.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=5b7a9ac5349929b7d6d5b5d700ff1b89" alt="Agent test interface" width="1222" height="1830" data-path="images/ai-agent-builder/agent-tests.png" />
</Frame>

## Admin View vs User View

### Admin View

As an admin, you see full details:

* Every tool call the AI makes
* SQL queries generated
* Step-by-step reasoning
* Token usage and timing

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/admin-chat.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=00585ce2176212ab728a34ac97513535" alt="Admin chat view with tool calls expanded" width="2920" height="1686" data-path="images/ai-agent-builder/admin-chat.png" />
</Frame>

### User View

End users see a clean interface:

* Just the question and answer
* Charts and insights
* No technical details

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/user-chat.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=5afeb68d0447e290f43611dc35e4c990" alt="User chat view" width="2930" height="1690" data-path="images/ai-agent-builder/user-chat.png" />
</Frame>

## Versioning

Like data models, agents are versioned:

1. Go to the **Versions** tab
2. See all versions with timestamps
3. Each version tracks: assets, prompt, data model link

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/agent-versions.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=512197b0bcc2f283f137bf730f78afa1" alt="Agent versions list" width="1094" height="380" data-path="images/ai-agent-builder/agent-versions.png" />
</Frame>

## Setting Production

Before users can access your agent, you must set a version as production.

### Requirements

1. The agent must be linked to a data model
2. That data model version must already be production
3. The agent's schema requirements must fit within the data model

### Steps

1. Open your agent
2. Go to the **Versions** tab
3. Click **Set as Production** on the version you want
4. The system validates everything
5. If successful, users can now access this version

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/agent-production.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=1c4b983b321ae35b71b8388be946eea1" alt="Set agent as production" width="1208" height="1104" data-path="images/ai-agent-builder/agent-production.png" />
</Frame>

### Validation Errors

If validation fails, you'll see specific errors:

* "Data model version is not production" - Set the data model production first
* "Missing tables/columns" - The agent uses data not in the data model

## Changing Data Model Version

To link your agent to a different data model version:

1. Go to the **Data Model** tab in the sidebar
2. Select the data model
3. Choose a version (production versions recommended)
4. Click **Save**

This creates a new agent version with the new data model link.

<Frame>
  <img src="https://mintcdn.com/upsolve/fLb4mfHG-6nE-S3X/images/ai-agent-builder/change-data-model.png?fit=max&auto=format&n=fLb4mfHG-6nE-S3X&q=85&s=9df2488c5b8743a6ae606ac62e8d8bc1" alt="Change data model version" width="2218" height="822" data-path="images/ai-agent-builder/change-data-model.png" />
</Frame>

## Best Practices

### 1. Start with Golden Assets

Add 10-20 golden assets covering common questions before going live.

### 2. Use Descriptive Data Models

Column descriptions in your data model help the agent understand your schema.

### 3. Run Evals Regularly

Create a test suite and run it whenever you update the agent.

### 4. Monitor in Admin View

Periodically check admin view to see how the agent handles real questions.

## Next Steps

* [Build an Application](/ai-agent-builder/applications) to combine agents with dashboards
* [Set up the complete flow](/ai-agent-builder/setup-guide) from project to production
