Hacker News
Show HN: Pgclaw – A "Clawdbot" in every row with 400 lines of Postgres SQL
Been hacking on a simple way to run agents entirely inside of a Postgres database, "an agent per row".
Things you could build with this: * Your own agent orchestrator * A personal assistant with time travel * (more things I can't think of yet)
Not quite there yet but thought I'd share it in its current state.
maxbond
|next
[-]
Maybe I'm behind the times but I don't understand.
tibbar
|next
|previous
[-]
swyx
|root
|parent
[-]
tibbar
|root
|parent
[-]
What I specifically found "mind-bending" about this is that I don't have a clear concept of the limits of what an agent can do. In the limit case, it's basically like an independent employee, right?. So the concept of having a dedicated person sitting on each row of my database and transactionally performing any task I can describe is ... well, it IS a bit boggling to me.
Another way to look at it is: this is an extremely powerful construct for managing fleets of agents. I trust Postgres to execute all the stored procedures I ask it to. So with this tool I can easily spin up arbitrarily many agents. And state management is very simple, because they can directly edit their associated row!
IDK, the more I think about it the more fascinated I am. I'm sure there is some open source SAAS or something that has similar semantics and can do all this more efficiently, but now I know that this is a category of thing one could potentially build/use. Pretty nifty!
swyx
|root
|parent
|next
[-]
use sprocs lightly for simple fast stateless things. every other attempt at stuffing a lot of compute into the database that i'm aware of has basically failed to gain adoption (the personal awesomeness/happiness of the guy who created it aside)
debugnik
|next
|previous
[-]
wwweston
|next
|previous
[-]
Not to mention that the data layer seems like the one where you want to keep things most deterministic.
nkmnz
|root
|parent
|next
[-]
noupdates
|root
|parent
|previous
[-]
nkmnz
|root
|parent
|next
[-]
thatwasunusual
|root
|parent
|previous
[-]
Don't get me wrong, I like the idea and all that, but this is another pgsql "solution" that is tied to the database layer, when it should be in the application layer.
I like to be database agnostic, and while I prefer PostgreSQL on production, I prefer SQLite on the dev layer. You should never have to HAVE TO use a specific database to make your APPLICATION work.