Building and Scaling Production Code Agents: Lessons from Replit

replit · Tech · 2023 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.5 (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: Production code agents

Replit needed to ship a fully automated code agent for users building apps from natural language, while optimizing for the right user persona, reducing time-to-first-working-app, detecting strange long-tail agent failures, building rigorous product-specific evals, and upskilling engineers to design reliable agent tools.

Constraints:

Architecture

Replit built a production code agent inside its cloud development environment. The agent receives a user's natural-language app request, rewrites it to clarify intent and tech-stack assumptions, can enter rapid build mode to generate 10-15 cohesive files quickly, then falls back to a traditional agentic loop to fix issues. The agent sees views similar to the user, including open files through an LSP and real-time console logs, and can interactively iterate with the user. Replit monitors traces in LangSmith, detects failures through rollback logs, rollback-frequency hotspots, negative sentiment, support/social reports, and evaluates behavior with a homegrown Python harness that spins up Chrome instances and Docker containers, using Anthropic computer use as a web agent to test generated apps in parallel. Engineers contribute product-specific evals and include example traces on agent PRs to build intuition.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  replit-workspace[Replit workspace] --> replit-agent[Replit Agent]
  replit-workspace --> agent-views[Agent views]
  replit-agent --> prompt-rewriter[Prompt rewriter]
  prompt-rewriter --> rapid-build-mode[Rapid build mode]
  rapid-build-mode --> agentic-repair-loop[Agentic repair loop]
  prompt-rewriter --> agentic-repair-loop
  agentic-repair-loop --> agent-views
  replit-agent --> rollback-failure-detector[Rollback failure detector]
  rollback-failure-detector --> sentiment-and-feedback-signals[Sentiment and feedback signals]
  sentiment-and-feedback-signals --> langsmith-trace-monitoring[LangSmith trace monitoring]
  replit-agent --> langsmith-trace-monitoring
  replit-agent --> evaluation-harness[Evaluation harness]
  evaluation-harness --> langsmith-trace-monitoring
  evaluation-harness --> evaluation-pool[Evaluation pool]
  evaluation-pool --> engineer-upskilling-loop[Engineer upskilling loop]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Replit workspace Cloud development environment where users create repls, write code, install packages, execute programs, and deploy applications. Replit Agent, Agent views
Replit Agent Fully automated code agent that works with users through natural language to build and modify applications. Replit workspace, Prompt rewriter, Rapid build mode, Agentic repair loop, Agent views, Rollback failure detector, LangSmith trace monitoring, Evaluation harness
Prompt rewriter Clarifies the user's request, expands details, and surfaces implementation assumptions before code generation. Replit Agent, Rapid build mode, Agentic repair loop
Rapid build mode Fast startup path that dumps 10-15 cohesive starter files using templates, guidance, and custom prompting. Prompt rewriter, Agentic repair loop
Agentic repair loop Traditional iterative loop that fixes issues after rapid build output or during ongoing user collaboration. Prompt rewriter, Rapid build mode, Agent views
Agent views Inputs mirroring what users can see, including open files through LSP, symbol errors, and real-time console logs. Replit workspace, Agentic repair loop
Rollback failure detector Application-level signal that logs rollbacks and rollback hotspots as indicators of agent mistakes or user restart points. Replit Agent, Sentiment and feedback signals
Sentiment and feedback signals Negative user language, feedback buttons, Twitter/social reports, and customer support signals used to find failure traces. Rollback failure detector, LangSmith trace monitoring
LangSmith trace monitoring Traceability system for monitoring and storing agent traces and evaluation information. Replit Agent, Sentiment and feedback signals, Evaluation harness
Evaluation harness Homegrown Python harness using Chrome instances, Docker containers, and Anthropic computer use to test generated apps in parallel. Replit Agent, LangSmith trace monitoring, Evaluation pool
Evaluation pool Shared set of plain-text evaluation examples contributed by engineers across the organization. Evaluation harness, Engineer upskilling loop
Engineer upskilling loop PR process and eval harness practices that require example traces and help engineers learn agent-tool behavior. Evaluation pool

Data flow

A user describes an app or change in Replit Agent. The request is rewritten to clarify intent and expose assumptions, such as whether to use Flask or Express. For new apps, rapid build mode emits many starter files from templates and custom prompting, then the ordinary agentic loop repairs issues. The agent uses IDE-like views, including files through LSP and console logs, to inspect the environment. User rollbacks, negative language, feedback, social/support reports, and LangSmith traces identify failures. Evaluation jobs spin up test environments in Chrome and Docker, let an Anthropic computer-use web agent behave like a user, log results, and feed new failures into a growing eval pool owned by the AI team but extendable by engineers across the company.

4 supporting quotes
“we kind of deployed uh the repet agent which is kind of our fully automated uh code agent where you talk to it and it writes the code for you”transcript, stated
“we actually try and rewrite their uh what they've given us to expand it add in more detail figure out really what they're looking for”transcript, stated
“we buil something called rapid build mode um where instead of going in and using that traditional agentic Loop we Kickstart the problem”transcript, stated
“we've got a harness that uh spins up a bunch of chrome instances and Docker containers um and then basically the agent can interact with each of those test them in parallel logs out everything um and Engineers can you know dive in and see uh it will our kind”transcript, stated

Why this architecture

Replit changed the architecture around the target persona. SWE-bench-style GitHub-issue-to-PR agents and Monte Carlo Tree Search can work for asynchronous engineering-manager workflows, but Replit's AI-first coders want tight loops and fast app starts. Rapid build mode trades initial precision for speed, then the agentic loop repairs small issues. Rollbacks and sentiment are embedded into the product because generic metrics and crash monitoring cannot distinguish satisfied exits from frustration or detect loops. The eval harness is treated like integration-test infrastructure: expensive to build, but cheap to extend and essential for model changes, regressions, and engineer learning.

4 supporting quotes
“we were building things that were easy for us to measure but not necessarily things that are important to measure”transcript, stated
“if you improve things for one target audience uh you make things considerably worse for another um as an example Monte Carlo Tre search which uh for people who aren familiar is essentially running the agent on a specific problem multiple times in parallel”transcript, stated
“this ultimately took us from a working application taking six or seven minutes to get started to being under 2 minutes”transcript, stated
“you need to build tactics for spotting these failure cases into your actual application um we found a amazing amount of success with rollbacks um so any roll back means that you made a mistake whether that's uh the user didn't specify what they wanted and”transcript, stated

Models used: hosted LLMs from labs · self-hosted code completion model · self-hosted code repair model · GPT-4o · GPT-4 mini · Claude 3.5 Haiku · Anthropic computer use · web agent

Scale

Alternatives considered (roads not taken)

Optimize primarily for SWE-bench

Rejected because: SWE-bench measured GitHub issue-to-PR workflows, while Replit users wanted to build ideas from scratch in a tight loop.

“figure out what you're going to build um but when we first started building this we started optimizing um purely for our sweep bench score um sbench for those who don't know is an evaluation about taking uh basically a GitHub issue and converting into a GitHub PR over six or seven relatively large”transcript, stated
“Jango um and that's a really important metric but it's not actually what our users were coming to repet to measure um or to build um they wanted to build their own idea um from scratch uh relatively quickly and iterate and and work in a very very tight Loop uh with their agent um and we had”transcript, stated

Monte Carlo Tree Search for interactive users

Rejected because: It improves long-trajectory accuracy but costs five times as much and slows the loop, which hurts AI-first coders and traditional engineers.

“Monte Carlo Tre search which uh for people who aren familiar is essentially running the agent on a specific problem multiple times in parallel”transcript, stated
“if you run you know five agents in parallel you pay five times as much um and it also kind of slows things down”transcript, stated

Traditional methodical agentic loop for app bootstrap

Rejected because: It was too slow for getting-started flows, taking several minutes before users saw something usable.

“our first sbench optimized agent didn't really feel good to use for getting started because it was relatively methodical”transcript, stated
“we Kickstart building a solution by just dumping out as much as we possibly can we give it some templates we give it some guidance there's some custom prompting there but the agent can very easily actually dump out 10 15 files um that are relatively cohesive”transcript, stated

Explicit feedback buttons as the main failure signal

Rejected because: Users rarely used them and felt like they were screaming into the void; rollbacks gave immediate value and clearer signal.

“we added a feedback button to be like you know provide feedback about what the agent's doing um we found that users just didn't really use it”transcript, stated
“feedback about what the agent's doing um we found that users just didn't really use it um the nice thing about rollbacks is that users get immediate value from it but feedbacks we we found that users thought they were kind of screaming into the void um and then obviously the other uh”transcript, stated

Public evaluations as the main quality bar

Rejected because: Public evals measure important generic skills but not Replit's specific marketing-site and app-building workflows.

“you can't actually rely on the public evaluations um the analogy I like to use is the public evaluation like the SAT”transcript, stated
“there's no Benchmark public available Benchmark for that um and how you evaluate your agent is really as specific to your software as your integration tests are”transcript, stated

Patterns

query-rewriting (intent)

Replit rewrites user prompts before coding to expand details, clarify intent, and expose tech-stack choices early.

“we started doing prompt rewriting so rather than diving straight into the code or trying to tackle a users's problem”transcript, stated
“expand it add in more detail figure out really what they're looking for”transcript, stated

prompt-chaining (workflow)

Rapid build mode generates an initial cohesive application skeleton, then the ordinary agentic loop repairs small issues.

“dump out 10 15 files um that are relatively cohesive and look they often have a few small issues um but then you can drop back to that agentic Loop”transcript, stated

observability-tracing (operations)

Replit uses LangSmith traces and application-level rollback/sentiment signals to find agent loops, bypassed blocklists, and frustration cases that crash metrics miss.

“traditional monitoring systems like data dog will help you notice if your app crashes but it won't help you if your user uh has you know gotten if your agent has started going in circles”transcript, stated
“generate thousands and thousands of traces every day and it's simply too much for us to actually read through um we use lsmith for monitoring traces um which is a really really great product um highly recommended um but ultimately you need to build tactics for spotting these failure cases into”transcript, stated

data-quality-loop (feedback)

Rollbacks, negative sentiment, support, and social reports become signals for engineers to inspect traces and add new evaluations.

“if you just log every time you do a roll back um and how frequent how often a specific uh like Point has been rolled back to you can use that as a very clear signal”transcript, stated
“every time you spot a new issue that's an opportunity for you to add a new evaluation to your test set”transcript, stated

eval-driven-development (quality)

Replit treats evaluations as a long-term investment, using a homegrown harness, Braintrust for some evals, LangSmith traceability, Chrome/Docker test environments, and Anthropic computer use.

“evaluate evaluate evaluate evaluate um I can't get stress enough that you are probably under testing your agent”transcript, stated
“we're P we're using anthropics computer use Tool uh almost exclusively”transcript, stated

model-routing (model-ops)

Replit distinguishes hosted lab models, self-hosted smaller models, code completion, code repair, and future small-model/MCTS options by task, latency, and cost.

“we were training smaller large language models for specific tasks so like the code complete we have a model that called code repair”transcript, stated
“the rise of like very very small models like uh gp4 mini um and how much they've improved in accuracy um the new 3.5 hiker”transcript, stated

cost-aware-routing (cost)

The team avoids expensive parallel-agent methods for interactive personas because cost and latency outweigh the accuracy gains.

“if you run you know five agents in parallel you pay five times as much um and it also kind of slows things down”transcript, stated

tool-use-orchestration (agent-runtime)

The agent uses user-visible views such as files, LSP diagnostics, and console logs as context for coding and debugging.

“we have files that has open are fed through an LSP so we have like you know this symbol couldn't be detected”transcript, stated
“anything that basically anything that the user can see the agent can see so it can see console logs”transcript, stated

Tradeoffs

Target persona

Chose AI-first coder and interactive getting-started loop over engineering-manager asynchronous issue-to-PR workflow.

Rationale: The personas value different speeds, budgets, codebase sizes, and interaction styles, and improving one can harm another.

“an engineering manager with a few reports in San Francisco who he's paying hundreds of thousands of dollars a year um is very different to a traditional engineer”transcript, stated
“if you improve things for one target audience uh you make things considerably worse for another”transcript, stated

Startup generation path

Chose rapid build mode then repair over methodical loop from the first file.

Rationale: Users needed a working app quickly; initial bulk generation could be imperfect because the loop could fix small issues afterward.

“the agent can very easily actually dump out 10 15 files um that are relatively cohesive and look they often have a few small issues”transcript, stated
“then you can drop back to that agentic Loop um to fix up those small issues”transcript, stated

Failure signal

Chose rollback monitoring over feedback button as the main signal.

Rationale: Rollbacks give users immediate value and create a clear mistake signal, while feedback buttons were rarely used.

“any roll back means that you made a mistake whether that's uh the user didn't specify what they wanted and you did the right the wrong thing”transcript, stated
“feedbacks we we found that users thought they were kind of screaming into the void”transcript, stated

Evaluation investment

Chose homegrown product-specific eval harness over public benchmarks alone.

Rationale: Replit needed tests that matched its app-building workflows and could grow with new product failures.

“how you evaluate your agent is really as specific to your software as your integration tests are”transcript, stated
“we've actually decided to roll a lot of our own uh for evaluations just because we think it's so important”transcript, stated

Organizational speed

Chose slow down to build the eval harness over continue vibes-based first-to-market shipping.

Rationale: Senior engineers argued the harness would let the organization move faster later, like integration tests.

“we want to be the first on the market we want to ship this The Vibes space development is working we don't need to spend time on that harness”transcript, stated
“say like hey actually no that that makes sense um we're going to give you some time and some slack to you know go slow now so that we can go fast later we have a we have a bunch of more questions um I don't think we'll have time to go through all of them so if you can also just like hop in the chat”transcript, stated

Gotchas (what bit them)

Optimizing the wrong benchmark produced the wrong product behavior.

Root cause: SWE-bench measured GitHub issue-to-PR workflows, while Replit's users wanted to build new ideas from scratch quickly.

Resolution: Define target personas and optimize the agent around tight-loop AI-first coder workflows.

“product is right like you have to figure out what you're going to build um but when we first started building this we started optimizing um purely for our sweep bench score um sbench for those who don't know is an evaluation about taking uh basically a GitHub issue and converting into a GitHub PR”transcript, stated
“they wanted to build their own idea um from scratch uh relatively quickly and iterate and and work in a very very tight Loop”transcript, stated

The first methodical agent loop felt slow for starting a new app.

Root cause: Creating several files through 20-30 second loops delayed the first usable application.

Resolution: Add rapid build mode to emit a cohesive starter app, then switch back to the agentic loop for repairs.

“each Loop kind of took like 20 30 seconds it actually took a relatively long time for your agent to build something that felt good”transcript, stated
“this ultimately took us from a working application taking six or seven minutes to get started to being under 2 minutes”transcript, stated

Agents fail in strange ways that ordinary monitoring does not catch.

Root cause: Agents can loop, wander down tangents, bypass blocklists, or frustrate users without crashing the app.

Resolution: Embed failure detection in the product through rollbacks, sentiment, traces, social reports, and support traces.

“agents fail in really really strange ways that are really hard to detect um and it's a very very long tale”transcript, stated
“a session where a user exits INF frustration looks like a session where a user left satisfied”transcript, stated

Manual trace review does not scale.

Root cause: The system generates thousands of traces per day.

Resolution: Use traces for drilldown, but rely on rollbacks, sentiment, support, and social signals to select traces worth investigating.

“we generate thousands and thousands of traces every day and it's simply too much for us to actually read through”transcript, stated

Vibes-based development produced regression-prone prompt hacks.

Root cause: Playing with the agent and making changes that feel better does not quantify failure rates or catch regressions.

Resolution: Invest in product-specific evals that behave like integration tests and grow as issues are found.

“we were doing what we were calling Vibes based development which is basically play around with it does it feel better”transcript, stated
“you end up with this kind of like Patchwork of different like hacks and like comments and prompts”transcript, stated

Agent tool design is not the same as API design.

Root cause: More fields and tool affordances can push the model out of distribution and cause behavior to go off the rails.

Resolution: Use eval harnesses, hands-on LLM time, and example traces on every agent PR to build engineer intuition.

“it's no different to helping out another team in any other engineering role um but some problems are new um so designing tools for an agent is not like designing an API apis can have as many fields as possible and the field names are important for like communicative reasons but they don't really”transcript, stated
“reasons but they don't really have a material effect on the efficacy of the API none of that is true for a tool um the more you add the more likely things are to go off the rails um you need to think about whether it's kind of in the distribution of how it works there's a lot of like weird nuances”transcript, stated

Evaluation

Replit evaluates the agent with product-specific internal evals, a homegrown Python harness, Braintrust for some traditional chat evaluations, LangSmith traceability, Anthropic computer use as a web agent, Chrome instances, Docker containers, parallel app testing, rollback frequency, negative sentiment, social/support reports, example traces on PRs, and reactive tests added whenever new failures appear.

Metrics: SWE-bench score · time to working application · rollback count and rollback point frequency · negative sentiment in user input · trace volume · failure rate · success rate · public benchmark performance · internal product-specific eval pass rate · new-model eval results · example traces per PR · parallel web-agent test outcomes

4 supporting quotes
“um but ultimately you need to build tactics for spotting these failure cases into your actual application um we found a amazing amount of success with rollbacks um so any roll back means that you made a mistake whether that's uh the user didn't specify what they wanted and you did the”transcript, stated
“sentiment analysis on user inputs so if user says you didn't do what I want negative sentiment that can be a red flag”transcript, stated
“even evaluation in particular simply because you've made such a strong emphasis on this yeah uh so I'm person we we use Brain Trust uh for some of our evaluations uh for chat uh for our traditional like chat features um we've actually decided to roll a lot of our own uh for evaluations just because”transcript, stated
“um that have worked really well um for testing functionality um and stuff like that uh but now we're P we're using anthropics computer use Tool uh almost exclusively um so we've got a harness that uh spins up a bunch of chrome instances and Docker containers um and then basically the agent can”transcript, stated

Outcomes

Replit's production context included roughly 30 million signed-up users, thousands of traces per day, a fast-start target under two minutes, and an evaluation discipline designed to detect changes from 50% to 90-99% success over many runs.

4 supporting quotes
“we've had a lot of success we've got about 30 million users uh signed up”transcript, stated
“this ultimately took us from a working application taking six or seven minutes to get started to being under 2 minutes”transcript, stated
“evaluations are a long-term investment and I really mean uh they're an investment that pays off”transcript, stated
“those three Engineers working on the agent expanded massively to like 20”transcript, stated