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 -2
View File
@@ -143,6 +143,10 @@ completion gate never sees generated files:
normal answer/resume flow. Memory recall is injected at session start, and the memory
tools (`memory_search/get/save/link`) are registered directly — pi has no MCP by
design, so the bridge shells to `python -m handler.mcpserver --call <tool>` instead.
The bridge also registers **`web_search` / `web_fetch`** (`python -m handler.webtool`):
pi ships no web tools and claude's live server-side at Anthropic, so these are
handler-owned — fetch is plain HTTP + HTML-to-text with no provider needed, and search
resolves `SEARXNG_URL``BRAVE_SEARCH_API_KEY` → a zero-config DuckDuckGo fallback.
- **`APPEND_SYSTEM.md`** — the handler conventions (completion contract, ask_operator,
memory usage) appended to pi's system prompt.
@@ -158,8 +162,8 @@ whichever worker claims the resume, continued by launching pi again on the same
### What differs from the claude harness
- **MCP connectors and plugins don't apply** — pi has no MCP client or plugin system.
The bundled memory server is bridged as native tools; other connectors are
claude-harness-only for now.
The bundled memory server and the web tools are bridged as native tools; other
connectors are claude-harness-only for now.
- **Permission modes don't apply** — pi has no permission system. The hard gates
(PreToolUse-equivalent blocking, Stop gate) are enforced by the bridge, which is the
layer handler actually relies on for claude too.