Skip to main content
Stream WarpGrep search steps back to your UI in real-time. WarpGrep streaming search steps

Why?

Use streaming when you want to show users what WarpGrep is doing as it works — progress indicators, “Searching for X…”, “Reading file Y…” messages. Skip it for background or batch searches where no user is watching. Streaming steps are not separate API calls — they are yields from the same search operation. Streaming adds zero latency overhead to the total search time. Each step shows the tool calls WarpGrep made on that turn before executing them locally. Streaming also works with searchGitHub — pass streamSteps: true the same way.
Pass streamSteps: true to get an AsyncGenerator that yields each turn’s tool calls before they execute.

Basic Usage

import { MorphClient } from '@morphllm/morphsdk';

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

const stream = morph.warpGrep.execute({
  searchTerm: 'Find authentication middleware',
  repoRoot: '.',
  streamSteps: true
});

for await (const step of stream) {
  console.log(`Turn ${step.turn}:`, step.toolCalls);
}

Step Format

Each yielded step contains the turn number and tool calls made:
type WarpGrepStep = {
  turn: number;  // 1-4
  toolCalls: Array<{
    name: string;       // "grep" | "read" | "list_directory" | "finish"
    arguments: Record<string, unknown>;
  }>;
};
Example output:
// Turn 1
{ turn: 1, toolCalls: [
  { name: "grep", arguments: { pattern: "auth", path: "src/" } },
  { name: "list_directory", arguments: { path: "src/auth" } }
]}

// Turn 2
{ turn: 2, toolCalls: [
  { name: "read", arguments: { path: "src/auth/middleware.ts", start: 1, end: 50 } }
]}

// Turn 3 (finish)
{ turn: 3, toolCalls: [
  { name: "finish", arguments: { files: [...] } }
]}
All types are importable from @morphllm/morphsdk. See the streaming example and GitHub streaming example for complete, runnable code.

Return Type

// streamSteps: true
AsyncGenerator<WarpGrepStep, WarpGrepResult, undefined>
// yield: WarpGrepStep (each turn), return: WarpGrepResult (final result)

// streamSteps: false (default)
Promise<WarpGrepResult>