From 110e2255c40509de6ec8a94bfa03d285ce6704fb Mon Sep 17 00:00:00 2001 From: Julian Engel Date: Mon, 5 Jan 2026 16:18:27 +0000 Subject: [PATCH] fix: pass custom tools via customTools parameter to pi-coding-agent SDK The SDK's tools parameter only accepts built-in tools (read, bash, edit, write). Custom clawdbot tools (browser, canvas, nodes, cron, etc.) were being filtered out, causing 'Tool not found' errors at runtime. Split tools into built-in and custom, passing them via the correct parameters. --- src/agents/pi-embedded-runner.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/agents/pi-embedded-runner.ts b/src/agents/pi-embedded-runner.ts index 1532de8c3..85429db53 100644 --- a/src/agents/pi-embedded-runner.ts +++ b/src/agents/pi-embedded-runner.ts @@ -409,6 +409,11 @@ export async function runEmbeddedPiAgent(params: { agentDir, ); + // Split tools into built-in (recognized by pi-coding-agent SDK) and custom (clawdbot-specific) + const builtInToolNames = new Set(["read", "bash", "edit", "write"]); + const builtInTools = tools.filter((t) => builtInToolNames.has(t.name)); + const customTools = tools.filter((t) => !builtInToolNames.has(t.name)); + const { session } = await createAgentSession({ cwd: resolvedWorkspace, agentDir, @@ -417,8 +422,10 @@ export async function runEmbeddedPiAgent(params: { model, thinkingLevel, systemPrompt, - // Custom tool set: extra bash/process + read image sanitization. - tools, + // Built-in tools recognized by pi-coding-agent SDK + tools: builtInTools, + // Custom clawdbot tools (browser, canvas, nodes, cron, etc.) + customTools, sessionManager, settingsManager, skills: promptSkills,