From 2ee279a977745d0f4e3919fdf0f06471fe0d3293 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Tue, 26 Nov 2024 11:26:18 -0800 Subject: [PATCH 01/12] fix(sdk-js): Add typing for interrupts on threads --- libs/sdk-js/src/schema.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 1b9dae1fe..8884708e4 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -137,6 +137,16 @@ export interface AssistantGraph { }>; } +/** + * An interrupt thrown inside a thread. + */ +export interface Interrupt { + value: unknown; + when: "during"; + resumable: boolean; + ns?: string[]; +} + export interface Thread { /** The ID of the thread. */ thread_id: string; @@ -155,6 +165,9 @@ export interface Thread { /** The current state of the thread. */ values: ValuesType; + + /** Interrupts which were thrown in this thread */ + interrupts: {} | { [id: string]: Array }; } export interface Cron { @@ -210,12 +223,7 @@ export interface ThreadTask { name: string; result?: unknown; error: Optional; - interrupts: Array<{ - value: unknown; - when: "during"; - resumable: boolean; - ns?: string[]; - }>; + interrupts: Array; checkpoint: Optional; state: Optional; } From 58b99c899e383114d789feb46abb2982bd61b124 Mon Sep 17 00:00:00 2001 From: bracesproul Date: Tue, 26 Nov 2024 11:28:19 -0800 Subject: [PATCH 02/12] cr --- libs/sdk-js/src/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sdk-js/src/schema.ts b/libs/sdk-js/src/schema.ts index 8884708e4..dd79e07ba 100644 --- a/libs/sdk-js/src/schema.ts +++ b/libs/sdk-js/src/schema.ts @@ -167,7 +167,7 @@ export interface Thread { values: ValuesType; /** Interrupts which were thrown in this thread */ - interrupts: {} | { [id: string]: Array }; + interrupts: Record>; } export interface Cron { From 376c58ff3b48abdafa5a68195264f8b68687af0c Mon Sep 17 00:00:00 2001 From: bracesproul Date: Tue, 26 Nov 2024 11:28:50 -0800 Subject: [PATCH 03/12] expose interupt type --- libs/sdk-js/src/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/sdk-js/src/index.ts b/libs/sdk-js/src/index.ts index f86406100..764abbc67 100644 --- a/libs/sdk-js/src/index.ts +++ b/libs/sdk-js/src/index.ts @@ -15,6 +15,7 @@ export type { ThreadStatus, Cron, Checkpoint, + Interrupt, } from "./schema.js"; export type { OnConflictBehavior, Command } from "./types.js"; From d3a4865c0e7bd9b4db455549d4b193b41803592d Mon Sep 17 00:00:00 2001 From: bracesproul Date: Tue, 26 Nov 2024 11:42:20 -0800 Subject: [PATCH 04/12] release(sdk-js): 0.0.27 --- libs/sdk-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sdk-js/package.json b/libs/sdk-js/package.json index bc37a9d4e..3e880cee7 100644 --- a/libs/sdk-js/package.json +++ b/libs/sdk-js/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/langgraph-sdk", - "version": "0.0.26", + "version": "0.0.27", "description": "Client library for interacting with the LangGraph API", "type": "module", "packageManager": "yarn@1.22.19", From 16b955dee209f36ff19f7f3367725b538a75cd99 Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Tue, 26 Nov 2024 12:30:33 -0800 Subject: [PATCH 05/12] Adds fallback for fetching environment variables --- libs/sdk-js/src/client.ts | 3 ++- libs/sdk-js/src/utils/env.ts | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 libs/sdk-js/src/utils/env.ts diff --git a/libs/sdk-js/src/client.ts b/libs/sdk-js/src/client.ts index 4829a831f..010864419 100644 --- a/libs/sdk-js/src/client.ts +++ b/libs/sdk-js/src/client.ts @@ -33,6 +33,7 @@ import { OnConflictBehavior, } from "./types.js"; import { mergeSignals } from "./utils/signals.js"; +import { getEnvironmentVariable } from "./utils/env.js"; /** * Get the API key from the environment. @@ -53,7 +54,7 @@ export function getApiKey(apiKey?: string): string | undefined { const prefixes = ["LANGGRAPH", "LANGSMITH", "LANGCHAIN"]; for (const prefix of prefixes) { - const envKey = process.env[`${prefix}_API_KEY`]; + const envKey = getEnvironmentVariable(`${prefix}_API_KEY`); if (envKey) { // Remove surrounding quotes return envKey.trim().replace(/^["']|["']$/g, ""); diff --git a/libs/sdk-js/src/utils/env.ts b/libs/sdk-js/src/utils/env.ts new file mode 100644 index 000000000..738c14fd5 --- /dev/null +++ b/libs/sdk-js/src/utils/env.ts @@ -0,0 +1,11 @@ +export function getEnvironmentVariable(name: string): string | undefined { + // Certain setups (Deno, frontend) will throw an error if you try to access environment variables + try { + return typeof process !== "undefined" + ? // eslint-disable-next-line no-process-env + process.env?.[name] + : undefined; + } catch (e) { + return undefined; + } +} From c6a953c02a5e00189c4298f4ec2bf3fdd16e832a Mon Sep 17 00:00:00 2001 From: jacoblee93 Date: Tue, 26 Nov 2024 12:31:00 -0800 Subject: [PATCH 06/12] Bump version --- libs/sdk-js/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sdk-js/package.json b/libs/sdk-js/package.json index 3e880cee7..e1ce9e4ed 100644 --- a/libs/sdk-js/package.json +++ b/libs/sdk-js/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/langgraph-sdk", - "version": "0.0.27", + "version": "0.0.28", "description": "Client library for interacting with the LangGraph API", "type": "module", "packageManager": "yarn@1.22.19", From 5144b8f374dd18d7ebd8ab6b75b73685b8e1ea62 Mon Sep 17 00:00:00 2001 From: Vadym Barda Date: Wed, 27 Nov 2024 12:54:59 -0500 Subject: [PATCH 07/12] langgraph: allow create_react_agent to take empty tools (#2553) --- .../langgraph/prebuilt/chat_agent_executor.py | 40 +++++++++++++------ libs/langgraph/tests/test_prebuilt.py | 3 ++ 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py index fc812ccbc..4c8699360 100644 --- a/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py +++ b/libs/langgraph/langgraph/prebuilt/chat_agent_executor.py @@ -212,6 +212,7 @@ def create_react_agent( Args: model: The `LangChain` chat model that supports tool calling. tools: A list of tools, a ToolExecutor, or a ToolNode instance. + If an empty list is provided, the agent will consist of a single LLM node without tool calling. state_schema: An optional state schema that defines graph state. Must have `messages` and `is_last_step` keys. Defaults to `AgentState` that defines those two keys. @@ -540,19 +541,10 @@ def create_react_agent( # get the tool functions wrapped in a tool class from the ToolNode tool_classes = list(tool_node.tools_by_name.values()) - if _should_bind_tools(model, tool_classes): - model = cast(BaseChatModel, model).bind_tools(tool_classes) + tool_calling_enabled = len(tool_classes) > 0 - # Define the function that determines whether to continue or not - def should_continue(state: AgentState) -> Literal["tools", "__end__"]: - messages = state["messages"] - last_message = messages[-1] - # If there is no function call, then we finish - if not isinstance(last_message, AIMessage) or not last_message.tool_calls: - return "__end__" - # Otherwise if there is, we continue - else: - return "tools" + if _should_bind_tools(model, tool_classes) and tool_calling_enabled: + model = cast(BaseChatModel, model).bind_tools(tool_classes) # we're passing store here for validation preprocessor = _get_model_preprocessing_runnable( @@ -635,6 +627,30 @@ def create_react_agent( # We return a list, because this will get added to the existing list return {"messages": [response]} + if not tool_calling_enabled: + # Define a new graph + workflow = StateGraph(state_schema or AgentState) + workflow.add_node("agent", RunnableCallable(call_model, acall_model)) + workflow.set_entry_point("agent") + return workflow.compile( + checkpointer=checkpointer, + store=store, + interrupt_before=interrupt_before, + interrupt_after=interrupt_after, + debug=debug, + ) + + # Define the function that determines whether to continue or not + def should_continue(state: AgentState) -> Literal["tools", "__end__"]: + messages = state["messages"] + last_message = messages[-1] + # If there is no function call, then we finish + if not isinstance(last_message, AIMessage) or not last_message.tool_calls: + return "__end__" + # Otherwise if there is, we continue + else: + return "tools" + # Define a new graph workflow = StateGraph(state_schema or AgentState) diff --git a/libs/langgraph/tests/test_prebuilt.py b/libs/langgraph/tests/test_prebuilt.py index a6655a451..0997668b2 100644 --- a/libs/langgraph/tests/test_prebuilt.py +++ b/libs/langgraph/tests/test_prebuilt.py @@ -102,6 +102,9 @@ class FakeToolCallingModel(BaseChatModel): tools: Sequence[Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool]], **kwargs: Any, ) -> Runnable[LanguageModelInput, BaseMessage]: + if len(tools) == 0: + raise ValueError("Must provide at least one tool") + tool_dicts = [] for tool in tools: if not isinstance(tool, BaseTool): From 7ac365ea846046eb905a4a2fe2aff67381c1dd9f Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Wed, 27 Nov 2024 11:33:23 -0800 Subject: [PATCH 08/12] fix(sdk-js): Avoid retrying 402s (#2554) --- libs/sdk-js/package.json | 2 +- libs/sdk-js/src/utils/async_caller.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/sdk-js/package.json b/libs/sdk-js/package.json index e1ce9e4ed..ded99a00b 100644 --- a/libs/sdk-js/package.json +++ b/libs/sdk-js/package.json @@ -1,6 +1,6 @@ { "name": "@langchain/langgraph-sdk", - "version": "0.0.28", + "version": "0.0.29", "description": "Client library for interacting with the LangGraph API", "type": "module", "packageManager": "yarn@1.22.19", diff --git a/libs/sdk-js/src/utils/async_caller.ts b/libs/sdk-js/src/utils/async_caller.ts index d58823ba4..d5de9131a 100644 --- a/libs/sdk-js/src/utils/async_caller.ts +++ b/libs/sdk-js/src/utils/async_caller.ts @@ -4,6 +4,7 @@ import PQueueMod from "p-queue"; const STATUS_NO_RETRY = [ 400, // Bad Request 401, // Unauthorized + 402, // Payment required 403, // Forbidden 404, // Not Found 405, // Method Not Allowed From 1031e54860c5617e9104592cfa057ee371acc152 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 27 Nov 2024 12:44:31 -0800 Subject: [PATCH 09/12] lib: Add exception note identify node/task --- libs/langgraph/langgraph/pregel/algo.py | 8 ++++++++ libs/langgraph/langgraph/pregel/retry.py | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/libs/langgraph/langgraph/pregel/algo.py b/libs/langgraph/langgraph/pregel/algo.py index 1410e432f..3c3008ce4 100644 --- a/libs/langgraph/langgraph/pregel/algo.py +++ b/libs/langgraph/langgraph/pregel/algo.py @@ -1,3 +1,4 @@ +import sys from collections import defaultdict, deque from functools import partial from hashlib import sha1 @@ -66,6 +67,7 @@ from langgraph.types import All, LoopProtocol, PregelExecutableTask, PregelTask from langgraph.utils.config import merge_configs, patch_config GetNextVersion = Callable[[Optional[V], BaseChannel], V] +SUPPORTS_EXC_NOTES = sys.version_info >= (3, 11) class WritesProtocol(Protocol): @@ -634,6 +636,12 @@ def prepare_single_task( ) except StopIteration: return + except Exception as exc: + if SUPPORTS_EXC_NOTES: + exc.add_note( + f"Before task with name '{name}' and path '{task_path[:3]}'" + ) + raise # create task id checkpoint_ns = f"{parent_ns}{NS_SEP}{name}" if parent_ns else name diff --git a/libs/langgraph/langgraph/pregel/retry.py b/libs/langgraph/langgraph/pregel/retry.py index 6e52a7c41..2d0f2b6da 100644 --- a/libs/langgraph/langgraph/pregel/retry.py +++ b/libs/langgraph/langgraph/pregel/retry.py @@ -1,6 +1,7 @@ import asyncio import logging import random +import sys import time from dataclasses import replace from functools import partial @@ -18,6 +19,7 @@ from langgraph.types import Command, PregelExecutableTask, RetryPolicy from langgraph.utils.config import patch_configurable logger = logging.getLogger(__name__) +SUPPORTS_EXC_NOTES = sys.version_info >= (3, 11) def run_with_retry( @@ -60,6 +62,8 @@ def run_with_retry( # if interrupted, end raise except Exception as exc: + if SUPPORTS_EXC_NOTES: + exc.add_note(f"During task with name '{task.name}' and id '{task.id}'") if retry_policy is None: raise # increment attempts @@ -152,6 +156,8 @@ async def arun_with_retry( # if interrupted, end raise except Exception as exc: + if SUPPORTS_EXC_NOTES: + exc.add_note(f"During task with name '{task.name}' and id '{task.id}'") if retry_policy is None: raise # increment attempts From dc09b134007c2a8c054b4db6ff09cf779366ebd0 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 27 Nov 2024 14:10:50 -0800 Subject: [PATCH 10/12] sdk-py: Fix SSE parsing to split lines only \n \r \r\n per SSE spec --- libs/sdk-py/langgraph_sdk/client.py | 5 +- libs/sdk-py/langgraph_sdk/sse.py | 106 ++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 libs/sdk-py/langgraph_sdk/sse.py diff --git a/libs/sdk-py/langgraph_sdk/client.py b/libs/sdk-py/langgraph_sdk/client.py index 6a3bb6c9c..a018bb3b6 100644 --- a/libs/sdk-py/langgraph_sdk/client.py +++ b/libs/sdk-py/langgraph_sdk/client.py @@ -59,6 +59,7 @@ from langgraph_sdk.schema import ( ThreadStatus, ThreadUpdateStateResponse, ) +from langgraph_sdk.sse import EventSource logger = logging.getLogger(__name__) @@ -292,7 +293,7 @@ class HttpClient: else: logger.error(f"Error from langgraph-api: {body}", exc_info=e) raise e - async for event in sse.aiter_sse(): + async for event in EventSource(sse.response).aiter_sse(): yield StreamPart( event.event, orjson.loads(event.data) if event.data else None ) @@ -2426,7 +2427,7 @@ class SyncHttpClient: else: logger.error(f"Error from langgraph-api: {body}", exc_info=e) raise e - for event in sse.iter_sse(): + for event in EventSource(sse.response).iter_sse(): yield StreamPart( event.event, orjson.loads(event.data) if event.data else None ) diff --git a/libs/sdk-py/langgraph_sdk/sse.py b/libs/sdk-py/langgraph_sdk/sse.py new file mode 100644 index 000000000..b87788387 --- /dev/null +++ b/libs/sdk-py/langgraph_sdk/sse.py @@ -0,0 +1,106 @@ +"""Adapted from httpx_sse to split lines on \n, \r, \r\n per the SSE spec.""" + +import io +from typing import AsyncIterator, Iterator + +import httpx +import httpx_sse +import httpx_sse._decoders + + +class BytesLineDecoder: + """ + Handles incrementally reading lines from text. + + Has the same behaviour as the stdllib bytes splitlines, + but handling the input iteratively. + """ + + def __init__(self) -> None: + self.buffer = io.BytesIO() + self.trailing_cr: bool = False + + def decode(self, text: bytes) -> list[bytes]: + # See https://docs.python.org/3/glossary.html#term-universal-newlines + NEWLINE_CHARS = b"\n\r" + + # We always push a trailing `\r` into the next decode iteration. + if self.trailing_cr: + text = b"\r" + text + self.trailing_cr = False + if text.endswith(b"\r"): + self.trailing_cr = True + text = text[:-1] + + if not text: + # NOTE: the edge case input of empty text doesn't occur in practice, + # because other httpx internals filter out this value + return [] # pragma: no cover + + trailing_newline = text[-1] in NEWLINE_CHARS + lines = text.splitlines() + + if len(lines) == 1 and not trailing_newline: + # No new lines, buffer the input and continue. + self.buffer.append(lines[0]) + return [] + + if self.buffer: + # Include any existing buffer in the first portion of the + # splitlines result. + lines = [self.buffer.getvalue() + lines[0]] + lines[1:] + self.buffer.truncate(0) + + if not trailing_newline: + # If the last segment of splitlines is not newline terminated, + # then drop it from our output and start a new buffer. + self.buffer.write(lines.pop()) + + return lines + + def flush(self) -> list[bytes]: + if not self.buffer and not self.trailing_cr: + return [] + + lines = [self.buffer.getvalue()] if self.buffer else [] + self.buffer.truncate(0) + self.trailing_cr = False + return lines + + +async def aiter_lines_raw(response: httpx.Response) -> AsyncIterator[bytes]: + decoder = BytesLineDecoder() + async for chunk in response.aiter_bytes(): + for line in decoder.decode(chunk): + yield line + for line in decoder.flush(): + yield line + + +def iter_lines_raw(response: httpx.Response) -> Iterator[bytes]: + decoder = BytesLineDecoder() + for chunk in response.iter_bytes(): + for line in decoder.decode(chunk): + yield line + for line in decoder.flush(): + yield line + + +class EventSource(httpx_sse.EventSource): + async def aiter_sse(self) -> AsyncIterator[httpx_sse.ServerSentEvent]: + self._check_content_type() + decoder = httpx_sse._decoders.SSEDecoder() + async for line in aiter_lines_raw(self._response): + line = line.rstrip(b"\n") + sse = decoder.decode(line.decode()) + if sse is not None: + yield sse + + def iter_sse(self) -> Iterator[httpx_sse.ServerSentEvent]: + self._check_content_type() + decoder = httpx_sse._decoders.SSEDecoder() + for line in iter_lines_raw(self._response): + line = line.rstrip(b"\n") + sse = decoder.decode(line.decode()) + if sse is not None: + yield sse From 1d9a0d1e4e8d1443aebc54fccd1061ec144114e6 Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Wed, 27 Nov 2024 14:17:03 -0800 Subject: [PATCH 11/12] sdk-py 0.1.37 --- libs/sdk-py/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sdk-py/pyproject.toml b/libs/sdk-py/pyproject.toml index 393750ba6..c9e0401da 100644 --- a/libs/sdk-py/pyproject.toml +++ b/libs/sdk-py/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langgraph-sdk" -version = "0.1.36" +version = "0.1.37" description = "SDK for interacting with LangGraph API" authors = [] license = "MIT" From dfaff2511b73d03329325f6628733b6c02ea624f Mon Sep 17 00:00:00 2001 From: Andrew Nguonly Date: Wed, 27 Nov 2024 14:39:12 -0800 Subject: [PATCH 12/12] docs: Update API docs and remove unused pages (#2561) --- .../cloud/reference/api/open_agent_api.json | 2071 ----------------- .../reference/api/open_agent_api_ref.html | 19 - docs/docs/cloud/reference/api/openapi.json | 21 +- 3 files changed, 15 insertions(+), 2096 deletions(-) delete mode 100644 docs/docs/cloud/reference/api/open_agent_api.json delete mode 100644 docs/docs/cloud/reference/api/open_agent_api_ref.html diff --git a/docs/docs/cloud/reference/api/open_agent_api.json b/docs/docs/cloud/reference/api/open_agent_api.json deleted file mode 100644 index f78bd420e..000000000 --- a/docs/docs/cloud/reference/api/open_agent_api.json +++ /dev/null @@ -1,2071 +0,0 @@ -{ - "openapi": "3.1.0", - "info": { - "title": "Open Assistants API Specification", - "version": "1.0.0" - }, - "tags": [ - { - "name": "Templates", - "description": "A template is the cognitive architecture of an assistant." - }, - { - "name": "Assistants", - "description": "An assistant is a configured instance of a template." - }, - { - "name": "Threads", - "description": "A thread contains the accumulated outputs of a group of runs. The outputs are persisted to a thread's state." - }, - { - "name": "Runs", - "description": "A run is an invocation of an assistant. The output of a run is persisted to a thread's state." - }, - { - "name": "Runs (Threadless)", - "description": "A run is an invocation of an assistant. The output of a threadless run is not persisted to any thread state." - } - ], - "paths": { - "/templates": { - "get": { - "tags": [ - "Templates" - ], - "summary": "List Templates", - "description": "List all templates.", - "operationId": "templates_get", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Template" - }, - "type": "array" - } - } - } - } - } - } - }, - "/assistants": { - "post": { - "tags": [ - "Assistants" - ], - "summary": "Create Assistant", - "description": "Create an assistant.\n\nAn initial version of the assistant will be created and the assistant is set to that version. To change versions, use the `PATCH /assistants/{assistant_id}/` endpoint.", - "operationId": "assistants_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Assistant" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/assistants/search": { - "post": { - "tags": [ - "Assistants" - ], - "summary": "Search Assistants", - "description": "Search for assistants.\n\nThis endpoint also functions as the endpoint to list all assistants (omit `metadata` and `template_id`). The API specification does not specify how the search is implemented.", - "operationId": "assistants_search_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantSearch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Assistant" - }, - "type": "array", - "title": "Response Search Assistants Assistants Search Post" - } - } - } - } - } - } - }, - "/assistants/{assistant_id}": { - "get": { - "tags": [ - "Assistants" - ], - "summary": "Get Assistant", - "description": "Get an assistant by ID.", - "operationId": "assistants__assistant_id__get", - "parameters": [ - { - "description": "The ID of the assistant.", - "required": true, - "schema": { - "type": "string", - "title": "Assistant ID", - "description": "The ID of the assistant." - }, - "name": "assistant_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Assistant" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "patch": { - "tags": [ - "Assistants" - ], - "summary": "Patch Assistant", - "description": "Patch an assistant by ID.", - "operationId": "assistants__assistant_id__patch", - "parameters": [ - { - "description": "The ID of the assistant.", - "required": true, - "schema": { - "type": "string", - "title": "Assistant ID", - "description": "The ID of the assistant." - }, - "name": "assistant_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantPatch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Assistant" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Assistants" - ], - "summary": "Delete Assistant", - "description": "Delete an assistant by ID.\n\nAll versions of the assistant will be deleted as well.", - "operationId": "assistants__assistant_id__delete", - "parameters": [ - { - "description": "The ID of the assistant.", - "required": true, - "schema": { - "type": "string", - "title": "Assistant ID", - "description": "The ID of the assistant." - }, - "name": "assistant_id", - "in": "path" - } - ], - "responses": { - "204": { - "description": "Success", - "content": { - "application/json": { - "schema": null - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/assistants/{assistant_id}/versions": { - "post": { - "tags": [ - "Assistants" - ], - "summary": "Create Assistant Version", - "description": "Create a new version of an assistant.\n\nAn assistant version is immutable. Assistant versions can only be created.", - "operationId": "assistants__assistant_id__versions_post", - "parameters": [ - { - "description": "The ID of the assistant.", - "required": true, - "schema": { - "type": "string", - "title": "Assistant Id", - "description": "The ID of the assistant." - }, - "name": "assistant_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantVersionCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Assistant" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/assistants/{assistant_id}/versions/search": { - "post": { - "tags": [ - "Assistants" - ], - "summary": "Search Assistant Versions", - "description": "Search for assistant versions.\n\nThis endpoint also functions as the endpoint to list all versions of an assistant (omit `metadata` and `template_id`). The API specification does not specify how the search is implemented.", - "operationId": "assistants__assistant_id__versions_search_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/AssistantSearch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Assistant" - }, - "type": "array", - "title": "Response Search Assistants Assistants Search Post" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/assistants/{assistant_id}/versions/{version}": { - "get": { - "tags": [ - "Assistants" - ], - "summary": "Get Assistant Version", - "description": "Get a version of an assistant.", - "operationId": "assistants__assistant_id__versions__version__get", - "parameters": [ - { - "description": "The ID of the assistant.", - "required": true, - "schema": { - "type": "string", - "title": "Assistant Id", - "description": "The ID of the assistant." - }, - "name": "assistant_id", - "in": "path" - }, - { - "description": "The version of the assistant.", - "required": true, - "schema": { - "type": "integer", - "title": "Version", - "description": "The version of the assistant." - }, - "name": "version", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Assistant" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads": { - "post": { - "tags": [ - "Threads" - ], - "summary": "Create Thread", - "description": "Create a thread.", - "operationId": "threads_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Thread" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/search": { - "post": { - "tags": [ - "Threads" - ], - "summary": "Search Threads", - "description": "Search for threads.\n\nThis endpoint also functions as the endpoint to list all threads (omit `metadata`, `values`, and `status`). The API specification does not specify how the search is implemented.", - "operationId": "threads_search_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadSearch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Thread" - }, - "type": "array", - "title": "Response Search Threads Threads Search Post" - } - } - } - } - } - } - }, - "/threads/{thread_id}": { - "get": { - "tags": [ - "Threads" - ], - "summary": "Get Thread", - "description": "Get a thread by ID.", - "operationId": "threads__thread_id__get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Thread Id", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Thread" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "patch": { - "tags": [ - "Threads" - ], - "summary": "Patch Thread", - "description": "Patch a thread by ID.", - "operationId": "threads__thread_id__patch", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread Id", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadPatch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Thread" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Threads" - ], - "summary": "Delete Thread", - "description": "Delete a thread by ID.", - "operationId": "threads__thread_id__delete", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread Id", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "responses": { - "204": { - "description": "Success", - "content": { - "application/json": { - "schema": null - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/state": { - "post": { - "tags": [ - "Threads" - ], - "summary": "Create Thread State", - "description": "Add state to a thread.", - "operationId": "threads__thread_id__state_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadStateCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadState" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "get": { - "tags": [ - "Threads" - ], - "summary": "Get Thread State", - "description": "Get state for a thread.\n\nThe latest state of the thread is returned.", - "operationId": "threads__thread_id__state_get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadState" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/state/search": { - "post": { - "tags": [ - "Threads" - ], - "summary": "Search Thread States", - "description": "Search for thread states.\n\nThis endpoint also functions as the endpoint to list all thread states (omit `metadata` and `checkpoint_id`). The API specification does not specify how the search is implemented.", - "operationId": "threads__thread_id__state_search_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "format": "uuid", - "title": "Thread Id", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ThreadStateSearch" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/ThreadState" - }, - "type": "array", - "title": "Response Get Thread History Post Threads Thread Id History Post" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs": { - "post": { - "tags": [ - "Runs" - ], - "summary": "Create Run", - "description": "Create a run and persist its output to a thread. Don't wait for the final output. Return immediately.", - "operationId": "threads__thread_id__runs_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Run" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "get": { - "tags": [ - "Runs" - ], - "summary": "List Runs", - "description": "Get runs for a thread.", - "operationId": "threads__thread_id__runs_get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "required": false, - "schema": { - "type": "integer", - "title": "Limit", - "default": 10 - }, - "name": "limit", - "in": "query" - }, - { - "required": false, - "schema": { - "type": "integer", - "title": "Offset", - "default": 0 - }, - "name": "offset", - "in": "query" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "items": { - "$ref": "#/components/schemas/Run" - }, - "type": "array" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/stream": { - "post": { - "tags": [ - "Runs" - ], - "summary": "Create Run, Stream Output", - "description": "Create a run and persist its output to a thread. Stream the output.", - "operationId": "threads__thread_id__runs_stream_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread Id", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "text/event-stream": { - "schema": { - "type": "string", - "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/wait": { - "post": { - "tags": [ - "Runs" - ], - "summary": "Create Run, Wait for Output", - "description": "Create a run and persist its output to a thread. Wait for the final output and then return.", - "operationId": "threads__thread_id__runs_wait_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunWaitOutput" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}": { - "get": { - "tags": [ - "Runs" - ], - "summary": "Get Run", - "description": "Get a run by ID.", - "operationId": "threads__thread_id__runs__run_id__get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "description": "The ID of the run.", - "required": true, - "schema": { - "type": "string", - "title": "Run ID", - "description": "The ID of the run." - }, - "name": "run_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Run" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": [ - "Runs" - ], - "summary": "Delete Run", - "description": "Delete a run by ID.", - "operationId": "threads__thread_id__runs__run_id__delete", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "description": "The ID of the run.", - "required": true, - "schema": { - "type": "string", - "title": "Run ID", - "description": "The ID of the run." - }, - "name": "run_id", - "in": "path" - } - ], - "responses": { - "204": { - "description": "Success", - "content": { - "application/json": { - "schema": null - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/cancel": { - "post": { - "tags": [ - "Runs" - ], - "summary": "Cancel Run", - "description": "Cancel a run by ID.", - "operationId": "threads__thread_id__runs__run_id__cancel_post", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "description": "The ID of the run.", - "required": true, - "schema": { - "type": "string", - "title": "Run ID", - "description": "The ID of the run." - }, - "name": "run_id", - "in": "path" - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCancel" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": null - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/stream": { - "get": { - "tags": [ - "Runs" - ], - "summary": "Stream Output of Run", - "description": "Stream the output of a run.\n\nOnly output produced after this endpoint is called will be streamed.", - "operationId": "threads__thread_id__runs__run_id__join_get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "description": "The ID of the run.", - "required": true, - "schema": { - "type": "string", - "title": "Run ID", - "description": "The ID of the run." - }, - "name": "run_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "text/event-stream": { - "schema": { - "type": "string", - "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/threads/{thread_id}/runs/{run_id}/wait": { - "get": { - "tags": [ - "Runs" - ], - "summary": "Wait for Output of Run", - "description": "Wait for the final output of a run and then return.", - "operationId": "threads__thread_id__runs__run_id__join_get", - "parameters": [ - { - "description": "The ID of the thread.", - "required": true, - "schema": { - "type": "string", - "title": "Thread ID", - "description": "The ID of the thread." - }, - "name": "thread_id", - "in": "path" - }, - { - "description": "The ID of the run.", - "required": true, - "schema": { - "type": "string", - "title": "Run ID", - "description": "The ID of the run." - }, - "name": "run_id", - "in": "path" - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunWaitOutput" - } - } - } - }, - "404": { - "description": "Not Found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/runs": { - "post": { - "tags": [ - "Runs (Threadless)" - ], - "summary": "Create Run", - "description": "Create a run without persisting its output to a thread. Don't wait for the final output. Return immediately.", - "operationId": "runs_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": null - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/runs/stream": { - "post": { - "tags": [ - "Runs (Threadless)" - ], - "summary": "Create Run, Stream Output", - "description": "Create a run without persisting its output to a thread. Stream the output.", - "operationId": "runs_stream_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "text/event-stream": { - "schema": { - "type": "string", - "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - }, - "/runs/wait": { - "post": { - "tags": [ - "Runs (Threadless)" - ], - "summary": "Create Run, Wait for Output", - "description": "Create a run without persisting its output to a thread. Wait for the final output and then return.", - "operationId": "runs_wait_post", - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunCreate" - } - } - }, - "required": true - }, - "responses": { - "201": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RunWaitOutput" - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "Template": { - "properties": { - "template_id": { - "type": "string", - "title": "Template ID" - } - }, - "type": "object", - "required": [ - "template_id" - ], - "title": "Template" - }, - "Assistant": { - "properties": { - "assistant_id": { - "type": "string", - "title": "Assistant ID" - }, - "template_id": { - "type": "string", - "title": "Template ID" - }, - "config": { - "type": "object", - "title": "Config" - }, - "metadata": { - "type": "object", - "title": "Metadata" - }, - "version": { - "type": "integer", - "title": "Version" - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "updated_at": { - "type": "string", - "format": "date-time", - "title": "Updated At" - } - }, - "type": "object", - "required": [ - "assistant_id", - "graph_id", - "config", - "created_at", - "updated_at", - "metadata" - ], - "title": "Assistant" - }, - "AssistantCreate": { - "properties": { - "assistant_id": { - "type": "string", - "title": "Assistant ID", - "description": "The ID of the assistant. If not provided, an ID is generated." - }, - "template_id": { - "type": "string", - "title": "Template ID", - "description": "The Template ID references an internal template implementation for the assistant." - }, - "config": { - "type": "object", - "title": "Config", - "description": "Arbitrary configuration for the assistant. The configuration may augment the behavior of the assistant depending on the referenced template." - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the assistant." - } - }, - "type": "object", - "required": [ - "template_id" - ], - "title": "AssistantCreate", - "description": "Payload for creating an assistant." - }, - "AssistantPatch": { - "properties": { - "version": { - "type": "integer", - "title": "Version", - "description": "Version to change to." - } - }, - "type": "integer", - "required": [ - "version" - ], - "title": "AssistantPatch", - "description": "Payload for patching an assistant." - }, - "AssistantSearch": { - "properties": { - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Metadata to search for." - }, - "template_id": { - "type": "string", - "title": "Template ID", - "description": "Filter by template ID." - }, - "limit": { - "type": "integer", - "title": "Limit", - "description": "Maximum number to return.", - "default": 10, - "minimum": 1, - "maximum": 1000 - }, - "offset": { - "type": "integer", - "title": "Offset", - "description": "Offset to start from.", - "default": 0, - "minimum": 0 - } - }, - "type": "object", - "title": "AssistantSearch", - "description": "Payload for searching for assistants or assistant versions." - }, - "AssistantVersionCreate": { - "properties": { - "template_id": { - "type": "string", - "title": "Template ID", - "description": "The Template ID references an internal template implementation for the assistant." - }, - "config": { - "type": "object", - "title": "Config", - "description": "Arbitrary configuration for the assistant. The configuration may augment the behavior of the assistant depending on the referenced template." - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the assistant." - } - }, - "type": "object", - "title": "AssistantVersionCreate", - "description": "Payload for creating an assistant version." - }, - "Thread": { - "properties": { - "thread_id": { - "type": "string", - "title": "Thread ID" - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the thread." - }, - "status": { - "type": "string", - "enum": [ - "idle", - "busy", - "interrupted", - "error" - ], - "title": "Status", - "description": "The status indicates the current state of the thread with respect to \"double texting\" use cases." - }, - "values": { - "type": "object", - "title": "Values", - "description": "Arbitrary state values persisted to the thread." - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "updated_at": { - "type": "string", - "format": "date-time", - "title": "Updated At" - } - }, - "type": "object", - "required": [ - "thread_id", - "created_at", - "updated_at", - "metadata", - "status" - ], - "title": "Thread" - }, - "ThreadCreate": { - "properties": { - "thread_id": { - "type": "string", - "title": "Thread Id", - "description": "The ID of the thread. If not provided, an ID is generated." - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the thread." - } - }, - "type": "object", - "title": "ThreadCreate", - "description": "Payload for creating a thread." - }, - "ThreadPatch": { - "properties": { - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the thread." - } - }, - "type": "object", - "title": "ThreadPatch", - "description": "Payload for patching a thread." - }, - "ThreadSearch": { - "properties": { - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Metadata to search for." - }, - "values": { - "type": "object", - "title": "Values", - "description": "State values to search for." - }, - "status": { - "type": "string", - "enum": [ - "idle", - "busy", - "interrupted", - "error" - ], - "title": "Status", - "description": "Status to search for.\n\nThe status indicates the current state of the thread with respect to \"double texting\" use cases." - }, - "limit": { - "type": "integer", - "title": "Limit", - "description": "Maximum number to return.", - "default": 10, - "minimum": 1, - "maximum": 1000 - }, - "offset": { - "type": "integer", - "title": "Offset", - "description": "Offset to start from.", - "default": 0, - "minimum": 0 - } - }, - "type": "object", - "title": "ThreadSearch", - "description": "Payload for searching for threads." - }, - "ThreadState": { - "properties": { - "values": { - "type": "object", - "title": "Values" - }, - "checkpoint": { - "type": "object", - "properties": { - "checkpoint_id": { - "type": "string", - "title": "Checkpoint ID", - "description": "The ID of the checkpoint." - } - }, - "title": "Checkpoint" - }, - "parent_checkpoint": { - "type": "object", - "properties": { - "checkpoint_id": { - "type": "string", - "title": "Checkpoint ID", - "description": "The ID of the checkpoint." - } - }, - "title": "Parent Checkpoint" - }, - "metadata": { - "type": "object", - "title": "Metadata" - }, - "created_at": { - "type": "string", - "title": "Created At" - } - }, - "type": "object", - "required": [ - "values", - "next", - "checkpoint", - "metadata", - "created_at" - ], - "title": "ThreadState" - }, - "ThreadStateCreate": { - "properties": { - "values": { - "type": "object", - "title": "Values" - }, - "checkpoint": { - "properties": { - "checkpoint_id": { - "type": "string", - "title": "Checkpoint ID", - "description": "The ID of the checkpoint." - } - }, - "type": "object", - "title": "Checkpoint" - } - }, - "type": "object", - "title": "ThreadStateCreate", - "description": "Payload for adding state to a thread." - }, - "ThreadStateSearch": { - "properties": { - "limit": { - "type": "integer", - "title": "Limit", - "description": "The maximum number of states to return.", - "default": 10, - "maximum": 1000, - "minimum": 1 - }, - "offset": { - "type": "string", - "title": "Before", - "description": "Return states before this checkpoint ID." - }, - "checkpoint_id": { - "type": "string", - "title": "Checkpoint ID", - "description": "Filter by checkpoint ID." - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Metadata to search for." - } - }, - "type": "object", - "title": "ThreadStateSearch" - }, - "Run": { - "properties": { - "run_id": { - "type": "string", - "title": "Run ID" - }, - "thread_id": { - "type": "string", - "title": "Thread ID" - }, - "assistant_id": { - "type": "string", - "title": "Assistant ID" - }, - "status": { - "type": "string", - "enum": [ - "pending", - "error", - "success", - "timeout", - "interrupted" - ], - "title": "Status" - }, - "metadata": { - "type": "object", - "title": "Metadata" - }, - "multitask_strategy": { - "type": "string", - "enum": [ - "reject", - "rollback", - "interrupt", - "enqueue" - ], - "title": "Multitask Strategy", - "description": "The multitask strategy determines the behavior of the run with respect to \"double texting\" use cases.", - "default": "reject" - }, - "created_at": { - "type": "string", - "format": "date-time", - "title": "Created At" - }, - "updated_at": { - "type": "string", - "format": "date-time", - "title": "Updated At" - } - }, - "type": "object", - "required": [ - "run_id", - "thread_id", - "assistant_id", - "created_at", - "updated_at", - "status", - "metadata", - "kwargs", - "multitask_strategy" - ], - "title": "Run" - }, - "RunCreate": { - "properties": { - "assistant_id": { - "type": "string", - "title": "Assistant Id" - }, - "input": { - "type": "object", - "title": "Input", - "description": "Arbitrary input for the run." - }, - "metadata": { - "type": "object", - "title": "Metadata", - "description": "Arbitrary metadata for the run." - }, - "config": { - "type": "object", - "title": "Config", - "description": "Arbitrary configuration for the run. The configuration may augment the behavior of the assistant depending on the referenced template." - }, - "interrupt_before": { - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "title": "Interrupt Before", - "description": "An arbitrary list of strings that determine how the assistant handles Human-in-the-Loop use cases for **BEFORE** execution workflows. The API specification does not specify the possible values of this field or the default value if Human-in-the-Loop use cases are not supported by the implementation." - }, - "interrupt_after": { - "type": "array", - "items": { - "type": "string" - }, - "default": [], - "title": "Interrupt After", - "description": "An arbitrary list of strings that determine how the assistant handles Human-in-the-Loop use cases for **AFTER** execution workflows. The API specification does not specify the possible values of this field or the default value if Human-in-the-Loop use cases are not supported by the implementation." - }, - "stream_mode": { - "type": "array", - "items": { - "type": "string", - "enum": [ - "values", - "messages", - "updates", - "debug", - "custom" - ] - }, - "title": "Stream Mode", - "default": [ - "values" - ] - }, - "multitask_strategy": { - "type": "string", - "enum": [ - "reject", - "rollback", - "interrupt", - "enqueue" - ], - "title": "Multitask Strategy", - "description": "The multitask strategy determines the behavior of the run with respect to \"double texting\" use cases.", - "default": "reject" - } - }, - "type": "object", - "required": [ - "assistant_id" - ], - "title": "RunCreate", - "description": "Payload for creating a run." - }, - "RunCancel": { - "properties": { - "wait": { - "type": "boolean", - "title": "Wait" - } - }, - "type": "object", - "required": [ - "wait" - ], - "title": "RunCancel", - "description": "Payload for cancelling a run." - }, - "RunWaitOutput": { - "type": "object", - "title": "RunWaitOutput" - }, - "ErrorResponse": { - "title": "ErrorResponse", - "description": "Response body for an error.", - "type": "object", - "properties": { - "detail": { - "type": "string", - "title": "Detail", - "description": "Detail of the error." - } - }, - "required": [ - "detail" - ] - } - } - } -} \ No newline at end of file diff --git a/docs/docs/cloud/reference/api/open_agent_api_ref.html b/docs/docs/cloud/reference/api/open_agent_api_ref.html deleted file mode 100644 index 3cec4ca09..000000000 --- a/docs/docs/cloud/reference/api/open_agent_api_ref.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - Open Assistants API Specification - - - - - - - - - diff --git a/docs/docs/cloud/reference/api/openapi.json b/docs/docs/cloud/reference/api/openapi.json index c16f2488d..3f2c20c9b 100644 --- a/docs/docs/cloud/reference/api/openapi.json +++ b/docs/docs/cloud/reference/api/openapi.json @@ -1557,8 +1557,11 @@ "200": { "description": "Success", "content": { - "application/json": { - "schema": {} + "text/event-stream": { + "schema": { + "type": "string", + "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" + } } } }, @@ -1905,8 +1908,11 @@ "200": { "description": "Success", "content": { - "application/json": { - "schema": {} + "text/event-stream": { + "schema": { + "type": "string", + "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" + } } } }, @@ -2143,8 +2149,11 @@ "200": { "description": "Success", "content": { - "application/json": { - "schema": {} + "text/event-stream": { + "schema": { + "type": "string", + "description": "The server will send a stream of events in SSE format.\n\n**Example event**:\n\nid: 1\n\nevent: message\n\ndata: {}" + } } } },