Skip to content

feat(tools): add WarpGrep codebase search tool#4763

Draft
DhruvBhatia0 wants to merge 1 commit intocrewAIInc:mainfrom
DhruvBhatia0:feat/warpgrep-tool
Draft

feat(tools): add WarpGrep codebase search tool#4763
DhruvBhatia0 wants to merge 1 commit intocrewAIInc:mainfrom
DhruvBhatia0:feat/warpgrep-tool

Conversation

@DhruvBhatia0
Copy link

Summary

  • Adds WarpGrepTool — a multi-turn codebase search tool powered by Morph's WarpGrep API
  • Users bring their own MORPH_API_KEY to search local codebases using an RL-trained grep navigation agent
  • The tool orchestrates a multi-turn loop: builds a file tree, sends it to the WarpGrep model, executes local ripgrep/read/list_directory commands as directed, and returns relevant code spans with file paths and line numbers

Details

  • 396 LOC — comparable to SerperDevTool (342 LOC), justified by multi-turn orchestration complexity
  • Subclasses BaseTool directly (same pattern as BraveSearchTool, ParallelSearchTool)
  • All magic numbers exposed as configurable fields (max_turns, api_timeout, rg_timeout, etc.)
  • Path traversal protection via _resolve_path
  • Deferred ripgrep check (first _run() call, not __init__)
  • Passes ruff check, ruff format, mypy --strict

Files changed

File Change
lib/crewai-tools/src/crewai_tools/tools/warpgrep_tool/warpgrep_tool.py New — main implementation
lib/crewai-tools/src/crewai_tools/tools/warpgrep_tool/__init__.py New — empty package init
lib/crewai-tools/src/crewai_tools/tools/warpgrep_tool/README.md New — usage docs
lib/crewai-tools/src/crewai_tools/tools/__init__.py Add WarpGrepTool export
lib/crewai-tools/src/crewai_tools/__init__.py Add WarpGrepTool export

Requirements

  • ripgrep (rg) must be installed on the host machine
  • MORPH_API_KEY environment variable (user-provided)
  • No new Python dependencies (uses requests, already in crewai-tools deps)

Test plan

  • 40 unit tests covering: init, tree building, XML parsing, ripgrep execution, file reading, directory listing, finish processing, happy path, multi-turn, API errors, max turns, path traversal (all passing)
  • ruff check — clean
  • ruff format — clean
  • mypy --strict — clean
  • from crewai_tools import WarpGrepTool — verified

🤖 Generated with Claude Code

Add multi-turn codebase search tool powered by Morph's WarpGrep API.
Users provide their own MORPH_API_KEY to search local codebases
using an RL-trained grep navigation agent. The tool orchestrates
a multi-turn loop: builds a file tree, sends it to the WarpGrep model,
executes local ripgrep/read/list_directory commands as directed by the
model, and returns relevant code spans with file paths and line numbers.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant