Background Coding Agents for Large-Scale Software Maintenance and Migrations

spotify · Media & Entertainment · 2025 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Large-scale software maintenance and migrations

Spotify's existing Fleet Management platform handled simple fleet-wide code transformations well, but complex migrations still required scarce experts and too much manual work.

Constraints:

Architecture

Spotify evolved Fleet Management by replacing deterministic transformation declarations with prompts executed by a background coding agent while preserving the surrounding fleet infrastructure for targeting repositories, opening PRs, reviews, and production merges. A small internal CLI delegates prompts to agents, runs formatting and linting via local MCP, evaluates diffs with an LLM judge, uploads logs to GCP, captures MLflow traces, and can switch between agents/LLMs. The agent is also exposed through MCP so Slack/GitHub users can start ad hoc background coding tasks.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  fleet-management[Fleet Management] --> fleetshift-prompt[Fleetshift prompt]
  fleetshift-prompt --> internal-cli[Internal CLI]
  internal-cli --> coding-agent[Coding agent]
  internal-cli --> local-mcp-tools[Local MCP tools]
  internal-cli --> llm-judge[LLM judge]
  internal-cli --> gcp-logs[GCP logs]
  internal-cli --> mlflow-traces[MLflow traces]
  coding-agent --> pull-request-pipeline[Pull request pipeline]
  fleet-management --> pull-request-pipeline
  pull-request-pipeline --> human-reviewers[Human reviewers]
  slack-and-github-entrypoints[Slack and GitHub entrypoints] --> interactive-agent[Interactive agent]
  interactive-agent --> coding-agent
  slack-and-github-entrypoints --> human-reviewers
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Fleet Management Existing platform for targeting repositories and applying fleet-wide transformations. Fleetshift prompt, Internal CLI, Pull request pipeline
Fleetshift prompt Natural-language declaration of the desired code transformation. Fleet Management, Internal CLI
Internal CLI Delegates prompts, runs MCP-based checks, invokes LLM judge, uploads logs, and captures traces. Fleetshift prompt, Coding agent, Local MCP tools, LLM judge, GCP logs, MLflow traces
Coding agent Background agent that edits code according to the prompt. Internal CLI, Pull request pipeline
Local MCP tools Formatting and linting tools exposed to the CLI. Internal CLI
LLM judge Evaluates proposed diffs against the prompt. Internal CLI
GCP logs Central log store for agent runs. Internal CLI
MLflow traces Trace capture for observability and analysis. Internal CLI
Pull request pipeline Existing workflow for PR creation, review, and production merge. Fleet Management, Coding agent, Human reviewers
Slack and GitHub entrypoints Interfaces where Spotifiers can kick off background coding tasks. Interactive agent, Human reviewers
Interactive agent Gathers task details and turns chat/GitHub interactions into a prompt for the coding agent. Slack and GitHub entrypoints, Coding agent
Human reviewers Review and merge generated PRs, provide feedback, and govern production changes. Pull request pipeline, Slack and GitHub entrypoints

Data flow

Engineers define a Fleetshift prompt or interact through Slack/GitHub. Fleet Management selects target repositories and invokes Spotify's internal CLI. The CLI delegates work to a pluggable coding agent, runs formatting/linting through MCP, judges diffs with an LLM, uploads logs, captures MLflow traces, and hands successful changes back to the existing PR/review/merge pipeline.

3 supporting quotes
“We replaced deterministic migration scripts with an agent that takes instructions from a prompt. All the surrounding Fleet Management infrastructure — targeting repositories, opening pull requests, getting reviews, and merging into production — remains exactly the same.”article, stated
“All the surrounding Fleet Management infrastructure — targeting repositories, opening pull requests, getting reviews, and merging into production — remains exactly the same.”article, stated
“This CLI can delegate executing a prompt to an agent, run custom formatting and linting tasks using local Model Context Protocol (MCP)”article, stated

Why this architecture

Spotify kept the mature Fleet Management shell and replaced only the brittle transformation declaration with an agent prompt. This reduces migration authoring friction while preserving targeting, PR creation, review, traceability, and merge controls. The internal CLI keeps agent/model choice pluggable and integrates verification, logs, and traces without exposing platform details to users.

3 supporting quotes
“We started with the part of the process that needed the most help: the declaration of the code transformation itself.”article, stated
“having that CLI allows us to seamlessly switch between different agents and LLMs.”article, stated
“In the fast-moving environment that is GenAI, being flexible and pluggable this way has already allowed us to swap out pieces multiple times, giving our users a preconfigured and well-integrated tool out of the box, without exposing them to the nitty-gritty details.”article, stated

Models used: Honk · Claude Code agents · LLM judge · pluggable LLMs

Scale

Alternatives considered (roads not taken)

Continue writing deterministic migration scripts

Rejected because: Complex transformations required specialized expertise and could grow into very large scripts.

“Defining source code transformations programmatically, by manipulating a program’s abstract syntax tree (AST) or using regular expressions”article, stated
“While its core function — identifying pom.xml files and updating Java dependencies — is straightforward, handling all corner cases has led to the transformation script growing to over 20,000 lines of code.”article, stated

Adopt an off-the-shelf coding agent directly

Rejected because: Spotify wanted a preconfigured CLI with local MCP checks, LLM judge, logs, traces, and agent/model pluggability.

“Instead of adopting an off-the-shelf coding agent as it is, we decided to build a small internal CLI.”article, stated

Replace the whole Fleet Management pipeline

Rejected because: Targeting, PR creation, review, and production merge infrastructure already worked.

“All the surrounding Fleet Management infrastructure — targeting repositories, opening pull requests, getting reviews, and merging into production — remains exactly the same.”article, stated

Patterns

tool-use-orchestration (developer-platform)

The internal CLI coordinates coding agents, MCP checks, LLM judging, GCP logs, MLflow traces, and PR workflows.

“run custom formatting and linting tasks using local Model Context Protocol (MCP), evaluate a diff using LLMs as a judge”article, stated

llm-as-judge (verification)

An LLM judge evaluates generated diffs as part of the internal CLI workflow.

“evaluate a diff using LLMs as a judge”article, stated

observability-tracing (operations)

Agent runs upload logs to GCP and capture traces in MLflow.

“upload logs to Google Cloud Platform (GCP), and capture traces in MLflow.”article, stated

model-routing (model-ops)

The CLI can switch between different agents and LLMs as the ecosystem changes.

“seamlessly switch between different agents and LLMs.”article, stated

human-in-the-loop-gate (review)

Generated changes still flow through Spotify's PR review and merge process.

“opening pull requests, getting reviews, and merging into production”article, stated

Tradeoffs

Replace only the transformation declaration

Chose agent prompts inside existing Fleet Management over rebuilding migration orchestration end to end.

Rationale: The existing platform already handled targeting, PRs, reviews, and production merges reliably.

“All the surrounding Fleet Management infrastructure — targeting repositories, opening pull requests, getting reviews, and merging into production — remains exactly the same.”article, stated

Build a Spotify-specific CLI

Chose small internal CLI with checks, judge, logs, traces, and pluggability over off-the-shelf agent as-is.

Rationale: The CLI lets Spotify integrate agent work into existing developer workflows and swap technologies.

“without exposing them to the nitty-gritty details.”article, stated

Expose agents via MCP for ad hoc work

Chose Slack/GitHub entrypoints with an interactive agent over only scheduled fleet migrations.

Rationale: The same agent infrastructure can support ADR capture, product-manager changes, and other background tasks.

“Spotifiers can now kick off coding agent tasks from both Slack and GitHub Enterprise.”article, stated

Gotchas (what bit them)

Deterministic transformations hit a complexity wall.

Root cause: AST/regex migrations require specialized expertise and extensive corner-case code.

Resolution: Spotify uses prompts and coding agents for more complex code changes while retaining Fleet Management orchestration.

“Only a few teams have the required expertise and time to implement more sophisticated Fleetshifts over our entire codebase.”article, stated

Background agents introduce performance and predictability risk.

Root cause: Agents can take a long time and produce unpredictable output.

Resolution: Spotify focuses on validation, quality control, guardrails, sandboxing, and feedback-loop posts.

“Performance is a key consideration, as agents can take a long time to produce a result, and their output can be unpredictable.”article, stated

Safety and cost become platform concerns at LLM scale.

Root cause: Large-scale LLM agent runs are computationally expensive and can make broad code changes.

Resolution: Spotify adds guardrails, sandboxing, quotas/traces, and validation mechanisms around agent runs.

“we also have to consider safety and cost. We need robust guardrails and sandboxing”article, stated

Evaluation

Spotify evaluates the system with merged PR counts, time-savings estimates, adoption across developers, PR review outcomes, LLM-judge checks, logs/traces, and observed tradeoffs around performance, predictability, safety, and cost.

Metrics: more than 1,500 merged AI-generated PRs · around half of PRs automated by Fleet Management since mid-2024 · 60-90% time savings for migrations · over 20,000 lines in a deterministic Maven updater · hundreds of developers using the agent

3 supporting quotes
“To date, our agents have generated more than 1,500 pull requests”article, stated
“we’ve seen a total time saving of 60–90% compared to writing the code by hand”article, stated
“hundreds of developers now interact with our agent”article, stated

Outcomes

The case gives strong production scale: >1,500 merged AI PRs, hundreds of developers, about half of PRs automated by Fleet Management since mid-2024, and 60-90% time savings on migrations.

3 supporting quotes
“And not trivial changes, either — we’re now starting to tackle changes such as:”article, stated
“We consider this a very promising start”article, stated
“improvements to the agent configuration and tools now apply to any PRs generated, no matter the source of the task.”article, stated