Skip to main content

Overview

WarpGrep is a code search agent that uses a multi-turn conversation to explore repositories. The model has its tools (grep_search, read, list_directory, glob, finish) built in — you do not need to pass a tools array in your requests.

Model

Use morph-warp-grep-v2.1 as the model identifier.

Message Format

WarpGrep uses a structured format in the initial user message with flat absolute paths:

Format Components

  • <repo_structure>: Flat list of absolute paths — repo root first, then all files/directories to depth 2. No indentation, no tree characters, no trailing / on directories.
  • <search_string>: Natural language description of what code to find

Example Request

See Direct API Access for the full protocol details including tool execution and multi-turn flow.

Multi-Turn Conversation

WarpGrep uses built-in tool calling (up to 6 turns). The agent will:
  1. Turn 1: Analyze your search query and call tools (grep_search, list_directory, glob) to explore
  2. Turns 2-5: Refine search based on results, read specific files
  3. Final turn: Call finish with code locations
You execute tool calls locally and return results as {role: "tool", tool_call_id: "...", content: "..."} messages.

Request Parameters

Tools are built into the model — you do not need to pass a tools parameter. The model will return tool_calls automatically.

Response Format

The agent responds with structured tool_calls:
After you execute tools and return results, the agent continues until it calls finish.
On tool-call turns the assistant content is null. Read only the tool_calls array.

Available Tools

WarpGrep uses five tools:
  • grep_search: Search for regex patterns across files. Case-insensitive by default.
  • read: Read file contents with optional line ranges
  • list_directory: Explore directory structure
  • glob: Find files by name/extension pattern (sorted by mtime)
  • finish: Submit final answer with code locations. Paths are absolute, matching the paths from the repo structure.
See the Direct API Guide for complete tool specifications.
Implement your tools to tolerate loose argument types. The model may send limit or case_sensitive as strings ("50", "false"), and grep_search may emit undocumented arguments such as output_lines (an alias for limit) or output_context_lines. Coerce known keys and ignore unrecognized ones rather than erroring. See the Direct API Guide for the full schema and robustness rules.

SDK Integration

For easier integration, use the WarpGrep SDK components:

Error Codes

Direct API Guide

Build your own WarpGrep harness

Python Implementation

Complete Python guide with examples