| ▲ | Show HN: Pgclaw – A "Clawdbot" in every row with 400 lines of Postgres SQL(github.com) |
| 32 points by calebhwin 4 hours ago | 23 comments |
| Hi HN, 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 2 hours ago | parent | next [-] |
| What's the advantage in putting agents in the persistence layer rather than the application layer? This seems to me strictly less flexible, scalable, secure, easy to work with... I am having a hard time imagining why I would want to integrate with APIs or write an agentic harness in the database rather than in application code? Maybe I'm behind the times but I don't understand. |
| |
| ▲ | 4ndrewl an hour ago | parent [-] | | It's similar to when we wrote all our business logic in eg pl/sql, stored procedures etc. Seems attractive at first, but it breaks separation of concerns, becomes difficult to test etc. | | |
| ▲ | thatwasunusual 22 minutes ago | parent [-] | | > It's similar to when we wrote all our business logic in eg pl/sql [...] What do you mean with "when"? /s I dread companies who still have logic in their databases when it's not necessary. <insert sad face> |
|
|
|
| ▲ | rel_ic 22 minutes ago | parent | prev | next [-] |
| We need your help! Can you please use your creativity to build resilience to climate change in your community instead of experimenting with more ways to spend computing power? |
|
| ▲ | tibbar 2 hours ago | parent | prev | next [-] |
| This is mind-bending. I can't imagine that it performs well enough to be particularly fit for production just yet but..... wow. |
| |
| ▲ | swyx 2 hours ago | parent [-] | | how exactly is adding a stored procedure as an agent mind bending | | |
| ▲ | tibbar 39 minutes ago | parent [-] | | I can only speak for my own mind ;) but the most advanced thing I'd seen prior in this regard was Google Sheets' =AI function, which is pretty convenient (if awkward) when you want to map values to LLM output. 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 13 minutes ago | parent [-] | | ok nice reply. i think i was where you were in 2021 around doing stuff in sprocs. i think pple generally follow a cycle of going overexcited about throwing everything in the database and then going "actually the database is a pretty bad production compute environment" and re-separating concerns back to different levels. 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 an hour ago | parent | prev | next [-] |
| I don't understand why claw is a data type for columns in these examples, it doesn't seem to store any actual per-row state. Is it not possible to hook extensions onto "with" clauses or something similar? |
|
| ▲ | ef2k 26 minutes ago | parent | prev | next [-] |
| Nice. These are the kind of boundary pushing projects I like to see. It challenges assumptions of where application logic should live. The implications around cost, latency, and recovery are going to be interesting. |
|
| ▲ | wwweston 2 hours ago | parent | prev | next [-] |
| This... does not seem like separation of concerns. Not to mention that the data layer seems like the one where you want to keep things most deterministic. |
| |
| ▲ | nkmnz a minute ago | parent | next [-] | | If you really want to run an agent on each created row, you could run this in a replica and stream the replies back to your system of record. | |
| ▲ | noupdates 2 hours ago | parent | prev [-] | | To decouple this the person would have to broadcast nearly every event and rebuild the observer layers elsewhere. | | |
| ▲ | thatwasunusual 17 minutes ago | parent [-] | | And IMO that's what should be done. 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. |
|
|
|
| ▲ | xnx 2 hours ago | parent | prev | next [-] |
| It feels like we're a week away from the Claw hype supplanting AI hype. Companies will start renaming things ClawX to get on the hype bandwagon. |
| |
| ▲ | maxbond 2 hours ago | parent | next [-] | | I think "claw" isn't appealing enough to be genericized and that "agent" will continue to be the generic term, but we'll see. | |
| ▲ | calebhwin 2 hours ago | parent | prev [-] | | It's just an abstraction people are excited about at the moment. Langchain was an exciting abstraction at one point. My bet is we converge on a super minimal model<>computer architecture. |
|
|
| ▲ | readme 2 hours ago | parent | prev | next [-] |
| i love postgres and pgvector... this is exactly to my tastes |
| |
| ▲ | calebhwin 2 hours ago | parent | next [-] | | Same, it's in a similar vein as pgvector - probably not as performant as turbopuffer or chroma but you get the benefits of being in a really nice ecosystem. | | |
| ▲ | tibbar 2 hours ago | parent [-] | | Is it? pgvector is primarily about indexing, I think? This feels more similar =AI in Google Sheets. | | |
| ▲ | calebhwin 2 hours ago | parent [-] | | True though pgvector is not deterministic in a strict sense since HNSW is probabilistic. |
|
| |
| ▲ | cpursley an hour ago | parent | prev [-] | | Yes, and I imagine pgclaw would pair well with pgmq and pg_cron for scheduled work. Postgres really is enough: https://postgresisenough.dev |
|
|
| ▲ | danr4 2 hours ago | parent | prev [-] |
| this is fucking awesome |