How to Connect Neon to an AI Agent and Query Postgres

· DoubleX

Quick answer

To connect Neon Postgres to an AI agent, add the Neon connector, choose whether the connection is personal, team or company-wide, and limit the agent's actions. In DoubleX Agentes, you can start read-only, run a first query, and check the task history before allowing any changes.

Neon is a serverless Postgres service, and many teams keep product, billing or operations data in it. Connecting it to an AI agent lets people ask questions in plain language instead of waiting for someone to write SQL. The safe way to do it is to start with read access, confirm the agent behaves as expected, and only then consider anything that changes data.

What can the Neon connector let an agent do?#

The Neon connector lets an agent manage Neon projects and Postgres branches and run SQL. A connector is a system linked to the platform, and the agent uses that system's tools on your behalf.

In practice, that covers requests like these:

TaskHow the agent helpsNeon capability used
Answer a data questionWrites and runs a SQL query, then explains the resultRun SQL
Inspect a projectLists projects and their setupManage projects
Work on a safe copyCreates or reviews a branch before a risky changeManage Postgres branches
Prepare a reportRuns queries and delivers a spreadsheet or documentRun SQL, plus an artifact

For deeper routines such as scheduled checks and branch workflows, see Neon with an AI Agent: SQL, Branches and Dev Team Routines.

What do I need ready before connecting?#

You need a DoubleX Agentes account, access to the Neon project you want to use, and a clear idea of which questions the agent should answer. Having these ready takes a few minutes and avoids connecting more than necessary.

  • A DoubleX Agentes account. Creating one is free and requires no card.
  • A Neon account with permission to the project you plan to query.
  • A list of the tables and questions the agent will handle first.
  • A decision on who should use the connection: only you, a team, or the whole company.
  • An agent to use. You can create one, or run the diagnostic to get a team of agents with your company's instructions already in place.

If you are new to the platform, the Quickstart shows the account, diagnostic and first agent flow.

How do I connect Neon in DoubleX Agentes, step by step?#

You connect Neon from the Connectors screen, authorize access, and then attach it to an agent. Follow these steps:

  1. Open DoubleX Agentes and go to Connectors.
  2. Find Neon in the list and start the connection.
  3. Authorize access with your Neon account when prompted.
  4. Choose the scope of the connection: personal, team or company.
  5. Go to Agents, open the agent that will work with the data (or create a new one), and add the Neon connector.
  6. Set which Neon actions the agent may run. Keep only reading actions enabled for now.
  7. Ask for a simple task, then review the result in Tasks.

Credentials and tokens for connections are stored encrypted with AES-256-GCM, and each company has its own separate database.

To see how connectors are handled through the API, check the Connectors reference.

Personal, team or company connection: which should I choose?#

Choose personal if the access should only work for you, team if one group needs it, and company if several areas rely on the same data. A personal connection is valid only for the person who created it, like your own email account. Team and company connections can be used more widely.

ScopeWho it is forGood fit for
PersonalOnly youTesting, exploring your own project
TeamA specific teamAn engineering or data team sharing one database
CompanyEveryone in the companyShared reporting that several areas need

A few practical rules:

  • Start personal while you are testing, then widen the scope once you trust the setup.
  • Remember that routines run with the permissions of whoever created them.
  • Roles (owner, admin, member) and sharing by person, team or company control who can use the agent.

How do I limit the agent's actions and keep it read-only?#

For each agent, you choose which systems it uses and, inside each system, which actions it can run. Actions that change data can stay turned off, which leaves the agent with read-only access.

A sensible rollout looks like this:

  1. Enable only actions that read data and run queries.
  2. Run real questions for a few days and review the history.
  3. Only if needed, enable one additional action at a time.
  4. Keep branch-based work separate from anything that touches your main data.

Before the agent sends, deletes or changes anything in your systems, it asks for confirmation and shows the steps it took. That confirmation is a second layer of protection, not a replacement for limiting actions.

For a similar setup with a database connected directly, see How to Connect PostgreSQL to an AI Agent, Step by Step.

How do I test with a first request and check the task history?#

Send a simple, read-only question, then open the task in Tasks to confirm what the agent actually did. Every request becomes a task with a full history: the request, each tool the agent used, and the result.

Examples you can copy:

  • "List the tables in our Neon project and describe what each one seems to store."
  • "How many new customers were created in the last 30 days? Show the SQL you used."
  • "Show the 10 most recent rows in the orders table and flag any with missing values."
  • "Run a query that counts active subscriptions by plan and put the result in a spreadsheet."

When the task finishes, check three things: whether the SQL matches your intent, whether the agent only used the actions you allowed, and whether the answer is consistent with what you know about the data. If a result looks wrong, ask the agent to explain the query before trusting it.

Frequently asked questions#

Can the agent change data in my Neon database?#

Only if you allow it. You choose which Neon actions each agent can run, and actions that change data can stay off. Even when enabled, the agent asks for confirmation before altering anything.

Do I need to write SQL myself?#

No. You describe what you need in your own words, and the agent writes and runs the query. Asking it to show the SQL it used makes it easy for someone technical to review.

Is my company data used to train AI models?#

No. Company content is not used to train models, and requests only go to AI providers that do not use what they receive for training. You can also choose a zero-retention option on the Models screen.

Can the agent run Neon queries on a schedule?#

Yes. You can set a routine to run at a set time, such as every Monday morning. The routine runs with the permissions of the person who created it. See Triggers for details.

Where can I see what the agent did?#

In the Tasks screen. Each task keeps the request, every tool used and the result, so you can see who asked, what was done and when.

Related guides

More Neon guides