Skip to content

Build and run agents you can see, understand and trust.

feat(deps): make ripgrep an optional dependency (#1740)

Willow Lopez8d2e94be74a3
diff --git a/pyproject.toml b/pyproject.toml
index be1137758..58c233c98 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -43,7 +43,6 @@ dependencies = [
"aiofiles",
"tree_sitter",
"tree_sitter_bash",
- "ripgrep",
"jsonschema",
]
@@ -73,12 +72,18 @@ workspace = [
"aiodocker",
"e2b",
]
+# ------------ Tools ------------
+tools = [
+ "ripgrep",
+]
+
# ------------ Full ------------
full = [
"agentscope[models]",
"agentscope[service]",
"agentscope[storage]",
"agentscope[workspace]",
+ "agentscope[tools]",
]
# ------------ Development ------------
diff --git a/src/agentscope/tool/_builtin/_grep.py b/src/agentscope/tool/_builtin/_grep.py
index 48172a90c..1ec2b1fec 100644
--- a/src/agentscope/tool/_builtin/_grep.py
+++ b/src/agentscope/tool/_builtin/_grep.py
@@ -7,6 +7,7 @@ import shutil
from typing import Any, List, Literal
from .._base import ToolBase
+from ..._logging import logger
from ...permission import (
PermissionContext,
PermissionDecision,
@@ -159,6 +160,13 @@ class Grep(ToolBase):
def __init__(self) -> None:
"""Initialize the grep tool."""
self._rg_path = shutil.which("rg")
+ if self._rg_path is None:
+ logger.warning(
+ "ripgrep (rg) binary not found. To use the Grep tool, "
+ "install ripgrep: pip install agentscope[tools] or "
+ "brew install ripgrep / apt install ripgrep / "
+ "choco install ripgrep",
+ )
async def check_permissions(
self,