Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Neon 12 min read How-to mediumAdept

Building a Deep Research Agent with Neon and Durable Endpoints

A recursive deep research agent built on Neon Postgres with pgvector, Inngest durable endpoints, Claude, Exa search and OpenAI embeddings. Planning, search, reflection and report generation from the DeepResearcher and Step-DeepResearch papers map onto concrete LLM functions, with depth-limited recursion that halves breadth at each level. Every external call runs as a retriable, memoized Inngest step with deterministic IDs. Idempotent Postgres writes (ON CONFLICT DO NOTHING, UNIQUE constraints) make replays safe. One database holds sessions, cursor-polled progress events and embeddings, so past learnings can be recalled via cosine distance to inform new searches.

Related posts

  • Lakebase Search: the retrieval primitive for agents on Neon

    Neon mediumAdept

    Lakebase Search adds vector and BM25 search to Lakebase Postgres through two extensions, lakebase_vector and lakebase_text, so agents can query operational data without a separate search system. lakebase_vector keeps its durable index in object storage, caches hot pages in NVMe and RAM, and combines hierarchical IVF with RaBitQ quantization. That design lets compute scale to zero and reconnect without rebuilding the index, and it stays compatible with pgvector types, operators and query syntax. lakebase_text adds a BM25 index over standard tsvector with top-K pushdown, and TypeScript Neon Functions, Object Storage triggers and AI Gateway embeddings round out an ingest-to-hybrid-search pipeline that agents can call in a search-evaluate-retry loop.

  • Neon Docs search is now built on Neon

    Neon mediumAdept

    Neon's docs search now runs entirely on its own stack: Lakebase Postgres with the lakebase_vector (pgvector-compatible ANN) and lakebase_text (BM25) extensions, a Hono API on Neon Functions, and Neon AI Gateway for embeddings and reranking. Pages are ingested as markdown via a GitHub Action, chunked by heading, embedded and stored with tsvectors in one table. To fit search-as-you-type latency budgets, full hybrid results (ANN plus BM25 merged with reciprocal rank fusion, then an LLM rerank) are precomputed for common queries and cached, while unseen queries fall back to BM25 only. Cache hits take 1.9 ms and BM25 misses 8.6 ms at p50 on the server, and top-5 hit rate rose from 80% to 94% on 171 real queries.

  • Neon for Agent Platforms: A Companion Skill for the AI Agent Program

    Neon mediumAdept

    neon-for-agent-platforms is an open-source companion Agent Skill and set of TypeScript scripts for running fleets of Neon Postgres databases on agent platforms. It covers a dual-org model that separates sponsored free-tier and paid customers, with one project per tenant transferred to the paid org on upgrade. It also covers copy-on-write dev and preview branches with shorter suspend timeouts to keep costs predictable, branch-based compound checkpoints, and the consumption API for per-customer cost attribution. Both skills install via npx, and the scripts can also be run directly against a Neon API key and org ID.

  • Building an AI-powered ChatBot using Vercel, OpenAI, and Postgres

    Neon mediumAdept

    A ChatGPT-style documentation assistant (Ask Neon) is built by storing OpenAI text-embedding-ada-002 vectors in Postgres with pgvector, retrieving context by cosine distance, and feeding it to text-davinci-003 from a Vercel Edge Function. A window-function query caps retrieved context at a cumulative 1,500 tokens to fit the 4,096-token model limit, and an ivfflat index (lists ≈ 4·sqrt(rows)) speeds up the similarity search. Neon's WebSocket-based serverless driver works around Edge Functions' lack of TCP, and streaming completions via SSE parsing return answers faster. User feedback is stored for later fine-tuning.

  • Custom Hacker News summaries in your inbox—build an AI Agent with Inngest and Render

    Render mediumAdept

    A tutorial for building an AI agent that periodically searches Hacker News for user-defined topics and questions and emails summaries. The stack has three parts on Render: PostgreSQL with pgvector, using an HNSW index over OpenAI ada-002 embeddings; a Playwright-based indexer cron job that scrapes Algolia HN Search; and a Next.js app hosting the UI and the workflow. Inngest orchestrates the workflow steps with retries. Its AgentKit library defines a tool-using Search Agent (search and identify-trends, using a cosine distance threshold under 0.3 and per-day aggregation) and a Summarizer Agent, linked by shared network state and custom routing.

The quest for software engineering knowledge.

Look:
Layout: