Deep Search is available on Enterprise Starter and Enterprise plans. It requires the Sourcegraph Model Provider and is not supported for BYOK (Bring Your Own Key) customers.
How Deep Search differs from Code Search
Code Search and Deep Search answer different kinds of questions.| Code Search | Deep Search | |
|---|---|---|
| Interaction model | Query-driven — you write a search expression | Agent-driven — you ask a natural language question |
| Best for | Exhaustive, precise lookups (find every occurrence of X) | Understanding, reasoning, and explanation (how does X work?) |
| Result format | List of matching files and lines | Prose answer with linked sources |
| Follow-up | Refine the query manually | Continue the conversation naturally |
| Completeness | Exhaustive across all matches | Representative sample used for reasoning |
Asking questions
Navigate to Deep Search from the Sourcegraph sidebar or top navigation. Type your question in the input field and press Enter.Using @-mentions
Type@ at any point in your query to scope the search to specific repositories or files. Suggestions update in real time as you type.
@repository-name— restrict the agent to a specific repo@path/to/file.go— point the agent at a particular file
@internal search.go finds files named search.go inside internal folders.
Example prompts
Understanding logger usage
Understanding logger usage
Exploring recent changes
Exploring recent changes
Cross-repository API analysis
Cross-repository API analysis
Architecture diagrams
Architecture diagrams
Build system investigation
Build system investigation
Reviewing results
Every Deep Search response includes:- A prose answer formatted in Markdown, with links to relevant files, directories, or repositories.
- A sources list showing exactly which searches were performed and which files were read. Use this to verify the answer and identify gaps.
- Suggested follow-ups to continue the investigation.
Use cases
Understanding unfamiliar code
Ask “How does authentication work in this service?” instead of manually tracing call stacks through dozens of files.
Architecture questions
Request diagrams and explanations of request flows, data models, or module boundaries across repositories.
Finding patterns
Ask “What patterns do we use for error handling?” to get a summarized answer with representative examples rather than raw search results.
Onboarding
Use Deep Search to ramp up on an unfamiliar codebase — ask “What is the overall structure of this repo?” or “How do I add a new API endpoint?”
Tracing changes over time
Ask Deep Search to summarize recent commits touching a specific area: “What changed in the payment module in the last month?”
Cross-repo dependencies
Investigate how multiple repositories interact: “Which services call the billing API and how do they authenticate?”
Conversation sharing
You can share a Deep Search conversation with other users in your Sourcegraph instance. Click the Share button in the top left to copy a shareable link. Any user on your instance can view the conversation via that link. To reset the share link and invalidate the previous one, click Share again and generate a new link. Sharing is disabled by default. Ask your site administrator to enable it:Limitations and when to use Code Search instead
Use Code Search when you need:- Exhaustive results — every single match, not a representative sample
- Structured queries — filtering by repo, language, file path, commit, or author
- Speed — instant results without waiting for an agent loop
- Regex or structural search — precise syntactic patterns
- A natural language question answered with explanation
- Reasoning across multiple files or repositories
- An architectural overview or diagram
- Understanding why code is written a certain way
Enabling Deep Search
If Deep Search is unavailable, ask your site administrator to add this to the site configuration:Network requirements for self-hosted instances
Deep Search streams responses using Server-Sent Events (SSE). A single request can remain open for up to 5 minutes.Related features
Code Search
Query-driven search across all your repositories with filters, regex, and structural search.
Cody
AI coding assistant for completions, chat, and inline edits directly in your editor.
Code Navigation
Jump to definition, find references, and hover documentation across repositories.
Admin overview
Configure Deep Search, manage entitlements, and monitor usage for your instance.