Add web_search / web_fetch tools for pi-harness agents

pi ships no web tools and claude's WebSearch/WebFetch are Anthropic-server-side
(absent on local endpoints), so these are handler-owned: a new handler.webtool
module (httpx, already a dependency) exposed through the bridge extension the
same way as the memory tools. web_fetch is provider-free — GET, HTML stripped
to readable text, size-capped. web_search resolves SEARXNG_URL, then
BRAVE_SEARCH_API_KEY, then falls back to DuckDuckGo's HTML endpoint with zero
config. Verified live: a pi agent now advertises all 14 tools (7 built-ins +
ask_operator + 4 memory + 2 web).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KdGv3u3DfTsP1S188KDhVH
This commit is contained in:
Claude
2026-08-12 18:41:41 +00:00
parent 887576bf22
commit e5c8ebfd34
9 changed files with 485 additions and 7 deletions
+6
View File
@@ -32,6 +32,12 @@ AUTH_TOKEN=change-me-to-a-long-random-string
# Base directory under which per-project roots and agent worktrees live (isolation).
PROJECTS_ROOT=/var/lib/handler/projects
# Web search provider for the agents' web_search tool (pi harness). Resolution order:
# SearXNG instance -> Brave Search API -> unset = DuckDuckGo HTML fallback (zero-config,
# rate-limited). web_fetch needs no provider.
# SEARXNG_URL=http://searxng.lan:8080
# BRAVE_SEARCH_API_KEY=
# Binary overrides (defaults shown). Point at fakes in tests/CI.
# CLAUDE_BIN=claude
# PI_BIN=pi