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.
This commit is contained in:
Julian Engel
2026-01-05 16:18:27 +00:00
committed by Peter Steinberger
parent ec26ad81be
commit 110e2255c4

View File

@@ -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,