Back to blog

I gave my AI Agent direct database access

Spencer Pauly
Spencer Pauly
2 min read
I gave my AI Agent direct database access

I've been connecting my coding agents to everything: Datadog logs, Linear, Slack. It still feels like I hit the same wall every time I actually need to debug something serious.

The model can read the stack trace and the ticket thread. The part where I prove what happened in the data, row by row, is still on me. I open the database viewer, find the connection, find the table, rebuild the join in my head, export a slice, paste it back into chat. It's not hard. It's a time sink, and it breaks the flow of everything else I wired up.

So I'm on the thread with my coding AI Agent, I explain the bug, then I tab away and click through schemas anyway. After a while that mismatch started to really annoy me.


At some point I hacked together a repo on my laptop. It generated SQL and talked to the database for me, and it worked better than I expected.

It also made me nervous. Credentials sitting around, no real story for who could run what, no audit trail I could point at if something went sideways. I kept using it for a week and felt worse about it each day.


I wanted the same speed without the part where I pretend that's fine.

So I ended up with something that looks like a wrapper: read-only paths, permissions that actually mean something. The schema gets pulled in and cached so I'm not dumping DDL into a new chat every time I start over. There are timeouts and rate limits so a bad prompt can't turn into a runaway query.

Somewhere in there I shipped QueryBear. I wasn't chasing a market thesis. I was the person who needed the thing.


Now when I'm chasing a production issue, I can stay in one thread with my coding AI Agent. The model isn't guessing my tables from memory, and it's not holding raw keys to the kingdom either.

I'm not saying I solved security for everyone. I'm saying this is the first setup where the convenience didn't make me feel like I was about to regret it.

If you've wired up agents to everything but you still live in the database viewer, I'm curious what you did. I'm still figuring out where the line should be.

QueryBear

Want to try what I'm building?

Ask your database in plain English with permissions and auditing built in.

Learn more about QueryBear