Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 133 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,94 @@
}
}
},
"/threads/{thread_id}/runs/{run_id}/resume": {
"post": {
"tags": [
"Runs"
],
"summary": "Resume Run",
"description": "Resume an existing run on a thread, return the run ID immediately. Don't wait for the final run output.",
"operationId": "resume_run_http_threads__thread_id__runs__run_id__resume_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"
},
{
"description": "The ID of the run.",
"required": true,
"schema": {
"type": "string",
"format": "uuid",
"title": "Run Id",
"description": "The ID of the run."
},
"name": "run_id",
"in": "path"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RunResumeStateful"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "Success",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Run"
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"409": {
"description": "Conflict",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/threads/{thread_id}/runs/{run_id}/cancel": {
"post": {
"tags": [
Expand Down Expand Up @@ -1990,6 +2078,51 @@
"title": "RunCreateStateful",
"description": "Payload for creating a run."
},
"RunResumeStateful": {
"properties": {
"input": {
"anyOf": [
{
"type": "object"
},
{
"type": "array"
},
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "null"
}
],
"title": "Input",
"description": "The input to the graph to resume it from an interrupted state."
},
"messages": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Message"
},
"title": "Messages",
"description": "The messages to pass an input to the agent."
},
"after_seconds": {
"type": "integer",
"title": "After Seconds",
"description": "The number of seconds to wait before resuming the run. Use to resume runs in the future."
}
},
"type": "object",
"required": [],
"title": "RunResumeStateful",
"description": "Payload for resuming a run."
},
"RunWaitResponse": {
"type": "object",
"properties": {
Expand Down
18 changes: 18 additions & 0 deletions server/ap_server/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,24 @@ class RunCreateStateful(BaseModel):
)


class RunResumeStateful(BaseModel):
input: Optional[Union[Dict[str, Any], List, str, float, bool]] = Field(
None,
description="The input to the graph to resume it from an interrupted state.",
title="Input",
)
messages: Optional[List[Message]] = Field(
None,
description="The messages to pass an input to the agent.",
title="Messages",
)
after_seconds: Optional[int] = Field(
None,
description="The number of seconds to wait before resuming the run. Use to resume runs in the future.",
title="After Seconds",
)


class RunWaitResponse(BaseModel):
run: Optional[Run] = Field(None, description="The run information.", title="Run")
values: Optional[Dict[str, Any]] = Field(
Expand Down
20 changes: 20 additions & 0 deletions server/ap_server/routers/runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Optional,
Run,
RunCreateStateful,
RunResumeStateful,
RunWaitResponse,
ThreadsThreadIdRunsGetResponse,
UUID,
Expand Down Expand Up @@ -143,6 +144,25 @@ def cancel_run_http_threads__thread_id__runs__run_id__cancel_post(
pass


@router.post(
"/threads/{thread_id}/runs/{run_id}/resume",
response_model=Run,
responses={
"404": {"model": ErrorResponse},
"409": {"model": ErrorResponse},
"422": {"model": ErrorResponse},
},
tags=["Runs"],
)
def resume_run_http_threads__thread_id__runs__run_id__resume_post(
thread_id: UUID, run_id: UUID = ..., body: RunResumeStateful = ...
) -> Union[Run, ErrorResponse]:
"""
Resume Run
"""
pass


@router.get(
"/threads/{thread_id}/runs/{run_id}/stream",
response_model=Any,
Expand Down