-
Notifications
You must be signed in to change notification settings - Fork 932
Description
Summary
When using the Copilot SDK with the Anthropic BYOK provider (sweagent-anthropic), invoking a custom agent via the Task tool crashes with:
Error: message on turn 0 event missing callId
Custom agents work correctly with the Copilot API provider (sweagent-capi).
Root Cause
The Anthropic provider's agentic loop calls tool callbacks with only the input argument:
// Anthropic provider (sweagent-anthropic) — tool_use handling:
const result = await toolCallback(toolUseBlock.input);
The Copilot API provider passes a second context argument containing toolCallId:
// Copilot API provider (sweagent-capi) — tool execution:
const result = await toolCallback(input, { toolCallId: "..." });
The custom agent tool implementation reads toolCallId from this second argument to set the subagent's agentId. That agentId becomes the callId on the first progress event (turn 0, kind: "message"). When toolCallId is undefined (Anthropic path), agentId is undefined, and the SDK's own validation throws.
Reproduction
- Configure a session with the Anthropic provider (BYOK API key, model e.g. claude-sonnet-4-5)
- Have the agent invoke a subagent via the Task tool
- Error: message on turn 0 event missing callId
Confirmed still broken on latest.