AgentPG

AgentPG

Open Source Tool for Building AI Agents in Go and Postgres

1 follower

Open-source toolkit for building AI agents in Go with PostgreSQL persistence. AI agents lose memory when containers restart. Context gone. Conversations reset. AgentPG stores everything in PostgreSQL - conversations, tool calls, session state. Debug with SQL instead of logs. Features: Single binary deploys, transaction-safe ops, streaming, JSON Schema validation, multi-tenant isolation, context compaction. Works with Claude via Anthropic SDK.
AgentPG gallery image
Free
Launch Team
Intercom
Intercom
Startups get 90% off Intercom + 1 year of Fin AI Agent free
Promoted

What do you think? …

Youssef Siam
Maker
📌

Hey Product Hunt! 👋

I'm Youssef, and I built AgentPG after finding myself re-implementing the same Go agent + Postgres backend in every project. Figured it was time to do it right once and open source it.

The core idea: Use PostgreSQL as your AI agent's brain. Every interaction is persisted, you get full SQL access to history, and debugging becomes `SELECT *` instead of grep.

What makes AgentPG different:

  • 🔄 Streaming-first architecture — All operations use streaming internally, so no timeouts on long conversations

  • 🧠 Smart context management — Auto-compaction at 85% context usage, using patterns from Claude Code and Aider. It prunes tool outputs first, then summarizes—keeping your last 40K tokens protected

  • 🔧 Clean tool system — Interface-based tools with required parameter specs. Register once, use everywhere

  • 🤖 Nested agents — Agents can use other agents as tools. Build an orchestrator that delegates to specialists with one line:

weatherAgent.AsToolFor(orchestratorAgent)
  • 📊 Full observability — Hooks for before/after messages, tool calls, and compaction events

  • 🔒 Production-ready — Transaction support, multi-tenancy, retries, timeouts, audit trails, and reversibility baked in

  • 💪 Extended context — 1M token support with automatic retry and beta headers

Why Go? It's my backend language, and I've noticed more developers choosing Go for AI agents—single binaries and great concurrency make it a solid fit for long-running stateful agents.

Planning to add a UI for exploring sessions in the future.

Would love your feedback—what would make this more useful for your stack?

GitHub: https://github.com/youssefsiam38/agentpg