fix: subagent inherits parent agent's provider, model, and apiType

Spawned subagents now inherit the parent agent's LLM provider config
(apiType, apiKey, baseURL, model) via ToolContext instead of falling
back to process.env. This fixes failures when the parent agent is
configured via code (not env vars), especially with OpenAI-compatible
endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
idoubi
2026-04-04 00:25:08 +08:00
parent 85dff47d74
commit 366438d2ef
3 changed files with 18 additions and 7 deletions
+6
View File
@@ -191,6 +191,12 @@ export interface ToolInputSchema {
export interface ToolContext {
cwd: string
abortSignal?: AbortSignal
/** Parent agent's LLM provider (inherited by subagents) */
provider?: import('./providers/types.js').LLMProvider
/** Parent agent's model ID */
model?: string
/** Parent agent's API type */
apiType?: import('./providers/types.js').ApiType
}
export interface ToolResult {