Xata Agent is an open source agent that monitors your database, finds root causes of issues, and suggests fixes and improvements. It’s like having a new SRE hire in your team, one with extensive experience in Postgres.
Letting the agent introduce itself:
Hire me as your AI PostgreSQL expert. I can:
- watch logs & metrics for potential issues.
- proactively suggest configuration tuning for your database instance.
- troubleshoot performance issues and make indexing suggestions.
- troubleshoot common issues like high CPU, high memory usage, high connection count, etc.
- and help you vacuum (your Postgres DB, not your room).
More about me:
- I am open source and extensible.
- I can monitor logs & metrics from RDS & Aurora via Cloudwatch.
- I use preset SQL commands. I will never run destructive (even potentially destructive) commands against your database.
- I use a set of tools and playbooks to guide me and avoid hallucinations.
- I can run troubleshooting statements, like looking into pg_stat_statements, pg_locks, etc. to discover the source of a problem.
- I can notify you via Slack if something is wrong.
- I support multiple models from OpenAI, Anthropic, and Deepseek.
Past experience:
- I have been helping the Xata team monitor and operate tons of active Postgres databases.
Here is an under 4 minutes walkthrough of the agent in action:
Xata.Agent.demo.mp4
A youtube version of the demo is available here.
We provide docker images for the agent itself. The only other dependency is a Postgres database in which the agent will store its configuration, state, and history.
We provide a docker-compose file to start the agent and the Postgres database.
Edit the .env.production
file in the root of the project. You need to set the PUBLIC_URL
and the API key for at least OpenAI.
Start a local instance via docker compose:
Open the app at http://localhost:8080
(or the public URL you set in the .env.production
file) and follow the onboarding steps.
We have a more detailed guide on how to deploy via docker-compose on an EC2 instance.
For authentication, you can use your own OAuth provider.
Go to the apps/dbagent
directory and follow the instructions in the README.
The agent can be extended via the following mechanisms:
- Tools: These are functions that the agent can call to get information about the database. They are written in TypeScript, see this file for their description.
- Playbooks: These are sequences of steps that the agent can follow to troubleshoot an issue. They are simply written in english. The pre-defined playbooks are here.
- Integrations: For example, the AWS and Slack integrations. They contain configurati
7 Comments
lelandfe
> I support multiple models from OpenAI, Anthropic, and Deepseek.
Are there risks associated with sending DB info off to these third parties?
jasonthorsness
During incidents I've often found that the issue has been obvious or brewing for some time – the idea of having an LLM-driven "smart" monitoring system for key services that can recognize problems and often take action could hopefully make this less of a thing. I'll be looking at how this works to try something similar for my own company's services.
I think a key for this one is "I use preset SQL commands. I will never run destructive (even potentially destructive) commands against your database." If it's also locked down to only informational queries (and not leaking user tables to the LLM providers) I think why not try this?
I do wonder about cost of this at scale; compared to the cost of the services being monitored. Hopefully an Agent tax doesn't become another Datadog tax.
arjunlol
Looks cool! This may actually save a lot of manual dba work for myself
femiagbabiaka
Interesting, might try it out at home.
Documentation asserts:
> I use preset SQL commands. I will never run destructive (even potentially destructive) commands against your database.
This is enforced by taking the responsibility for generating SQL in order to evaluate state out of the hands of the LLM. The LLM simply interprets results of predetermined commands based on a set of prompts/playbooks: https://github.com/xataio/agent/blob/69329cede85d4bc920558c0…
iLoveOncall
The title should really include the fact that it's an expert at MONITORING PostgreSQL. It's not for writing queries from natural language.
I'm extremely interested in the latter but not at all in the first.
simonw
The prompts that do most of the work are in this file: https://github.com/xataio/agent/blob/main/apps/dbagent/src/l… – strings stored in these variables:
Looks like they are orchestrated by these system prompts: https://github.com/xataio/agent/blob/69329cede85d4bc920558c0…
arcticfox
This is very cool! What is preventing the other cloud providers from being supported I wonder? is the integration not just a connection string?