Deep Search

Learn more about Sourcegraph's agentic Code Search tool Deep Search.

New in version 6.4. Deep Search is currently in research preview for Enterprise customers with access to Cody and Code Search. Because Deep Search is in research preview, it might change significantly in the future as we make improvements and adjust to user feedback. Please reach out to your Sourcegraph account team to request access.

Deep Search is an agentic code search tool. It receives a natural language question about a codebase, performs an in-depth search, and returns a detailed answer. The user can also ask follow-up questions to improve the answer further.

Under the hood, Deep Search is an AI agent that uses various tools to generate its answer. These tools include multiple modes of Sourcegraph's Code Search and Code Navigation tools. Using tools in an agentic loop enables Deep Search to iteratively refine its understanding of the question and codebase, searching until it is confident in its answer.

Deep Search displays a list of sources used to generate the answer. The sources are the various types of searches it performs and the files it reads. The answer is formatted in markdown. If prompted to do so, Deep Search can also generate diagrams as part of its answer.

Best practices

  • Give the agent a starting point for the search: Mention relevant repositories, files, directories, or symbol names. The more specific you are, the faster the search will be.
  • Provide reasonably scoped questions. The agent will perform much better if it does not have to read the entire codebase at once.
  • Check the list of sources. This is extremely useful for debugging and understanding where the answer came from. If something is missing, ask a follow-up question and mention the missing source.

Examples of prompts

  • Find examples of logger usage and show examples of the different types of logging we use.
  • I want to know when the indexing queue functionality was last changed in sourcegraph/zoekt. Show me the last few commit diffs touching this code and explain the changes.
  • Look at the GraphQL APIs available in sourcegraph/sourcegraph. Are any of them unused? The client code is in sourcegraph/cody.
  • Which tools do we use in our build processes defined in BUILD.bazel files?
  • Generate a request flow diagram for src/backend. Mark the auth and rate limit points.

Deep Search can only be used on Sourcegraph instances with Code Search and Cody licenses.

Deep Search is disabled by default. To enable it, ask your site administrator to set experimentalFeatures.deepSearch.enabled = "true" in your site configuration.

For optimal performance, Deep Search is specialized to only use one model. Currently, Deep Search only supports Claude Sonnet 4.

Configuring Deep Search on Amazon Bedrock

Include configuration for Claude Sonnet 4 in modelOverrides in your site configuration. For more information on configuring models, refer to Model Configuration.

Example for Sonnet 4 configuration inside modelOverrides:

JSON
{ "modelRef": "aws-bedrock::v1::claude-sonnet-4", "modelName": "us.anthropic.claude-sonnet-4-20250514-v1:0", "displayName": "Claude Sonnet 4 (AWS Bedrock)", "capabilities": [ "chat", "tools", ], "category": "balanced", "status": "stable", "contextWindow": { "maxInputTokens": 200000, "maxOutputTokens": 32000, } },

Then, configure Deep Search to use this model in experimentalFeatures:

JSON
"experimentalFeatures": { "deepSearch.enabled": true, "deepSearch.model": "aws-bedrock::v1::claude-sonnet-4" },
Previous
Structural Search
Next
FAQs