From b65d494c39210bc6beda8c77e71a5bf9976f677f Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 6 May 2026 16:10:28 -0700 Subject: [PATCH] refactor(agent-sdk): drop Run.conversation() and update terminal states There is no per-run conversation endpoint on the backend; conversation history is session-scoped. Callers should use SessionHandle.conversation() instead. Also update TERMINAL_STATES to the new RunStatus values (finished/cancelled/error). --- sdks/typescript-agent-sdk/src/run.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/sdks/typescript-agent-sdk/src/run.ts b/sdks/typescript-agent-sdk/src/run.ts index 9e5b5835601..a402e3aaa38 100644 --- a/sdks/typescript-agent-sdk/src/run.ts +++ b/sdks/typescript-agent-sdk/src/run.ts @@ -8,14 +8,13 @@ import { requestJson, type ResolvedClient } from "./client/http.js"; import { streamRunEvents } from "./client/sse.js"; import { LiteLLMAgentError, - type ConversationTurn, type RunEvent, type RunInfo, type RunResult, type RunStatus, } from "./types.js"; -const TERMINAL_STATES: RunStatus[] = ["completed", "failed", "cancelled"]; +const TERMINAL_STATES: RunStatus[] = ["finished", "cancelled", "error"]; const DEFAULT_WAIT_POLL_MS = 500; export class Run { @@ -102,17 +101,9 @@ export class Run { }; } - /** Snapshot of the conversation up through this run. */ - async conversation(): Promise { - const data = await requestJson<{ turns: ConversationTurn[] }>( - this._client, - { - method: "GET", - path: `/v2/sessions/${encodeURIComponent(this.sessionId)}/runs/${encodeURIComponent(this.id)}/conversation`, - }, - ); - return data.turns ?? []; - } + // NOTE: There is no per-run conversation endpoint on the backend. The + // conversation is session-scoped — call `session.conversation()` (on the + // owning `SessionHandle`) for the full turn history. /** Cancel a running run; no-op if already terminal. */ async cancel(): Promise {