Skip to content

Commit 5e5f3b8

Browse files
committed
fix: prefer sessionKey over label instead of rejecting both in sessions_send
LLMs consistently provide both optional sessionKey and label params when calling sessions_send, triggering an unnecessary "Provide either sessionKey or label (not both)" error. This breaks agent-to-agent communication across multiple models (GPT, Kimi, DeepSeek). When both are provided, prefer sessionKey and ignore label — the existing fallback logic already handles the label-only path correctly. Fixes #41199 (sessions_send portion)
1 parent 54be30e commit 5e5f3b8

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

src/agents/tools/sessions-send-tool.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,10 @@ export function createSessionsSendTool(opts?: {
6363
const sessionKeyParam = readStringParam(params, "sessionKey");
6464
const labelParam = readStringParam(params, "label")?.trim() || undefined;
6565
const labelAgentIdParam = readStringParam(params, "agentId")?.trim() || undefined;
66-
if (sessionKeyParam && labelParam) {
67-
return jsonResult({
68-
runId: crypto.randomUUID(),
69-
status: "error",
70-
error: "Provide either sessionKey or label (not both).",
71-
});
72-
}
7366

67+
// When both sessionKey and label are provided, prefer sessionKey.
68+
// LLMs frequently supply both optional params; rejecting that just
69+
// causes unnecessary tool-call failures.
7470
let sessionKey = sessionKeyParam;
7571
if (!sessionKey && labelParam) {
7672
const requesterAgentId = resolveAgentIdFromSessionKey(effectiveRequesterKey);

0 commit comments

Comments
 (0)