Skip to content

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

Neon 7 min read How-to mediumAdept

Build Checkpoints For Your Agent Using Neon Snapshots

Neon's new snapshots API, built on copy-on-write branching, can implement checkpoints for agentic app builders so that rolling back an app version restores the matching Postgres schema and data along with the code. The demo pairs an app database with a meta database that maps each checkpoint to a snapshot ID. A snapshot is taken after every prompt, and rollback calls the restore API with finalize_restore and the current production branch ID, then polls operations until they reach a terminal state. Resolve the production branch ID by name before each restore rather than caching it, because it can change across restores.

Related posts

  • Promoting Postgres Changes Safely From Multiple Environments to Production

    Neon mediumAdept

    A snapshot-based workflow for promoting Postgres schema and data changes uses two isolated root branches, prod and dev, linked only through Neon snapshots. Features and previews live on short-lived child branches, and validated changes are applied back to dev with migrations. Promotion means snapshotting prod for rollback and then restoring a dev snapshot onto prod. Endpoints stay the same and connections drop only for milliseconds, but any prod writes made after the snapshot are lost, so production must be read-only or reconciled at the application level. Rollback and dev refresh use the same restore operation, and costs stay manageable through logical-size billing, snapshot retention policies and branch TTLs.

  • The Hidden Ops Layer of Agent Platforms

    Neon mediumAdept

    Anything's Max coding agent gets a dedicated Neon database branch for every session, created in about 200 ms. The agent runs its migrations there and merges back into development atomically through Neon's restore API. Failed migrations go to a separate LLM "Migration Fixer" for up to three retries before rollback, and merges fail if the development schema changed in the meantime. After crashed sessions left 2,847 orphaned branches, the team added a 6-hourly cleanup job plus 24-hour expires_at timestamps on branches. Connection pooling and 0.25–1 CU autoscaling handle bursty workloads of about 30 peak connections.

  • An API to Track Database Schema Changes

    Neon mediumAdept

    Neon's Schema Diff feature now has a `compare_schema` API endpoint, available on all plans, that takes two Neon branch IDs and returns a unified diff of their Postgres schemas. The goal is to let AI agents such as Replit Agent and CI/CD pipelines check schema differences programmatically. Optional LSN or timestamp parameters pin a branch to a point in time, but the two are mutually exclusive. The suggested workflow is to apply schema changes on a branch holding a copy of production data, use the API to track discrepancies, then run the migration in production once it has been tested.

  • Building Versioning for AI-Generated Apps

    Neon easyNovice

    Dyad, an open-source local AI app builder, pairs each Git commit with a Neon database timestamp so that undoing a version rolls back both code and data together. A separate Neon preview branch lets users view older versions without touching the main development branch. The current timestamp-based restore discards later database history, so the team plans to move to Neon snapshots for bi-directional versioning and to Neon Auth to simplify its Payload CMS-based setup.

  • Behind Modem.dev’s Product Velocity

    Neon mediumAdept

    Modem, a startup building an AI agent that centralizes user feedback from Slack, Discord and GitHub, uses Neon Postgres branching as its development workflow. Every PR with a migration gets its own database branch, where the migration is applied and a schema diff is posted to the PR. The process is repeated against a fresh branch at merge time to catch conflicting migrations, and each Vercel preview runs on an ephemeral branch with automatic cleanup. Two practical tips: script branching through the Neon CLI so coding agents can drive it, and tag OAuth refresh tokens with the originating branch so preview environments can't invalidate production tokens.

The quest for software engineering knowledge.

Look:
Layout: