Skip to main content
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. You need the Builder or Admin role in the workspace.
  • Connection details for a PostgreSQL database, ideally with a read-only role.
You do not need to configure any foundation first. Everything in this guide uses the workspace defaults:

1. Connect a database

1

Open Data

On the left navigation rail, click More, then Data. Open the Connections tab and click Connect source.
2

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.
3

Choose a table

On the connection card, click Manage tables, select one table, and click Save table selection.

2. Publish an analytic model

Agents read published analytic models, not raw tables.
1

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.
2

Preview it

On the Results tab, click Execute SQL to check the rows.
3

Publish

Click Publish dataset, review the publication, and click Publish dataset again.

3. Build an agent

1

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.
2

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.
3

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.
Example prompt
4

Publish the agent

Click Publish in the header, then Publish in the dialog. Publishing saves a version and deploys the agent.

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:
    Example question
The agent queries the published model in its sandbox and answers with the numbers it used.

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

Tutorial

Go further: add documents, build a knowledge base, schedule a weekly report and share a dashboard.

Core concepts

How the building blocks attach to each other and how versioning works.

Build models

Join tables, document models and refresh them on a schedule.

Build agents

Everything the Agent Builder can do.