Daita Agents · Guide
Attach PostgreSQL, enable one table for updates, approve an exact preview and inspect the receipt.
Let an agent change rows in one PostgreSQL table, with you approving the exact statement and Daita recording what happened. Attaching a database never grants write access.
atlas with a model.Create it outside Daita. Do not use an owner, superuser or BYPASSRLS role.
CREATE ROLE daita_writer LOGIN
NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT NOREPLICATION NOBYPASSRLS;
GRANT CONNECT ON DATABASE application_db TO daita_writer;
GRANT USAGE ON SCHEMA support TO daita_writer;
GRANT SELECT ON TABLE support.tickets TO daita_writer;
GRANT UPDATE (priority) ON TABLE support.tickets TO daita_writer;The role needs SELECT because Daita previews and rechecks the rows.
export DAITA_PG_PASSWORD='...'
daita attach atlas postgresql \
--host db.example.com --database application_db --username daita_writer \
--password-env DAITA_PG_PASSWORD --schema support --source-name Support
daita sources atlasNote the source ID from daita sources. The source is read-only so far.
Preview the exact permission change, then apply it:
from daita import Agent
async with await Agent.open("atlas") as agent:
source = await agent.resolve_source("Support")
preview = await agent.preview_source_permissions(
source_id=source.id,
read_mode="all",
read_resource_ids=(),
relational_write_scopes={"support.tickets": {
"allowed_operations": ("update",),
"allowed_update_columns": ("priority",),
"max_rows": 25,
}},
)
# Review the before/after state in `preview`, then apply it.
await agent.apply_source_permissions(
source_id=source.id,
confirmation_fingerprint=preview.confirmation_fingerprint,
)In the app, use /source permissions and Edit table write access instead. Applying changes permissions only; no write runs. Check the table against the live database:
daita relational-write-readiness atlas <source-id> support.ticketsdaita chat atlasSet priority to 'high' for open tickets in Support that have been waiting more than 7 days.The agent reads first, then proposes one UPDATE with data_write.
Daita shows an approval card before anything is written:
WHERE;Choose Approve once or deny. Denying writes nothing. Approval applies to that exact statement and cannot be reused. If the rows changed since the preview, Daita refuses with write_state_changed and nothing is written. Scheduled routines and jobs ask the same way.
daita effects list atlas
daita effects inspect atlas <receipt-id>The receipt records the run and call, the expected row count and the outcome. succeeded means PostgreSQL acknowledged the commit and the touched rows matched the card. If an outcome is uncertain, do not retry. Compare the rows yourself, then record a decision with daita effects resolve.
In /source permissions, choose the table and select no operation. This does not revoke the PostgreSQL grant, so also revoke or rotate the role when needed.