[HN Gopher] Xata Agent: AI agent expert in PostgreSQL
___________________________________________________________________
Xata Agent: AI agent expert in PostgreSQL
Author : todsacerdoti
Score : 67 points
Date : 2025-03-13 18:32 UTC (4 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| lelandfe wrote:
| > _I support multiple models from OpenAI, Anthropic, and
| Deepseek._
|
| Are there risks associated with sending DB info off to these
| third parties?
| thinkingtoilet wrote:
| Of course!
| fforflo wrote:
| Of course, there are, but I guess this relies on the various
| System views (pg_*), like most monitoring tools, which have
| fine-grained control access if you create appropriate roles.
| cship2 wrote:
| You can also self host via ollama assuming you got proper GPU.
| Running it on CPU can take minutes.
| jasonthorsness wrote:
| 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.
| tudorg wrote:
| > 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.
|
| One idea that we want to experiment with is that we let the
| model pick the next time that it runs (between bounds). So if
| the model has any reason of concern it runs more often,
| otherwise maybe once every couple of hours is enough.
| arjunlol wrote:
| Looks cool! This may actually save a lot of manual dba work for
| myself
| femiagbabiaka wrote:
| 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 wrote:
| Until it hallucinates and doesn't run the command that you
| expect or doesn't run the command at all?
|
| This doesn't take anything out of the hands of the LLM.
| tudorg wrote:
| There are things that can go wrong, but not so wrong to
| delete your data or cause outages. So there is a level of
| safety that I think is important at this moment. We do want
| to also allow executing generated SQL, but with an approval
| workflow.
| femiagbabiaka wrote:
| A hallucination that doesn't use a predefined command, but
| instead hallucinates A. random SQL queries and B. destructive
| queries, seems unlikely. But as a best practice the user that
| the agent connects to the database with should be locked
| down, of course.
| iLoveOncall wrote:
| 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 wrote:
| 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:
| SLOW_QUERIES_PLAYBOOK GENERAL_MONITORING_PLAYBOOK
| TUNING_PLAYBOOK INVESTIGATE_HIGH_CPU_USAGE_PLAYBOOK
| INVESTIGATE_HIGH_CONNECTION_COUNT_PLAYBOOK
| INVESTIGATE_LOW_MEMORY_PLAYBOOK
|
| Looks like they are orchestrated by these system prompts:
| https://github.com/xataio/agent/blob/69329cede85d4bc920558c0...
___________________________________________________________________
(page generated 2025-03-13 23:01 UTC)