---
title: "WarpGrep: Code search subagent, #1 on SWE-Bench Pro"
url: "https://www.morphllm.com/products/warpgrep"
canonical_url: "https://www.morphllm.com/products/warpgrep"
docs_url: "https://docs.morphllm.com/sdk/components/warp-grep/index"
description: "A code search subagent that runs in a separate context window. Runs up to 36 parallel tool calls across 3 turns, returns only relevant code. Requires no embeddings, vector DB, or indexing step. 0.73 F1 in 3.8 steps. Model: morph-warp-grep-v2.1."
---

# WarpGrep

A code search subagent that runs in a separate context window. Use when a coding agent needs to find code, functions, call-sites, logs, or package internals across a repository without polluting its main context with raw grep output or dead-end searches. Model: `morph-warp-grep-v2.1`. Requires no embeddings, vector DB, or indexing step.

- Canonical: https://www.morphllm.com/products/warpgrep
- Docs: https://docs.morphllm.com/sdk/components/warp-grep/index
- API reference: https://docs.morphllm.com/api-reference/endpoint/warpgrep
- Use as agent tool: https://docs.morphllm.com/sdk/components/warp-grep/tool

## Problem

Coding agents burn ~60% of compute on search (Cognition's measurement). Raw grep/read output pollutes the main context window and degrades downstream reasoning (context rot). WarpGrep isolates the search in a subagent, runs parallel exploration, and returns only the relevant code.

## Quickstart

```ts
import { MorphClient } from "@morphllm/morphsdk";

const morph = new MorphClient({ apiKey: process.env.MORPH_API_KEY });

const result = await morph.warpGrep.execute({
  query: "Where are billing invoices emailed to customers?",
  repoRoot: "./my-project",
  excludes: ["node_modules", ".git"],
  includes: ["src/**/*.ts"],
});

console.log(result.contexts); // relevant code sections only
console.log(result.summary);  // search findings
```

Also callable via OpenAI-compatible chat completions with `model: "morph-warp-grep-v2.1"`. See [direct API access](https://docs.morphllm.com/sdk/components/warp-grep/direct) for custom harnesses.

## Numbers

| Metric | Value |
|--------|-------|
| F1 score (SWE-Bench Pro) | 0.73 |
| Median steps to answer | 3.8 |
| Max parallel tool calls | 36 (across 3 turns) |
| Typical latency | ~6 seconds |
| Input / Output $/1M | 0.80 / 0.80 |
| Free tier | $10/mo in compute |

## When to use

- Coding agent needs to locate code across an unfamiliar repo
- Questions that span multiple files ("where is X called from?", "what calls the billing API?")
- Remote search of GitHub repos without cloning
- Log search across structured output
- Package search across registries

## When not to use

- Exact-string lookup where the filename is known (use `grep` directly)
- Single-file reads (use file read)
- When you need deterministic, reproducible output (subagent reasoning is non-deterministic)

## Key capabilities

- [Codebase search](https://docs.morphllm.com/sdk/components/warp-grep/codebase-search): local repos
- [GitHub search](https://docs.morphllm.com/sdk/components/warp-grep/github-search): search `pytorch/pytorch`, `facebook/react`, or any public repo by name; pin branches/tags; no clone required
- [Streaming](https://docs.morphllm.com/sdk/components/warp-grep/streaming): stream search steps as they execute for UI transparency
- [Sandbox execution](https://docs.morphllm.com/sdk/components/warp-grep/sandbox-execution): run WarpGrep inside your own sandbox (E2B, Modal, Daytona, Docker, SSH)
- [Direct API access](https://docs.morphllm.com/sdk/components/warp-grep/direct): build your own agent harness

## Integrations

- [Subagent as agent tool](https://docs.morphllm.com/sdk/components/warp-grep/tool): drop WarpGrep into Claude Code, Cursor, custom agents
- [Python harness](https://docs.morphllm.com/guides/warp-grep-python): complete Python agent example
- [MCP](https://docs.morphllm.com/mcpquickstart): Cursor, Windsurf, Claude Code via MCP
- [Retrieval guide](https://docs.morphllm.com/guides/retrieval): effective retrieval patterns for any repo size

## How it works

1. Plans grep / read / list_dir calls in parallel based on the query
2. Executes breadth-first across up to 36 tool calls in up to 3 turns
3. Prunes irrelevant branches early
4. Returns `contexts` (relevant code sections) and `summary` (findings), not raw tool output

## See also

- [Examples: production-ready patterns](https://docs.morphllm.com/sdk/components/warp-grep/examples)
- [TypeScript SDK](https://docs.morphllm.com/sdk/quickstart)
- [API reference: WarpGrep endpoint](https://docs.morphllm.com/api-reference/endpoint/warpgrep)
- [Subagents: architectural pattern](https://docs.morphllm.com/sdk/components/subagents)
- Playground: https://www.morphllm.com/playground/na/warpgrep
- Benchmarks: https://www.morphllm.com/benchmarks/warp-grep
- Blog: [WarpGrep v2](https://www.morphllm.com/blog/warpgrep-v2)
- Blog: [The Code Search Bottleneck](https://www.morphllm.com/blog/code-search-bottleneck)
- Blog: [Fast Context RL Retrieval](https://www.morphllm.com/blog/fast-context-rl-retrieval)
