Back to browse
GitHub Repository

pgCortex brings enterprise-ready AI to PostgreSQL. Define agents in SQL, bind them to tables, and let intelligence flow through your data automatically. Zero transaction blocking, full observability.

1 starsPython

PgCortex – AI enrichment per Postgres row, zero transaction blocking

by supreeth_ravi·Feb 17, 2026·1 point·0 comments

AI Analysis

●●●BangerBig BrainSolve My Problem

Outbox + external worker architecture solves a real production pain: LLM calls in Postgres triggers without blocking transactions.

Strengths
  • Genuinely clever architecture: lightweight triggers enqueue to outbox table, Python worker processes asynchronously with schema validation and CAS—keeps ACID intact.
  • Horizontal scalability via Kafka CDC for high-volume data enrichment; observability baked in (audit trails, cost tracking, metrics).
  • SQL-native binding (one SELECT statement activates agents per table) with support for any OpenAI-compatible LLM provider.
Weaknesses
  • Early-stage on GitHub (0 stars, minimal releases)—no production case studies or performance benchmarks vs. message-queue alternatives.
  • Requires operational overhead: Python worker, outbox polling, external state management—higher complexity than direct LLM calls for small teams.
Target Audience

Backend engineers, database architects building AI enrichment pipelines (support ticket classification, fraud detection, content moderation)

Similar To

Debezium · Temporal · Apache Camel

Post Description

Hi HN,

Been working on a way to get "agent-per-row" behavior in Postgres without actually running LLMs inside the database.

The problem: Calling LLMs from triggers/functions blocks transactions, exhausts connections, and breaks ACID. Saw some projects doing this and it felt dangerous for production.

The solution: DB-adjacent architecture. Lightweight triggers enqueue jobs to an outbox table. An external Python worker (agentd) polls, executes AI calls, and writes back safely with schema validation and CAS.

What you can build:

Auto-classify support tickets on INSERT

Content moderation that doesn't block your app

Lead scoring, fraud detection, and invoice extraction

Anything where data arrives and needs AI enrichment

Works with OpenAI, Anthropic, OpenRouter, or any Agent.

One SQL line to add AI to any table:

SELECT agent_runtime.agent_watch('tickets', 'id', 'classifier', 'v1', '{"priority":"$.priority"}');

Includes 9 example use cases in the repo. Would love feedback on the architecture.

Similar Projects

Open‑Source Capital Formation OS (Postgres and AI Agents)

Spreadsheet-driven fundraising as infrastructure problem, but still pre-code—specs without execution.

Big BrainBold Bet
tgiordano
103mo ago