Skip to content

Agent database

The agent database gives your agent its own structured data — tables of records it can read and write as it works — without you designing a database or writing any SQL. It's for the things a knowledge base can't do: remembering, capturing, and updating individual records over time.

Use it when your agent needs to keep track of things, for example:

  • Lead capture / CRM — record who reached out, their contact details, and status.
  • Orders and bookings — take an order or reservation and store it.
  • Surveys and quizzes — collect answers and scores.
  • User progress — remember where each user left off.
  • A structured catalog or FAQ — look up items by field rather than by search.
  • An event log — append a record every time something happens.

How you set it up

You never write table definitions or pick column types. You describe, in plain language, what the agent should keep track of ("remember each customer's name, email, and whether they've been contacted"), and the Builder designs the tables for you and switches on the Database capability. The first time it does this, it confirms with you.

Because it's just another capability, the Database tool sits alongside memory, sub-agents, and the rest in the agent's tools, and can be turned on or off there.

The Data tab

Once the database is on, the agent gets a Data tab where you can see and manage the records it has stored — a spreadsheet-like view of your tables:

  • Browse records with filtering and sorting.
  • Export a table to CSV.
  • See how much storage the agent's data is using.

Viewing is always available. Directly editing or deleting individual rows from this view is gated behind a debug mode, because in normal operation the agent — not a human clicking around — is what changes the data. Deleting a record from this view removes it, and every edit and deletion is logged.

Whose records you see

In tables set to own records only, the Data tab shows your own records and records that have no owner. If the agent belongs to an organization where you are an Owner or Admin, it also shows the records of that organization's members. Other people's records stay private to them: the Data tab does not show, export, edit or delete them, and a line under the table header says how many are hidden.

Tables you made readable by the author, and tables that are not scoped to own records, show every record. People you gave Can edit see the tables, their columns and record counts, but not the records. The Analyst reads a table the same way when you give it one as a source.

Changing the tables of an agent that already has data

When the Builder changes the shape of an existing database — a new table, a new column — that change is applied to the agent's live data, so it either lands completely or it does not land at all:

  • While the change is being applied, the agent is paused. Runs in flight finish first; new ones wait.
  • If any part of the change fails, the update is reported as failed and the agent stays paused. The version you were running stays the current one. Your records are not touched, and your existing data and conversation history stay readable.
  • Retrying is safe. Every table change the platform makes is recorded in the agent's own database at the moment it is made, so a retry can tell what already went through: it finishes the parts that did not complete, and never applies the same change twice. This holds whether the change was interrupted before, during or after it landed.

One kind of schema change cannot be undone automatically: building an index without locking the table has to run outside the platform's safety net. If that is interrupted mid-way, the agent stays paused and the update asks for a human to check the result rather than guessing — the platform never retries it blindly.

Self-hosted deployments

Some self-hosted installations run the agent database in a single-tenant mode where the platform cannot prove that a schema change ran exactly once. There, applying a package that adds new database changes to an agent that already exists is refused up front, with an explanation. Creating a new agent from that same package works normally, and so does updating an agent with a package that changes no tables. Donkit's hosted platform is unaffected.

Timestamps on every record

Every record automatically keeps track of two moments, so you and your agent always know when things happened without anyone having to set them:

  • When it was added — the moment the record was first stored. This never changes.
  • When it was last changed — kept up to date automatically every time the record is edited, so it always reflects the most recent change.

You don't manage these — the platform keeps them accurate on its own, and you can see them in the Data tab.

If your data carries its own meaningful date — an article's publication date, say, or the date an event takes place — that lives in a separate field of its own, apart from when the agent stored the record. This keeps two different questions from getting mixed up: "what did we add today?" versus "what was published today?".

Who can see which records

The agent database enforces access automatically, so a published agent's end users only touch data they're allowed to:

  • End users of a published agent get per-user isolation — each person sees and edits only their own records. This is what makes "remember my progress" or "show my orders" safe when many people use the same agent.
  • The owner, and the Owners and Admins of the owner's organization, are the author side — when the agent runs for them it sees every record of tables shared with everyone or closed to end users, but in tables scoped to own records only their own records, unless the table is readable by the author.
  • Someone you gave Can edit builds the agent with you, but when the agent runs for them it treats them like any other person: they see their own records in tables scoped that way, not the records of the people who use the agent. A table change they ask the Builder for still runs with the database owner's rights on the tables' structure and on tables not scoped to own records, but it cannot read or change other people's records in tables scoped to own records. Give Can edit to people you trust with the rest of the data.
  • The Builder works with the database as the person building, the owner included: when it checks or loads records it sees only what that person may see as a user of the agent. To load a catalog or FAQ that users only read, it adds the rows as part of a table change rather than as a user.

For each table you can set an access policy — whether end users can read and/or write it, and whether that applies to their own records only or more broadly. This lets you build, say, a catalog everyone can read but only the agent can update, alongside a per-user orders table.

Only the owner changes a table's access in the Data tab. Someone you gave Can edit can have the Builder open a table to everyone signed in only while it is still empty; once it holds records, opening it is the owner's decision, because it would show every person's rows to every user. And once a table scoped to own records holds other people's records, no one — the owner included — can loosen it.

Row-level isolation itself belongs to the platform. A table change the Builder writes cannot create, alter or remove the rules that keep each person's records apart, switch them off, or run SQL assembled on the fly; the Builder refuses such a change and sets access through the table's policy instead.

A table that lets everyone signed in write is one shared space: any of them can change any row in it, and the rows do not say who wrote them. You, as the author, see every record in it, and people who use the agent are told so before they start. Records people add there stay in the agent when they leave it. Keep personal data in tables scoped to own records.

A run reaches the database as the person it belongs to — in chat, by voice, through an API key, and in every step of a workflow. A workflow a visitor started therefore sees that visitor's records, not the owner's. The code of the agent's own backend does not choose its access either: each request it serves carries the signed-in person who made it, the database enforces that person's access, and code that tries to act as someone else is refused. A request to the backend that carries no signed-in person gets no access to the database at all.

A new table starts closed to end users. The one exception is a table with an owner column, which starts as "own records only", so each person sees just their own rows. Every other table stays private until the Builder or you open it on purpose, for example making a catalog readable by everyone signed in. That way nobody sees another person's data by accident.

Tables readable by the author

Some agents exist to collect records the author needs to read — a CRM, a patient log, form submissions. For a table scoped to own records you can let the author side — you and the Owners and Admins of your organization — read every person's records: turn on The author can read everyone's records — shown to visitors before they start in the table's access settings on the Data tab, or ask the Builder. Everyone who uses the agent is told before they start (see What visitors agree to). Each person still changes only their own records, and people with Can edit never see other people's records there.

Decide while the table is empty. Once a table scoped to own records holds other people's records, nobody — you included — can make it readable by the author, switch it to another mode or change its owner column. For data you want to read, create a new table.

Tables that already worked this way before this setting existed were made readable by the author automatically, and the people who use those agents are asked once.

Self-hosted deployments

On some self-hosted installations the agent database runs in a single-tenant mode where the database does not keep records apart. There, what visitors agree to says the author can read every table.

Shared team database

A team of agents can share one database besides each agent's own. Its tables are created by the lead agent's Builder, and every member agent reads and writes them.

The same per-table access policy applies — read / write set to none, owner, everyone signed in, or own records only — and the same per-user isolation for end users: a published member agent's end users see only their own records in "own records" tables. When a member agent runs for the owner, or for an Owner or Admin of the owner's organization, it sees every record of the shared tables except, in tables scoped to own records, other people's records — unless the table is readable by the author.

The lead's Data tab has a Team mode showing the shared tables, their rows, export, and the access policy editor. In shared tables set to own records only, the team owner sees their own records and records without an owner; the rest are counted, not shown. The Data button on the Teams page opens it straight away.

An app built for a member agent reads and writes shared tables the same way it reads its own — the Builder does this when you ask for it ("the form saves answers to the team's shared table").

Private admin side, public form side

Keep the team itself unpublished, and publish the collecting agent on its own. Respondents write their own records through the published agent. For the admin side to see all of them, make the shared table readable by the author while it is still empty — respondents are told before they start.

Note

Tables that existed before this feature keep working. On first use, each one receives the same default as a new table — own records when the table has an owner column, otherwise closed to end users — which the lead can change afterwards.

The old state store is gone

Agents that kept data in the older key-value state store, and pages that read it, no longer have it: the store and the tool that wrote to it were removed, and its entries were not carried over. Ask the Builder to move what the agent kept there into the database.

Turning it off

You can disable the database, which keeps all the data but removes the Database capability from the agent, or permanently delete the data, which requires a typed confirmation to prevent accidents. Only the owner can permanently delete the data; someone you gave Can edit can only disable the database.