{"slug": "lakebase-and-agentic-sdlc-branching-databases-for-coding-agents", "title": "Lakebase and Agentic SDLC: Branching Databases for Coding Agents", "summary": "Databricks detailed a workflow that pairs Git worktrees with Lakebase Postgres database branching so each parallel coding agent gets its own isolated database, with branches created in under a second regardless of database size. Lakebase uses copy-on-write so branches share parent data and consume extra storage only as they diverge, and idle branches scale to zero for no compute cost. The approach targets schema conflicts, cross-agent interference and mock data by letting each agent apply migrations, run tests and retire its branch, with an example repository at github.com/databricks/tmm/tree/main/Lakebase-Agentic-CI and a post-checkout hook that provisions a branch per worktree.", "body_md": "AI has changed how software gets built. As coding agents take on a growing share of development work, developers are increasingly shifting toward orchestrating them. Running multiple agents in parallel is becoming the norm, and the tooling has evolved with it, from skills and hooks to MCPs, subagents, all designed to make agents safer and more effective.\n\nYet, one mission-critical part in the development workflow is still often overlooked: the database.\n\nEach concurrent agent needs to write code, apply schema changes, and run tests against a database. With shared environments, such as a single development or staging database typical of traditional database setups, this creates real challenges. Agents can conflict on schema changes, interfere with one another's, or fall back to mocks that do not reflect real-world data. These were already pain points for developers, but they are exacerbated by coding agents. Agents move faster, operate in parallel and need a safe environment to avoid putting production data at risk or exposing sensitive data.\n\nThe [Lakebase Postgres](https://www.databricks.com/product/lakebase) architecture solves this with database branching. Just as Git lets you branch code, Lakebase lets you branch an entire database in under a second, regardless of its size. It uses copy-on-write, so branches share the parent branch data but only consume additional storage as they diverge. In addition, they can scale-to-zero, meaning idle branches incur no compute cost. This is important as you run several agents at the same time. Each branch is fully isolated, allowing an agent to apply migrations, run tests, and retire the branch when they’re done.\n\nIn this article, I'll show you what this looks like in practice with an end-to-end workflow for a Lakebase development loop built around coding agents. An [example repository](https://github.com/databricks/tmm/tree/main/Lakebase-Agentic-CI) is available here with examples of Github Actions workflows to achieve what is described in the following sections.\n\nPrefer to see it in action? Watch the video walkthrough below.\n\nBefore we dive in, a note on environments with Databricks. A common setup when using Lakebase Postgres is to use one Databricks workspace per environment, such as dev, staging, and prod. Most teams will want to leverage workspaces for various reasons like security and compliance, although it is also possible to use a single workspace. Similarly, branching from a seeded database instead of the production database is also common, to avoid exposing sensitive data like PII. In this article, we’ll use a single workspace for simplicity, but the same core concepts apply to multi-workspace setups and can be implemented just as easily.\n\nThe main disruption to traditional databases comes from multiple coding agents working concurrently. When developing new features or fixing issues, each agent often needs to read the database schema, apply changes, seed data, and run tests. Without isolation, these agents can interfere with one another or corrupt a shared database. Database branching gives each agent an isolated environment to work independently without affecting other agents running at the same time.\n\nA practical way to avoid code conflict locally is to leverage Git worktrees. A worktree gives each agent its own directory with its own branch checked out, so there's no file-level conflict between them. Git worktrees solve code isolation for parallel agents. Lakebase branching solves the other half: database isolation. By adding a post-checkout hook to the repository, each new worktree automatically gets its own database branch. Once the development is done, the agent will open a PR. Agent behavior can be guided through repository instruction files such as AGENTS.md or [CLAUDE.md](http://claude.md).\n\nHere is an example workflow using [Claude Code, worktrees](https://code.claude.com/docs/en/worktrees) and [Lakebase branching](https://docs.databricks.com/aws/en/oltp/projects/branches) for safe AI development:\n\nWhen the agent is done, it will create PR. This behavior is provided in the [repository instruction file](https://github.com/databricks/tmm/blob/main/Lakebase-Agentic-CI/AGENTS.md). Once the PR is created, both the worktree and the database branch can be retired. One important difference from Git is that Lakebase branches are not merged back to the main branch. Because the parent and child can both change independently, reconciling their data can quickly become impractical. Instead, schema changes are tracked in code alongside the application logic, then promoted to the parent branch through migrations using tools such as Drizzle, Flyway, Liquibase, or Alembic.\n\nIn our example, we use Drizzle. When a schema change is needed, the agent adds the corresponding migration to the codebase. The deployment automation then applies that migration when deploying the preview application and again when the change is merged into the main branch.\n\nOnce a Pull Request (PR) is opened, we want to automatically validate and test the code against a real database before anything reaches production.\n\nUsing continuous integration tooling, in this case, Github Actions, an ephemeral Lakebase branch is created for each PR, as a child of the production branch. That branch becomes the database environment for the PR. Automated tests can run against it, a preview application can be deployed, and reviewers can validate the change against a real database.\n\nBecause the branch starts from production, the schema migration can also be applied and tested before the change reaches production.\n\nOnce the PR is approved and merged, the feature code and migration instructions are promoted, and the temporary Lakebase branch is deleted.\n\nA common [GitHub Actions](https://github.com/databricks/tmm/blob/main/Lakebase-Agentic-CI/.github/workflows/lakebase-preview.yml) workflow looks like this:\n\nIn the repository example, we deploy the application with [Databricks Apps](https://www.databricks.com/product/databricks-apps), but the concept applies to any other hosting platforms like Vercel, Netlify, Cloudflare and more.\n\nBeyond development tasks, database branching can support several other useful workflows. These are not implemented in the example repository, but they can be valuable additions to a Lakebase development workflow. For example, with database branching, you can create an isolated branch from production at a point in time, typically right before a bug appeared, and investigate the issue against the real data, reproduce the bug safely, and retire the branch once the fix is validated.\n\nBranching can also make schema migrations safer. Before deploying a change to production, you can automatically create a database branch, apply the migration, run tests, and verify that the application still behaves as expected. Once the migration is validated, the same change can be promoted to production.\n\nThese workflows are powerful because they let developers work with production-like, or production-derived data using Unity Catalog masking for example, without putting the live database at risk. Each branch is isolated, ephemeral, making it a safe environment for debugging, testing, and validation.\n\nTogether, these patterns form the Lakebase development loop: a branch per agent, a branch per PR, and isolated branches for production validation.\n\nFor the Agentic SDLC, database branching provides a safe and flexible foundation for development teams working with coding agents. [Try branching out for yourself](https://login.databricks.com/signup).\n\nSubscribe to our blog and get the latest posts delivered to your inbox.", "url": "https://wpnews.pro/news/lakebase-and-agentic-sdlc-branching-databases-for-coding-agents", "canonical_source": "https://www.databricks.com/blog/lakebase-and-agentic-sdlc-branching-databases-coding-agents", "published_at": "2026-10-08 22:00:00+00:00", "updated_at": "2026-10-08 22:16:22.053510+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-infrastructure"], "entities": ["Databricks", "Lakebase Postgres", "Claude Code", "Git worktrees", "GitHub Actions"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/lakebase-and-agentic-sdlc-branching-databases-for-coding-agents", "markdown": "https://wpnews.pro/news/lakebase-and-agentic-sdlc-branching-databases-for-coding-agents.md", "text": "https://wpnews.pro/news/lakebase-and-agentic-sdlc-branching-databases-for-coding-agents.txt", "jsonld": "https://wpnews.pro/news/lakebase-and-agentic-sdlc-branching-databases-for-coding-agents.jsonld"}}