Almost every tool, workflow, and product now has some version of AI integration intended to enhance capacity and improve outputs. And while AI has been increasingly helpful, it has also made some things a bit less clear.

As someone working in the field with real users at some of the largest tech companies in the world, I'm seeing a clear trend: the bottleneck is no longer a developer's access to tools; it's the judgment of knowing which tools to use and when to use them.

Instead of thinking about "using AI" or "not using AI", we've found it more helpful to first think in terms of how you're trying to solve the problem in front of you.

That's where the different tools available in Sourcegraph come in.

Sourcegraph offers developers three different options for searching and understanding code at scale.

  • Code Search - A traditional code search tool that allows you to search across all your repositories and code hosts, either through a unified interface or programmatically through API endpoints.
  • Deep Search - An agentic code search tool that understands natural language questions about your codebase, leveraging Sourcegraph search tooling to get better informed responses.
  • Sourcegraph MCP - Provides AI agents and applications with programmatic access to your Sourcegraph instance's code search, navigation, and analysis capabilities.

Having three ways to search will help you cover a wide range of use cases, but the key is knowing when to use each one. So let's break that down.

Code Search: When you know what you're looking for

There are many moments where you're not exploring, you're just trying to find something specific. Something you already know exists, but don't know where, how often, or in which commit.

That's where traditional code search makes sense. It's direct, predictable, and fast in a way that AI isn't, and isn't trying to be.

When you break it down, it shows up in moments like these:

  • Finding every occurrence of a function, variable, or API across repos
  • Identifying all instances of known vulnerabilities within the entire codebase

To make this concrete, consider the following example:

Use Case: Finding specific Spring Boot properties across all repositories in both properties files and YAML files.

Solution: Use the following query using Sourcegraph Code Search

context:global file:(^|/)resources/application(?:[-_][A-Za-z0-9]+)*\.(?:properties|ya?ml)$ /(?s:spring\b.*h2\b.*console\b.*enabled\b.*true\b)/

If you're unfamiliar with our search syntax, Query Assist can help generate the search query for you.

Deep Search: When you need to quickly understand complex, unfamiliar, and rapidly evolving codebases

Other times, you're not starting with something concrete. You're trying to make sense of a system, understand why a particular error was thrown, or figure out how something behaves the way it does.

Deep Search pairs the power of agents with Sourcegraph Code Search to help you understand what's happening across your codebase without manually jumping between files.

Deep Search is the right tool when needing to answer questions like:

  • "How does authentication work across this system?"
  • "What changed recently that could have caused this issue?"

Deep Search gives you a comprehensive answer backed by examples from your code, and can even generate a visual diagram of how the system is designed. Once you have that understanding, you can hand off the context to Code Search for precise results or to your AI agent via Sourcegraph MCP to take action.

Sourcegraph MCP: When your codebase doesn't fit on your laptop or in your context window

Then there are situations where you're not just trying to find or understand—you're trying to get something done. That usually involves more than one step: pulling in context, running verification steps, and perhaps interacting with other systems along the way.

Without the proper tools to quickly search a complex codebase and pull in the right context, an agent is still just guessing more than it needs to. Providing your agent of choice with remote access to your code via Sourcegraph search and reasoning tools is exactly what's needed in cases like this.

Let's take a look at a couple of examples.

  1. Use Case: Investigate a production issue in the CommaFeed application to quickly identify the root cause and provide a fix recommendation in remote, unfamiliar code.

    Solution: Ask your agent to review an error by providing the error message and the name of the remote repository.

    Triage the following stack trace from the CommaFeed application (https://github.com/Athou/commafeed).
    Use Sourcegraph MCP tools to investigate the codebase and provide a root cause analysis with a fix recommendation.
    
    jakarta.ws.rs.InternalServerErrorException: HTTP 500 Internal Server Error
    at org.jboss.resteasy.reactive.server.handlers.ResponseHandler.mapException(ResponseHandler.java:58)
    at org.jboss.resteasy.reactive.server.handlers.ResponseHandler.handle(ResponseHandler.java:42)
    at ...
    
  2. Use Case: Plan and begin a refactor of a repository based on the initial Deep Search investigation, targeting poor design and accessibility patterns.

    Solution: Ask your agent of choice to review a Deep Search response and create a comprehensive plan.

    Review this Deep Search conversation https://demo.sourcegraph.com/deepsearch/338a1da9-d8ac-4221-9fbc-769b5ebf676e and make a plan to resolve the key issues identified.
    

    Since Sourcegraph MCP gives agents access to Deep Search conversations, you can pass the results directly and let the agent begin planning and implementing the refactor.

Some problems require precision. Some need understanding. Some, a bit of both. The people making the biggest impact have simply discovered how to pick the right tool for the task in front of them.


Jon has been at Sourcegraph since 2022, serving as both a Senior Support Engineer and, more recently, a Field Engineer. He has worked with some of the largest tech companies in the world to help them adopt modern code search and AI into their daily workflows through best-practice enablement and deep dives into specific use cases they care about.