Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ Create a `.env` file in the project root (or export these in your shell):
```bash
ANTHROPIC_API_KEY=<your-anthropic-api-key> # if using anthropic models
HF_TOKEN=<your-hugging-face-token>
GITHUB_TOKEN=<github-personal-access-token>
GITHUB_TOKEN=<github-personal-access-token>
EXA_API_KEY=<your-exa-api-key> # optional, enables the web_search tool
```
If no `HF_TOKEN` is set, the CLI will prompt you to paste one on first launch. To get a GITHUB_TOKEN follow the tutorial [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
If no `HF_TOKEN` is set, the CLI will prompt you to paste one on first launch. To get a GITHUB_TOKEN follow the tutorial [here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token). Setting `EXA_API_KEY` ([get a key](https://exa.ai/)) unlocks the `web_search` tool for general web lookups outside the HF ecosystem.

### Usage

Expand Down
16 changes: 16 additions & 0 deletions agent/core/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@
from agent.tools.plan_tool import PLAN_TOOL_SPEC, plan_tool_handler
from agent.tools.research_tool import RESEARCH_TOOL_SPEC, research_handler
from agent.tools.sandbox_tool import get_sandbox_tools
from agent.tools.web_search_tool import (
WEB_SEARCH_TOOL_SPEC,
web_search_enabled,
web_search_handler,
)

# NOTE: Private HF repo tool disabled - replaced by hf_repo_files and hf_repo_git
# from agent.tools.private_hf_repo_tools import (
Expand Down Expand Up @@ -363,6 +368,17 @@ def create_builtin_tools(local_mode: bool = False) -> list[ToolSpec]:
),
]

# Optional: Exa-backed general web search (enabled only when EXA_API_KEY is set)
if web_search_enabled():
tools.append(
ToolSpec(
name=WEB_SEARCH_TOOL_SPEC["name"],
description=WEB_SEARCH_TOOL_SPEC["description"],
parameters=WEB_SEARCH_TOOL_SPEC["parameters"],
handler=web_search_handler,
)
)

# Sandbox or local tools (highest priority)
if local_mode:
from agent.tools.local_tools import get_local_tools
Expand Down
8 changes: 8 additions & 0 deletions agent/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
)
from agent.tools.jobs_tool import HF_JOBS_TOOL_SPEC, HfJobsTool, hf_jobs_handler
from agent.tools.types import ToolResult
from agent.tools.web_search_tool import (
WEB_SEARCH_TOOL_SPEC,
web_search_enabled,
web_search_handler,
)

__all__ = [
"ToolResult",
Expand All @@ -36,4 +41,7 @@
"github_search_code_handler",
"HF_INSPECT_DATASET_TOOL_SPEC",
"hf_inspect_dataset_handler",
"WEB_SEARCH_TOOL_SPEC",
"web_search_enabled",
"web_search_handler",
]
1 change: 1 addition & 0 deletions agent/tools/research_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"github_read_file",
"hf_inspect_dataset",
"hf_repo_files",
"web_search",
}

RESEARCH_SYSTEM_PROMPT = """\
Expand Down
Loading