feat: enable parallel tool call batching
- Fix mangled system prompt rule 3 — now explicitly instructs batching - Add parallel_tool_calls: true to API body (required by many providers) - Strengthen batching language: #1 speed optimization, NEVER serialize
This commit is contained in:
@@ -76,7 +76,10 @@ function buildSystemPrompt(svc) {
|
|||||||
' - Fetch URLs: Use `browser` or `web_fetch` (NOT curl/wget)',
|
' - Fetch URLs: Use `browser` or `web_fetch` (NOT curl/wget)',
|
||||||
' Use bash ONLY for: tests, installs, git, systemctl, and commands no tool covers.',
|
' Use bash ONLY for: tests, installs, git, systemctl, and commands no tool covers.',
|
||||||
' Violating this rule wastes turns and bypasses caching.',
|
' Violating this rule wastes turns and bypasses caching.',
|
||||||
' tool calls in a single turn. Example: reading 3 files = 3 parallel calls in 1 turn, NOT 3 turns.',
|
'3. **BATCH independent calls.** ALWAYS emit multiple independent tool calls in a single turn.',
|
||||||
|
' Reading 3 files = 3 parallel calls in 1 turn, NOT 3 sequential turns.',
|
||||||
|
' Searching 2 patterns + reading 1 file = 3 calls in 1 turn. This is the #1 speed optimization.',
|
||||||
|
' NEVER serialize independent operations — the runtime executes them concurrently via Promise.all.',
|
||||||
'4. **No ghost chasing.** If a command fails (wrong path, file not found), do NOT retry the',
|
'4. **No ghost chasing.** If a command fails (wrong path, file not found), do NOT retry the',
|
||||||
' same command. Use `glob` or `ls` to find the correct path, then proceed.',
|
' same command. Use `glob` or `ls` to find the correct path, then proceed.',
|
||||||
'5. **Plan before acting.** For tasks requiring 3+ tool calls, think through the optimal sequence',
|
'5. **Plan before acting.** For tasks requiring 3+ tool calls, think through the optimal sequence',
|
||||||
@@ -551,6 +554,7 @@ export async function initBot(config, api, tools, skills, agents) {
|
|||||||
messages: loopMessages,
|
messages: loopMessages,
|
||||||
temperature: opts.temperature ?? 0.7,
|
temperature: opts.temperature ?? 0.7,
|
||||||
max_tokens: opts.maxTokens || 8192,
|
max_tokens: opts.maxTokens || 8192,
|
||||||
|
parallel_tool_calls: true,
|
||||||
};
|
};
|
||||||
if (toolSchemas.length) body.tools = toolSchemas;
|
if (toolSchemas.length) body.tools = toolSchemas;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user