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

# Quick start

> Connect a database, build an agent that uses it, and ask it a question in about 10 minutes

In about 10 minutes you connect a database, publish one table as an analytic model, build an agent that reads it, and ask that agent a question in chat.

## Before you start

* A DataGen account at [datagen.dev](https://datagen.dev). You need the **Builder** or **Admin** role in the workspace.
* Connection details for a PostgreSQL database, ideally with a read-only role.&#x20;

You do not need to configure any foundation first. Everything in this guide uses the workspace defaults:

| Foundation | Default used here |
| - | - |
| Vault | The workspace's **Default** vault, created on first use |
| Sandbox Environment | **Default (standard image)** |
| Harness | The built-in Claude Agent SDK |

## 1. Connect a database

<Steps>
  <Step title="Open Data">
    On the left navigation rail, click **More**, then **Data**. Open the **Connections** tab and click **Connect source**.
  </Step>

  <Step title="Fill in the connection">
    Keep **Source type** set to **PostgreSQL** and fill in **Connection name**, **SQL alias**, **Host**, **Port**, **Database**, **Username**, **Password** and **Schemas (comma-separated)**. Keep **TLS** set to **Verify certificate and hostname**.

    Click **Save connection**.
  </Step>

  <Step title="Choose a table">
    On the connection card, click **Manage tables**, select one table, and click **Save table selection**.&#x20;
  </Step>
</Steps>

## 2. Publish an analytic model

Agents read published analytic models, not raw tables.

<Steps>
  <Step title="Build a model from the table">
    Open the **Datasets** tab and select the table you added. Click **Build model**, keep the suggested name, and click **Create analytic dataset**. The Data Builder opens with a model that reads the table as is.
  </Step>

  <Step title="Preview it">
    On the **Results** tab, click **Execute SQL** to check the rows.
  </Step>

  <Step title="Publish">
    Click **Publish dataset**, review the publication, and click **Publish dataset** again.
  </Step>
</Steps>

## 3. Build an agent

<Steps>
  <Step title="Create the agent">
    Click **Agents** on the navigation rail, then **Create New**. Enter an **Agent name** and a **Description**, leave every **Runtime** field at its default, and click **Create & open builder**.

    The Agent Builder opens in three columns: chats, config and versions on the left, the builder chat in the middle, and the agent's sandbox files on the right.
  </Step>

  <Step title="Connect the model">
    Open the **Config** tab on the left. Under **Analytic models**, open **Pick models…**, select the model you published, and click **Connect model**.
  </Step>

  <Step title="Tell the builder what the agent does">
    In the builder chat, describe the agent. The builder writes the agent's instructions and files for you.

    ```text Example prompt theme={null}
    This agent answers questions about <subject> using the connected analytic model.
    Always query the model instead of guessing, show the numbers you used,
    and keep answers short.
    ```
  </Step>

  <Step title="Publish the agent">
    Click **Publish** in the header, then **Publish** in the dialog. Publishing saves a version and deploys the agent.
  </Step>
</Steps>

## 4. Ask a question

1. Click **Chat** on the navigation rail.
2. Click **Select an agent** in the message box and pick your agent.
3. Ask a question about the data:

   ```text Example question theme={null}
   <question about the demo data>
   ```

The agent queries the published model in its sandbox and answers with the numbers it used.&#x20;

## What just happened

* **Data** stored the connection and published a snapshot of the table as an analytic model.
* **Agents** connected that model, so the agent can query it with the `datagen-data` CLI inside its sandbox.
* The agent ran in a sandbox started from the default Sandbox Environment, driven by the default Harness, with credentials from the Default vault.

## Next steps

<CardGroup cols={2}>
  <Card title="Tutorial" icon="graduation-cap" href="/tutorial/01-connect-data">
    Go further: add documents, build a knowledge base, schedule a weekly report and share a dashboard.
  </Card>

  <Card title="Core concepts" icon="diagram-project" href="/overview/core-concepts">
    How the building blocks attach to each other and how versioning works.
  </Card>

  <Card title="Build models" icon="database" href="/data/build-models">
    Join tables, document models and refresh them on a schedule.
  </Card>

  <Card title="Build agents" icon="robot" href="/agents/build">
    Everything the Agent Builder can do.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.