Background Coding Agents with Strong Feedback Loops for Large-Scale Code Transformations

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: Reliable background coding-agent verification

Spotify needed background coding agents that could produce reliable PRs across thousands of software components without direct human supervision, while avoiding broken CI and functionally incorrect but passing changes.

Constraints:

Architecture

Spotify designed verification loops around Honk. The agent edits code in a limited container, can call an abstract verifier tool through MCP, and automatically runs relevant verifiers before PR opening. Individual verifiers such as Maven are selected by component contents and parse build/test output into concise feedback. After deterministic verifiers pass, an LLM judge evaluates the proposed diff against the original prompt. Surrounding infrastructure handles Slack/user interactions, pushing code, prompt authoring, and future CI/CD outer loops, keeping the agent focused on one code-change task.

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

flowchart LR
  prompt[Prompt] --> background-agent[Background agent]
  background-agent --> relevant-codebase[Relevant codebase]
  relevant-codebase --> verifier-selector[Verifier selector]
  verifier-selector --> independent-verifiers[Independent verifiers]
  background-agent --> mcp-verifier-tool[MCP verifier tool]
  mcp-verifier-tool --> independent-verifiers
  background-agent --> container-sandbox[Container sandbox]
  independent-verifiers --> pull-request-gate[Pull request gate]
  prompt --> llm-judge[LLM judge]
  llm-judge --> pull-request-gate
  background-agent --> pull-request-gate
  pull-request-gate --> surrounding-infrastructure[Surrounding infrastructure]
  surrounding-infrastructure --> future-ci-outer-loop[Future CI outer loop]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Prompt Instruction describing the code change the background agent should perform. Background agent, LLM judge
Background agent Limited coding agent that edits the relevant codebase and calls verifier tools. Prompt, Relevant codebase, MCP verifier tool, Container sandbox, Pull request gate
Relevant codebase Target component under transformation. Background agent, Verifier selector
Verifier selector Activates independent verifiers based on component contents. Relevant codebase, Independent verifiers
Independent verifiers Formatting, build, and test checks that provide concise feedback. Verifier selector, MCP verifier tool, Pull request gate
MCP verifier tool Abstract tool interface that lets the agent verify without knowing verifier implementation details. Background agent, Independent verifiers
LLM judge Reviews proposed diff against the original prompt to catch out-of-scope or unsafe changes. Prompt, Pull request gate
Container sandbox Limited-permission execution environment for the background agent. Background agent
Surrounding infrastructure Handles pushing code, Slack interaction, and prompt authoring outside the agent. Pull request gate, Future CI outer loop
Pull request gate Blocks PR opening when verifiers or judge fail. Background agent, Independent verifiers, LLM judge, Surrounding infrastructure
Future CI outer loop Planned GitHub CI-check loop complementing fast local verifiers. Surrounding infrastructure

Data flow

A prompt starts a background coding run. The sandboxed agent edits the codebase and invokes verifier tools; the MCP abstraction hides the underlying build/test details. Relevant verifiers run automatically before PR creation, failure messages guide correction, and the LLM judge evaluates whether the diff stays within prompt scope. Only after checks pass does the surrounding infrastructure open or manage the PR.

3 supporting quotes
“We address this challenge by implementing strong verification loops that guide the agent toward the desired result.”article, stated
“The agent is unaware of the underlying Maven verifier. ![Coding agents_part 3_image 2_final.png](https://images.”article, stated
“The judge is included in the standard verification loop and runs after all the other verifiers have completed.”article, stated

Why this architecture

Spotify reduces flexibility on purpose. Independent verifiers keep build/test noise out of the agent context, the LLM judge catches over-ambitious changes that deterministic tests miss, and the sandboxed agent does one task while infrastructure handles Slack, pushing, and prompts. This improves predictability and security for large-scale code transformations.

3 supporting quotes
“This is intentional, we believe that the reduced flexibility of the agent makes it more predictable. It also has secondary positive effects for security.”article, stated
“An individual verifier is not exposed directly to the agent; instead, it activates automatically depending on the software component contents.”article, stated
“We found this necessary because some agents were a bit too “ambitious”, trying to solve problems that weren’t strictly in their prompt, like refactoring code or disabling flaky tests.”article, stated

Models used: Honk · Claude Code · LLM judge

Scale

Alternatives considered (roads not taken)

Let the agent understand and run every build system directly

Rejected because: Parsing build/test specifics would waste context and add noisy decision-making.

“the agent doesn’t need to understand the specifics of calling different build systems or parsing complex output from tests”article, stated

Use deterministic verifiers only

Rejected because: Some agents made out-of-scope changes that tests/builds might not catch.

“On top of these deterministic verifiers, we added another layer of protection: an LLM as a judge. We found this necessary because some agents were a bit too “ambitious”, trying to solve problems that weren’t strictly in their prompt, like refactoring code or disabling flaky tests.”article, stated

Give the agent broad system responsibilities

Rejected because: Pushing code, Slack interaction, and prompt authoring are intentionally handled outside the agent for predictability and security.

“Pushing code, interacting with users on Slack, and even the authoring of prompts are all managed by surrounding infrastructure.”article, stated

Patterns

eval-driven-development (verification)

Verification loops guide the agent and block PRs until builds/tests/judge checks pass.

“strong verification loops that guide the agent toward the desired result.”article, stated

llm-as-judge (verification)

An LLM evaluates the proposed diff against the original prompt after deterministic checks complete.

“It uses the diff of the proposed change and the original prompt, and sends them to an LLM for evaluation.”article, stated

tool-use-orchestration (agent-runtime)

The agent calls abstract verifier tools through MCP while independent verifiers run the underlying checks.

“Model Context Protocol (MCP) tool definition that exposes the verifiers to the agent.”article, stated

guardrails-io-filtering (safety)

The agent has limited access in a highly sandboxed container and only handles code changes.

“The agent itself has very limited access.”article, stated
“It can see the relevant codebase, use tools to edit files, and execute verifiers as tools.”article, stated

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

When verifier failures block PRs, users receive an error instead of a half-broken change to merge.

“If one of the verifiers fails, the PR isn’t opened and the user is presented with an error message.”article, stated

Tradeoffs

Keep verifier details hidden from the agent

Chose MCP abstraction over independent verifiers over agent directly invoking each build/test system.

Rationale: The agent gets incremental feedback without spending context on noisy implementation details.

“The agent is unaware of the underlying Maven verifier.”article, stated

Reduce agent flexibility

Chose limited access and surrounding infrastructure for complex tasks over a broad autonomous agent with Slack, push, prompt-authoring, and system access.

Rationale: Less flexibility makes behavior more predictable and improves security.

“This is intentional, we believe that the reduced flexibility of the agent makes it more predictable.”article, stated
“It also has secondary positive effects for security.”article, stated

Add an LLM judge despite lacking judge evals

Chose prompt/diff LLM evaluation after deterministic verifiers over waiting for a fully evaluated judge before deployment.

Rationale: Internal metrics showed the judge caught out-of-scope behavior and enabled course correction.

“We have yet to invest in evals for our judge. However, we know from internal metrics”article, stated

Gotchas (what bit them)

A passing CI result does not guarantee functional correctness.

Root cause: Agents can make changes that satisfy available tests while misunderstanding the prompt or behavior.

Resolution: Spotify adds an LLM judge over diff plus prompt to catch out-of-scope changes.

“The background agent produces a PR that passes CI but is functionally incorrect.”article, stated
“This is the most serious error, as it erodes trust in our automation.”article, stated

Build and test output can consume the agent's context.

Root cause: Different build systems and complex failure output are noisy and tedious to parse.

Resolution: Independent verifiers summarize only relevant errors and hide implementation detail behind MCP.

“abstract away much of the noise and decision-making that would otherwise consume the agent’s precious context window.”article, stated

Agents can get creative beyond the prompt.

Root cause: They may refactor code or disable flaky tests instead of doing the requested narrow change.

Resolution: The LLM judge vetoes such diffs and can force course correction.

“trying to solve problems that weren’t strictly in their prompt, like refactoring code or disabling flaky tests.”article, stated

Verifier platform coverage limits adoption.

Root cause: Current verifiers run on Linux x86 while iOS/macOS and ARM64 systems need different hosts.

Resolution: Spotify plans to expand verifier infrastructure across hardware and operating systems.

“Our current verifiers only run on Linux x86”article, stated
“our iOS applications require macOS hosts to run verifiers successfully”article, stated

Evaluation

Spotify evaluates reliability with deterministic verifiers, automatic pre-PR checks, LLM-judge veto and course-correction metrics, future CI/CD outer loops, and planned structured evals for prompts, architectures, and LLM providers.

Metrics: three failure modes: no PR, CI-failing PR, CI-passing but wrong PR · judge vetoes about a quarter of thousands of sessions · agent course-corrects half the time after judge veto · Linux x86 verifier coverage today · planned CI/CD outer loop and structured evals

3 supporting quotes
“we worry about three primary failure modes.”article, stated
“the judge vetoes about a quarter of them. When that happens, the agent is able to course correct half the time.”article, stated
“Implementing robust evals will allow us to systematically assess changes to system prompts”article, stated

Outcomes

The source reports thousands of agent sessions, judge veto/course-correction rates, and planned expansion beyond Linux x86 verifier environments.

3 supporting quotes
“Without these feedback loops, the agents often produce code that simply doesn't work.”article, stated
“With verifiers and a Judge to guide them, we've found that our agents can solve increasingly complex tasks with a high degree of reliability.”article, stated
“adding another layer of validation.”article, stated