Skip to main content
WarpGrep is a code search subagent — a separate LLM call that searches your code without consuming your main agent’s context window. It takes a natural language query, runs multiple grep and file-read operations, reasons about what’s relevant, and returns matching code under 6 seconds on most codebases.

Capabilities

CapabilityWhat it does
Codebase SearchSearch local repositories on disk
GitHub SearchSearch public GitHub repos without cloning
StreamingStream search steps back in real-time

When to Use WarpGrep

  • Use WarpGrep when your agent needs to explore unfamiliar code, find implementations across multiple files, or locate code by description (e.g., ‘find the auth middleware’).
  • Use raw grep for simple, one-off pattern matches where you already know exactly what to search for.
WarpGrep’s SDK is TypeScript/Node.js only. Python developers can use the raw API protocol or the Python guide.

Prerequisites

Install the SDK:
npm install @morphllm/morphsdk
For Codebase Search, you also need ripgrep — install via your package manager (brew install ripgrep, apt-get install ripgrep, or choco install ripgrep). GitHub Search runs fully on the cloud, no dependencies needed. Get your API key from the Morph Dashboard.
WarpGrep works in sandboxed environments. Use remoteCommands to search code in Vercel Sandbox, Cloudflare, E2B, and more.

Quick Start

Save the following as search.ts:
import { MorphClient } from '@morphllm/morphsdk';

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

  const result = await morph.warpGrep.execute({
    searchTerm: 'Find authentication middleware',
    repoRoot: '.'
  });

  if (result.success) {
    for (const ctx of result.contexts) {
      console.log(`File: ${ctx.file}`);
      console.log(ctx.content);
    }
  }
}

main();
Install dependencies and run:
npm install @morphllm/morphsdk
npx tsx search.ts
Expected output:
File: src/auth/middleware.ts
export function authMiddleware(req, res, next) {
  const token = req.headers.authorization;
  ...
}
repoRoot is relative to where you run your script. Use an absolute path (e.g., path.resolve('./myproject')) to avoid searching the wrong directory.

Pricing

TypePrice
Input$0.80 per 1M tokens
Output$0.80 per 1M tokens

Next Steps

Add WarpGrep to Your Agent

Add WarpGrep as a tool to your Anthropic, OpenAI, or Vercel AI SDK agent.