Building Production AI Coding Assistants and Agents at Scale

sourcegraph · Tech · 2024 · 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: Enterprise coding assistants and agentic developer tooling

Sourcegraph needed to evolve from code search into production AI coding systems for large enterprise codebases. Cody addressed the chat-era problem of retrieving relevant code context for a single model response, while AMP addressed the agent-era problem of letting a coding agent gather context, call tools, iterate, and change software without being constrained by an application architecture built for chat.

Constraints:

Architecture

Sourcegraph built on its code-search foundation in two generations. Cody combines code search and frontier LLMs as a chat-era assistant: a retrieval/context engine finds relevant code from large, messy codebases, then the model answers questions or generates code. AMP is a separate agent-era product rather than a Cody bolt-on: it wraps a frontier model in a loop with tools, lets the agent gather its own context, act on the world, and iterate, and treats agents/tools as composable functions inside application scaffolding. The product process mirrors the architecture: a small AMP team uses direct mainline ownership, regression-style examples instead of academic evals, and internal dogfooding to adapt quickly.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  enterprise-codebases["Enterprise codebases"] --> code-search-index["Code search index"]
  code-search-index --> precise-code-intelligence["Precise code intelligence"]
  code-search-index --> cody-context-engine["Cody context engine"]
  precise-code-intelligence --> cody-context-engine
  cody-context-engine --> chat-llm-assistant["Chat LLM assistant"]
  chat-llm-assistant --> enterprise-developers["Enterprise developers"]
  enterprise-developers --> amp-coding-agent["AMP coding agent"]
  amp-coding-agent --> primitive-tool-set["Primitive tool set"]
  amp-coding-agent --> frontier-model["Frontier model"]
  primitive-tool-set --> enterprise-codebases
  amp-coding-agent --> regression-workflow-examples["Regression workflow examples"]
  core-amp-team["Core AMP team"] --> amp-coding-agent
  core-amp-team --> regression-workflow-examples
  regression-workflow-examples --> amp-coding-agent
  amp-coding-agent --> enterprise-developers
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Enterprise codebases Large, messy, privacy-sensitive repositories where developers need search, navigation, and AI assistance. Code search index, Cody context engine, AMP coding agent
Code search index Scales code search over large codebases, branches, and regular-expression or structural search workflows. Enterprise codebases, Precise code intelligence, Cody context engine
Precise code intelligence Maps compiler-level symbols and types into language-agnostic code-navigation primitives such as go-to-definition and references. Code search index, Cody context engine
Cody context engine Retrieves relevant code context for chat-style AI coding assistance over enterprise codebases. Enterprise codebases, Code search index, Precise code intelligence, Chat LLM assistant
Chat LLM assistant Generates code and answers technical questions from the context supplied by Cody's retrieval layer. Cody context engine, Enterprise developers
AMP coding agent Runs a model-and-tool loop that gathers context, acts on code, communicates progress, and iterates from user intent. Enterprise codebases, Primitive tool set, Frontier model, Regression workflow examples, Enterprise developers
Primitive tool set Exposes basic actions for context gathering and world/code interaction rather than relying on a sophisticated external context engine. AMP coding agent, Enterprise codebases
Frontier model Provides robust tool use and agentic search capability inside AMP's application scaffold. AMP coding agent, Primitive tool set
Regression workflow examples Serve as practical evals for important workflows when the team makes major AMP changes. AMP coding agent, Core AMP team
Core AMP team Small product/research team that dogfoods AMP, pushes directly to main, and owns changes end-to-end. AMP coding agent, Regression workflow examples, Enterprise developers
Enterprise developers Use Sourcegraph, Cody, and AMP to understand codebases, generate code, and review agent output. Chat LLM assistant, AMP coding agent, Core AMP team

Data flow

The code-search layer indexes large codebases, branches, compiler-derived symbols, and language-agnostic navigation primitives. Cody uses that retrieval capability to place relevant enterprise code context into a chat LLM's context window for code generation or technical Q&A. AMP starts from user intent, enters a model-and-tool loop, gathers context with primitive tools, acts on code, communicates progress, and iterates. The team validates important workflows with regression examples, dogfoods the system, and treats application scaffolds as a way to generate new data for later model improvement.

5 supporting quotes
“there's also been a lot of  like technical challenges that we've had to solve   along the way around like scaling uh the type of  index that we use”transcript, stated
“the original idea  behind Cody was let's take the the the the DNA   we have around code search and combine that with  Frontier LMS”transcript, stated
“all an agent is   uh you know scripted is bare bones it's basically  like for loop plus a model and uh a set of tools”transcript, stated
“express   your intent in text have the agent do a bunch of  things communicate its progress and then you know   react to it.”transcript, stated
“if there's like a workflow that we think is  important, we'll have an example of that workflow   and then we'll run it whenever we make a major  change”transcript, stated

Why this architecture

Sourcegraph split Cody and AMP because the model capability boundary moved. Cody needed a smart retrieval/context engine for chat models that lacked agency. AMP could be much simpler at the retrieval layer because robust tool use moved more of the search and planning intelligence into the model-and-tool loop. Keeping AMP as a ground-up product also let the team avoid enterprise checklist drag and explore a changed SDLC instead of fitting agents into old code-review and sales-process slots.

4 supporting quotes
“originally we tried building  it within the context of of Kodi but I think what   we realized is um like I I think we're actually  in like the the agentic era”transcript, stated
“chat LMS were unable to  uh they did not they lack the agency to gather   their own context and so everyone was building  uh what I would like to what I call like fancy   retrieval engines”transcript, stated
“do you necessarily need as much   complexity or smartness in in your context engine  now with agents because a lot of that intelligence   has just been moved into the model”transcript, stated
“for those reasons where like we should actually   build this from the ground up rather than trying  to bolt an agent into uh an application that was   built for a previous generation”transcript, stated

Models used: Claude 3 Sonnet · frontier LLMs · chat LLMs · GPT-5 · Kimi K2 · Gemini

Scale

Alternatives considered (roads not taken)

Build AMP inside Cody

Rejected because: The team concluded that agentic LLM applications were a distinct architecture from chat-era assistants, so bolting agents into Cody would inherit the wrong product and context assumptions.

“originally we tried building  it within the context of of Kodi but I think what   we realized is um like I I think we're actually  in like the the agentic era”transcript, stated

Use a sophisticated context/RAG engine as the primary intelligence layer for agents

Rejected because: For agents, much of the needed search/planning intelligence moved into the model, and primitive tools plus multiple hops could compete with more elaborate vector-search systems.

“a lot of that intelligence   has just been moved into the model and you can  give it a set of primitive tools”transcript, stated

Run AMP through standard enterprise SaaS sales, feedback, and compliance processes immediately

Rejected because: The AI tooling landscape was changing too quickly for enterprise customers to know what they wanted, and premature checklist work would slow discovery.

“the last thing we want to do   is bend over backward to solve a bunch of like  enterprise um kind of compliance uh checkbox   requirements”transcript, stated

Evaluate the chat-to-agent transition primarily through academic benchmark deltas

Rejected because: The capability shift was obvious in use, so the team used product dogfooding and workflow regression examples rather than treating it as an academic eval comparison.

“we don't   really have like eval um at least not in the like  academic sense of the term. Like we have evals in   the same sense that people have like unit tests”transcript, stated

Patterns

rag-retrieval (retrieval)

Cody combines Sourcegraph's code-search DNA with frontier LLMs so enterprise code context is retrieved and placed into the model context for code generation and technical Q&A.

“the original idea  behind Cody was let's take the the the the DNA   we have around code search and combine that with  Frontier LMS”transcript, stated
“answering technical questions in in the context   of these larger messier code bases where just like  the base model is not going to do as as well.”transcript, stated

tool-use-orchestration (agent-architecture)

AMP is framed as a loop around a model and tools, where the agent can gather context or act on the world instead of waiting for an external retrieval engine to provide all context.

“all an agent is   uh you know scripted is bare bones it's basically  like for loop plus a model and uh a set of tools”transcript, stated
“that it can invoke to gather context or act on  the world right”transcript, stated

eval-driven-development (quality)

Sourcegraph treats important workflows as regression examples, running them when making major AMP changes rather than relying on academic benchmark-style evals.

“if there's like a workflow that we think is  important, we'll have an example of that workflow   and then we'll run it whenever we make a major  change”transcript, stated

model-routing (model-architecture)

AMP is multi-model by design, but Sourcegraph treats agents and tools as composable functions rather than simply exposing a model selector.

“we're we're multimodel by   design in the architecture of AMP, but not in this  kind of like uh model selector”transcript, stated
“what   we're building is is like what we call an agent  versus like a tool, they're both just functions.”transcript, stated

data-quality-loop (training-feedback)

The speaker argues that application scaffolds create new input-to-output traces that can become training data for the next generation of models.

“And in the process of using that application to   generate these applications, guess what? You  generate data, you generate tokens showing”transcript, stated
“Now with the apps, they generate  data. You can feed that back into a new generation   of models.”transcript, stated

Tradeoffs

Start AMP as a new product rather than extend Cody

Chose A ground-up agent architecture over Bolting agent behavior into the existing chat-era Cody application.

Rationale: The team judged that robust tool use changed the application architecture enough that Cody's retrieval-heavy chat paradigm would constrain AMP.

“originally we tried building  it within the context of of Kodi but I think what   we realized is um like I I think we're actually  in like the the agentic era”transcript, stated
“build this from the ground up rather than trying  to bolt an agent into uh an application that was   built for a previous generation”transcript, stated

Keep AMP small and exploratory

Chose A small research-lab-like core team over Prematurely scaling through enterprise compliance and sales checklists.

Rationale: Sourcegraph wanted to keep discovery speed while the agentic developer-tool landscape was unsettled.

“we're not we're not uh in the business  of of publishing papers. We're still in the   business of of building a product that uh people  buy and and use.”transcript, stated
“the last thing we want to do   is bend over backward to solve a bunch of like  enterprise um kind of compliance uh checkbox   requirements”transcript, stated

Use practical regression workflows instead of academic evals

Chose Workflow examples run on major changes over Academic-style benchmark comparisons as the primary development guide.

Rationale: The chat-to-agent shift was large enough that product use made the capability jump obvious, while regression examples caught important workflow breakage.

“we don't   really have like eval um at least not in the like  academic sense of the term. Like we have evals in   the same sense that people have like unit tests”transcript, stated
“it was like in in terms of the transition  from like uh Chat LN to uh Agentic LM it was   such a big transition”transcript, stated

Make authors own agent-assisted changes directly

Chose Push-to-main ownership and in-editor agent-output review over Default GitHub PR review as the main quality checkpoint.

Rationale: When one developer can drive many AI-assisted iterations, accountability and repeated close review of agent output may be more effective than process-heavy diffusion of responsibility.

“every everyone on   the core team has push access to main and the  default unless you really need or want someone   to like give their expertise”transcript, stated
“it's like you break things. It's it's on you to  to to fix it. Your name's on a git commit.”transcript, stated

Gotchas (what bit them)

A chat-era assistant architecture can become the wrong foundation once models can reliably use tools.

Root cause: Cody's architecture assumed context had to be gathered by an external context engine, while AMP's agents could gather context and act through tools.

Resolution: Sourcegraph restarted AMP from the ground up instead of bolting it into Cody.

“for those reasons where like we should actually   build this from the ground up rather than trying  to bolt an agent into uh an application that was   built for a previous generation”transcript, stated

Standard enterprise go-to-market can suppress awareness and slow learning in a rapidly changing AI market.

Root cause: Sourcegraph pushed Cody through enterprise B2B channels and listened to customers whose needs could shift within months.

Resolution: AMP is run more like a small research/product lab focused on discovering and inventing the future workflow.

3 supporting quotes
“Cody I would say like you know we we made a lot   of things we we made a lot of right calls there.  I think we were like the first um like rag code   tool to market.”transcript, stated
“our like  awareness in the uh public zeitgeist is probably   far lower than the actual impact that we're having”transcript, stated
“we're  kind of embracing that with AMP. It's like the   we're almost running AMP as uh like a separate  entity. It's almost like a research lab.”transcript, stated

Enterprise code data is valuable but cannot automatically become general training data.

Root cause: Customers are privacy- and data-sensitive, so proprietary code tokens cannot be rolled into models used outside the enterprise.

Resolution: Use the data to improve deployment inside enterprise contexts rather than assuming it can train a general model.

“enterprise  tokens is that uh you can't really use them for   training a general model that gets used outside  the enterprise.”transcript, stated
“most enterprises are   are very uh privacy and and data sensitive. Uh and  so you're not allowed to roll those tokens in.”transcript, stated

Agentic development can turn traditional code review into either a bottleneck or theater.

Root cause: Large PRs often get shallow LGTM review, while AI coding shifts much of the real review into the developer's interaction with agent output.

Resolution: The AMP team makes authors own changes, pushes directly to main, and reviews agent output repeatedly inside the editor.

“any change  that's like a thousand lines or more it's like man   I got my own deadlines.”transcript, stated
“I spend probably  like 80% of my development time like effectively   doing code review, right? Like reading through  agent output”transcript, stated

Evaluation

Sourcegraph reports customer ROI/productivity metrics for Cody, uses workflow examples as regression tests for AMP, and relies heavily on internal dogfooding rather than academic eval benchmarks.

Metrics: Customer-reported Cody development-productivity gains of roughly 30-60%. · Workflow examples run when major AMP changes are made. · Internal user judgment that the agentic transition was obvious within minutes of use. · Developer time spent reviewing agent output inside the editor.

4 supporting quotes
“these would be tied to the   ROI that they declared to their CFO in order to  justify the the cost of purchasing the software.”transcript, stated
“Cody's efficiency gains um they're  they range between like 30 and I think like 60%   uh efficiency gains in in development  productivity.”transcript, stated
“if there's like a workflow that we think is  important, we'll have an example of that workflow   and then we'll run it whenever we make a major  change”transcript, stated
“it's obvious to anyone who uses this thing   inside of like 5 minutes that it's capable of of  things that you could not even have dreamed of”transcript, stated

Outcomes

The case combines enterprise deployment scale for Sourcegraph/Cody with an intentionally small AMP core team exploring a newer coding-agent workflow.

4 supporting quotes
“we probably in the   order of like hundreds. So, like as a company,  we're primarily geared towards serving like larger   enterprise customers.”transcript, stated
“Cody's efficiency gains um they're  they range between like 30 and I think like 60%   uh efficiency gains in in development  productivity.”transcript, stated
“coding agents as like a  product category. Um weren't really a thing   until like mid to late spring of this  year.”transcript, implied
“it's like a really small uh core team uh probably  around like 10 people right now.”transcript, stated