From Scripted Migrations to Agent-Driven Maintenance
Fleet Management has long been Spotify's answer to large-scale code maintenance. The system runs source-to-source transformations in containerized jobs and automatically opens pull requests against target repositories. It has proven effective for a well-defined set of tasks: bumping dependencies in build files like Maven POMs, updating configuration manifests, and executing straightforward refactors such as replacing a deprecated method call. The payoff has been substantial—since mid-2024, roughly half of Spotify's pull requests have been automated.
Yet the platform has a ceiling. Writing those transformations programmatically means manipulating abstract syntax trees or crafting regular expressions, a skill held by relatively few engineers. The complexity shows in the numbers: Spotify's automated Maven dependency updater, despite its seemingly simple job of finding pom.xml files and updating versions, has grown into a script of over 20,000 lines. Handling edge cases is where deterministic scripts get expensive, and as a result, the fleet-wide changes Spotify could automate were mostly the simple ones.
Fitting AI Into the Existing Infrastructure
Seeing the growing capability of AI tools to handle more complex code edits, Spotify began investigating agents inside Fleet Management in February 2025. The objective was to let engineers define migration work in natural language.
The team focused on the part of the pipeline that needed the most help: specifying the transformation itself. Rather than discarding the platform, they replaced the deterministic migration scripts with an agent that follows a prompt. Everything surrounding the transformation—targeting repositories, opening PRs, shepherding them through review, and merging—has stayed identical to the existing Fleet Management flow.
Spotify deliberately avoided simply adopting an off-the-shelf agent. Instead, the team built a small internal CLI that handles the orchestration: delegating a prompt to an agent, running custom formatting and linting tasks via local Model Context Protocol (MCP) tools, evaluating the resulting diff with LLMs as a judge, uploading logs to Google Cloud Platform (GCP), and capturing traces in MLflow. This setup gives Spotify a pluggable architecture, which has already paid off by letting them swap out components—agents and LLMs included—as the fast-moving GenAI space evolves, all without exposing users to the details.
Scaling to Ad Hoc Pull Requests
Early adopters were quick to put the tooling to use on their in-flight migration work. The results have produced over 1,500 merged, AI-generated PRs in production to date. The scope goes beyond trivial edits and now includes substantial categories of change:
- Language modernization, such as replacing Java value types with records
- Breaking-change upgrades, such as migrating data pipelines to a new version of Scio
- UI component migrations, such as moving to the new frontend system in Backstage
- Schema-aware config updates, such as changing parameters in YAML or JSON files while respecting schemas and formatting rules
For these migrations, Spotify has measured total time savings of 60–90% relative to hand-writing equivalent changes. Scaling the automated change across more codebases increases the return on investment further.
The migration pipeline wasn't the only avenue for the technology. Spotify discovered demand for triggering the same background agent on demand, not just for fleet-wide work. By exposing it via MCP, engineers and others can send tasks to the agent from Slack or GitHub Enterprise. A conversation with an interactive agent helps to scope the request, and the resulting prompt is handed off to the coding agent, which then produces a pull request. This has found users in unexpected places—catching architecture decision records (ADRs) from Slack threads, and allowing product managers to propose small changes without setting up a local development environment. The two use cases reinforce each other: better agent configuration or new tools in the migration path apply equally to any ad hoc PR, and standardization of commit tagging, LLM quotas, and trace collection benefits both paths.
The Cost of Abandoning Determinism
Going from deterministic code transformations to probabilistic agents means confronting a new set of trade-offs. The most obvious is performance—agents are slower than a script and their output is inherently less predictable. That unpredictability in turn demands new validation and quality control mechanisms. Safety is also a new concern; the agents require robust guardrails and sandboxing to operate correctly. Finally, there is cost: running LLMs at fleet scale is computationally expensive and must be managed carefully.
Hundreds of developers have already used the background agent within Spotify. The 1,500-merged-PR milestone demonstrates early momentum, but the harder engineering lies ahead. Confidence in the output, methods for providing agents with the right context, and feedback loops to make results more reliable are the open problems Spotify's team is currently tackling.



