# What the agent knows about your data

> Context is what each AI client is told about a data source, from table descriptions to defined metrics.

Updated: 2026-11-09

Each data source has its own context, in the Context section of the console at `app.bonnard.ai`. The agent uses it to
write correct SQL against that data source.

[Image: The Context page for Acme production: Version 2, Published, 4 tables, 0 metrics, and a note that AI clients cannot publish context changes]

## What context holds

Table: What each item tells the agent

| Item                                                        | What it tells the agent                                                   |
| ----------------------------------------------------------- | ------------------------------------------------------------------------- |
| [Description](https://bonnard.ai/docs/context/descriptions-and-keys.md#write-a-description) | What a table or column holds                                              |
| [Key](https://bonnard.ai/docs/context/descriptions-and-keys.md#set-a-key)                   | The columns that identify one row, so it knows what it can count          |
| [Time column](https://bonnard.ai/docs/context/descriptions-and-keys.md#set-a-time-column)   | Which date to filter and group by                                         |
| [Join](https://bonnard.ai/docs/context/joins.md)                                            | How two tables connect, so it joins on the right columns                  |
| [Metric](https://bonnard.ai/docs/context/metrics.md)                                        | A named calculation with instructions. Bonnard does not apply it to the agent's SQL |
| [Visibility](https://bonnard.ai/docs/context/hide-tables.md)                                | If it can find a table. Hiding does not stop a query that names the table |

## Where a value comes from

The console marks a value with a badge that names its origin.

Table: Where each value comes from

| Origin                                    | Badge      | What it supplies                                                  |
| ----------------------------------------- | ---------- | ----------------------------------------------------------------- |
| Your team, in the console or an AI client | `edited`   | Any item. A description your team writes overrides the database's |
| The database                              | `database` | Descriptions, primary keys, and foreign keys. Bonnard does not read foreign keys from MySQL / MariaDB |

## Drafts and versions

Each change goes into the draft. A data source has one draft, and everyone who changes its context works in it. A later
change to the same field replaces the earlier one. AI clients and the customer portal use the live version until someone publishes the draft as the next version.

Each change records who made it and if it came through an AI client. To review, undo, or roll back, read
[Publish context changes](https://bonnard.ai/docs/context/review-and-publish.md).

## Who can change context

The workspace role decides what each person can do.

Table: Who can do each action

| Action                         | In the console   | In an AI client                           |
| ------------------------------ | ---------------- | ----------------------------------------- |
| Change the draft               | Editor or higher | Editor or higher                          |
| Publish the draft              | Editor or higher | Editor or higher, after an admin lets AI clients publish |
| Discard the draft or roll back | Editor or higher | No                                        |

To let AI clients publish the draft, an admin sets **Allow AI clients to publish context changes** to on in **Settings**,
**AI tools**. It is off by default and covers all data sources in the workspace.

A Viewer can read the context of the data sources they can use, including the open draft. Customers read the live context in the customer portal
and cannot change it.

On a data source with tenancy, the agent can change context. It cannot do a check against the data until you select a
customer in [Preview as](https://bonnard.ai/docs/access/preview-as.md).

## Related

- [Hide tables from AI clients](https://bonnard.ai/docs/context/hide-tables.md): keep staging copies and backups out of what agents find.
- [Describe your data](https://bonnard.ai/docs/context/descriptions-and-keys.md): write what agents cannot work out from column names.
- [Connect tables with joins](https://bonnard.ai/docs/context/joins.md): add the joins your database does not declare.
- [Define metrics](https://bonnard.ai/docs/context/metrics.md): give each number one calculation.
- [Publish context changes](https://bonnard.ai/docs/context/review-and-publish.md): take a draft live.
