What it does
manage_data_store lets an agent shape the schema of a data store
(a structured knowledge base): create tables, add or alter columns, add indexes,
create views, and inspect the current schema. Changes apply to the store’s own
isolated Postgres database.
create_storecreates a brand-new data store (name+ optionaldescription) — noknowledge_base_idneeded. Use it when work deserves its own store rather than adding unrelated tables to an existing one. Creation only: delete a store in Control Hub. To rename it or change its description, usemanage_knowledge_basesupdate.
For an overview of structured data stores — what they are and when to use one —
see Data Stores.
Parameters
Key behaviors
- A primary key is added for you.
create_tableadds anidprimary key automatically unless you define your own. - Views give apps aggregation power.
create_viewstores an agent-authoredSELECTthat apps read like a table — the way to let an app show a rollup or join over a large table without pulling every row. Views run with the reading role’s privileges, so they stay safely scoped to the store. - Rules hold for every writer. A rule added with
add_constraintor a unique index is enforced by the database itself, so it applies to agents, apps, and people editing rows alike, not just to the agent that set it up. - Rules check existing rows first. If rows already break a new rule, the
call fails and says how many and which. Fix those rows, or pass
not_valid: trueto enforce the rule on new and changed rows only. - Destructive changes are gated. Every
drop_*action requiresconfirm: true, because a published app may depend on what it removes. - Locked stores refuse structure changes. If the store’s creator has locked
it, every operation except
describefails unless the requesting user is its creator or an org admin. Rows stay writable throughwrite_data_store.manage_knowledge_baseslistshowslockedandcanEditfor locked stores. - Every change is audited, and the store’s cached schema — which the agent sees in its context — refreshes automatically after each change.
Common use cases
Create a table
Number records automatically (TAR-0001, TAR-0002, …)
pad is a minimum: after TAR-9999 comes TAR-10000.
Use auto_id: {} for plain numbers. To switch an existing column over, call
alter_column with auto_id; numbering continues after the highest ID
already in the column.
Require every row to point at a real record
on_delete: cascade or on_delete: set null to choose what happens
to deals when their company is deleted. By default, the delete is refused.
Limit a column to a set of values or a range
min and max for ranges, such as { type: check, columns: [ownership_pct], min: 0, max: 1 }.
Allow only one primary contact per company
Create a view for an app to chart
Related
- Query Data Store — read data with SQL
- Write Data Store — insert, update, delete, upsert
- Data Stores — the feature overview