feat: support parallel tool calling
When ParallelToolCalls is enabled in AgentConfig and the LLM returns 2+ tool calls, execute them concurrently via errgroup. Results are collected in original order for deterministic observe-phase behavior. Sequential execution remains the default. Parallel mode is opt-in per agent configuration to avoid side effects with stateful tools. Refactors executeToolCalls into composable helpers (runToolCall, executeSingleToolCall, executeToolCallsParallel) for testability. Fixes #707
This commit is contained in:
@@ -54,6 +54,10 @@ type AgentConfig struct {
|
||||
// The agent compresses older messages to stay within this limit,
|
||||
// preserving tool_call/tool_result pairs.
|
||||
MaxContextTokens int `json:"max_context_tokens,omitempty"`
|
||||
|
||||
// Whether to execute independent tool calls in parallel (default: false).
|
||||
// When enabled and the LLM returns multiple tool calls, they run concurrently via errgroup.
|
||||
ParallelToolCalls bool `json:"parallel_tool_calls,omitempty"`
|
||||
}
|
||||
|
||||
// SessionAgentConfig represents session-level agent configuration
|
||||
|
||||
Reference in New Issue
Block a user