Integration · Databases
AI agents for Cloudflare D1
Query and change a Cloudflare D1 (SQLite) database through the Cloudflare API: run SQL with bound parameters, list databases, tables and columns, and run several statements as one batch, with an API token.
- Actions
- 7
- Read
- 4
- Write
- 3
Actions
What your agents can do in Cloudflare D1
7 actions. Each one is a tool your agents can call and a step your workflows can run.
Read 4
Look things up. Nothing changes.
Run a SQL query
Runs one read-only SQLite statement (SELECT or EXPLAIN; one statement, no semicolons inside) on the connected database and returns its rows.
List tables
Lists the database's tables and views with the statement that created each one (which shows its columns, keys and constraints), from sqlite_master, leaving out SQLite's and D1's own tables.
Describe a table
Lists a table's columns: each column's position, name, declared type, whether it is NOT NULL, its default and its place in the primary key (0 when not part of it), from pragma_table_info.
List databases
Lists the account's D1 databases, as result: each with its uuid (the database ID), name, created_at, version and jurisdiction; result_info has the page and the total count.
Write 3
Create, change or send.
Insert, update or create
Runs one statement that adds or changes data: INSERT (including INSERT OR REPLACE and ON CONFLICT upserts), UPDATE, REPLACE, or CREATE (a table, index, view or trigger).
Run several statements as a batch
Runs up to 20 statements in order in one call, each with its own ?
Run any SQL statementDeletes data
Runs any one SQLite statement D1 allows, including DELETE, DROP and ALTER: this is the action that can remove data, and it cannot be undone.
A person can approve first
Any write action can be set to wait for a person's approval before it runs, so an agent asks before it changes anything. Actions that delete data ask first by default.
Connection
How it connects
Connect it once in the console, then give it to the agents and workflows that need it.
Paste an API key from your Cloudflare D1 account.
What you enter
- API token
Settings
- Account ID
- Database ID
Kept safe
- Credentials are stored encrypted with your organization's own keys.
- They are opened only by the process that makes the call, at the moment it runs, and never go into a prompt or the browser.
- Calls go only to the tool's own servers.
Ideas
Ideas to start with
Starting points made only from the actions above. Mix them with any other tool your agents can use.
- 01
Ask about your Cloudflare D1 data
Ask a question in plain words. The agent can run a SQL query, list tables or describe a table in Cloudflare D1, then answers with what it found.
- 02
Let an agent update Cloudflare D1
Have the agent insert, update or create or run several statements as a batch in Cloudflare D1 as part of a larger task. Turn on approval and a person signs off on each change first.
- 03
Share what it finds in Slack
Give one agent Cloudflare D1 and Slack: it can run a SQL query in Cloudflare D1 and post a summary to a Slack channel in the same run.
FAQ
Cloudflare D1 and MyDeepAgents
Can MyDeepAgents connect to Cloudflare D1?
Yes. The Cloudflare D1 connector has 7 actions: 4 read and 3 make changes. Your agents can call them as tools, and your workflows can run them as steps.
How do I connect Cloudflare D1?
Paste an API key from your Cloudflare D1 account. You'll need: API token. The connection also asks for: Account ID and Database ID. Credentials are stored encrypted with your organization's own keys and are opened only at the moment of a call.
Can an agent change data in Cloudflare D1 without asking?
Only if you let it. Each of the 3 actions that change data can be set to wait for a person's approval before it runs, and the one that deletes data asks first by default.
Can I use Cloudflare D1 in workflows as well as agents?
Yes. Every Cloudflare D1 action also works as a step in a workflow, and the same connection serves your agents and your workflows.
Early access
Put Cloudflare D1 to work
Connect it in a few minutes, give an agent the actions it needs, and decide which changes wait for a person.