From 3ffaad8b1a8ae5202b2b3a68d2c552e6c87cdc0d Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 6 May 2026 16:10:22 -0700 Subject: [PATCH] fix(agent-sdk): send {prompt: {text}} as followup body to match backend FollowupCreate The backend's followup endpoint expects a FollowupCreate payload with a nested prompt object ({prompt: {text: ...}}), not a flat {message: ...}. Public method signature followup(message: string) is unchanged - only the wire body changes. --- sdks/typescript-agent-sdk/src/session.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sdks/typescript-agent-sdk/src/session.ts b/sdks/typescript-agent-sdk/src/session.ts index 6f69a99783a..dfbf0a719f3 100644 --- a/sdks/typescript-agent-sdk/src/session.ts +++ b/sdks/typescript-agent-sdk/src/session.ts @@ -54,10 +54,11 @@ export class SessionHandle { /** Queue a follow-up message into the active run. */ async followup(message: string): Promise { + // Wire shape matches backend `FollowupCreate`: {prompt: {text: "..."}}. await requestJson(this._client, { method: "POST", path: `/v2/sessions/${encodeURIComponent(this.id)}/followup`, - body: { message }, + body: { prompt: { text: message } }, }); } @@ -78,7 +79,7 @@ export class SessionHandle { method: "GET", path: `/v2/sessions/${encodeURIComponent(this.id)}/runs`, query: { limit: options.limit, cursor: options.cursor }, - } + }, ); return { items: (data.items ?? []).map((info) => new Run(info, this._client)), @@ -88,10 +89,13 @@ export class SessionHandle { /** Snapshot of the full conversation across runs. */ async conversation(): Promise { - const data = await requestJson<{ turns: ConversationTurn[] }>(this._client, { - method: "GET", - path: `/v2/sessions/${encodeURIComponent(this.id)}/conversation`, - }); + const data = await requestJson<{ turns: ConversationTurn[] }>( + this._client, + { + method: "GET", + path: `/v2/sessions/${encodeURIComponent(this.id)}/conversation`, + }, + ); return data.turns ?? []; }