Compare commits

..
Author SHA1 Message Date
Sydney Runkle 8086a20865 add test 2025-08-29 17:04:25 -04:00
Sydney Runkle fcfb9dd3a7 asyncio escape hatch 2025-08-29 17:02:03 -04:00
Sydney RunkleandGitHub 120ae38c12 chore(docs): fix runtime context link (#6043) 2025-08-29 13:45:39 -04:00
Isaac FranciscoandGitHub 22942d4eec release(sdk-py): 0.2.4 (#6038) 2025-08-28 23:34:33 +00:00
Isaac FranciscoandGitHub 1756ce1dd2 feat(sdk-py): add endpoint for thread streaming (#6009)
SDK support for:
https://github.com/langchain-ai/langgraph-api/pull/1217/
2025-08-28 16:12:04 +00:00
Isaac FranciscoandGitHub 0b4638269b feat(sdk-py): add durability flag (#5963) 2025-08-27 19:21:25 +00:00
Isaac FranciscoandGitHub 1ebdb1ba31 chore: Update schema for new config allowed in LGP (#5875) 2025-08-27 11:20:06 -07:00
hari-dhanushkodiandGitHub f3423c052e fix(docs): add revision queuing docs (#5997) 2025-08-27 07:47:45 -07:00
b63572ee16 chore: Update OpenAPI spec from LangGraph API v0.4.0 (#6011)
This PR updates the OpenAPI specification with changes detected from the
LangGraph API server.

**Changes detected as of LangGraph API version 0.4.0**

This update was automatically generated by the sync workflow in the
langgraph-api repository.

Co-authored-by: hinthornw <hinthornw@users.noreply.github.com>
2025-08-26 20:51:30 -07:00
11 changed files with 332 additions and 17 deletions
+2 -2
View File
@@ -99,8 +99,8 @@ Starting from the `LangGraph Platform` view...
1. In the top-right corner, select the gear icon (`Deployment Settings`).
1. Update the `Git Branch` to the desired branch.
1. Check/uncheck checkbox to `Automatically update deployment on push to branch`.
1. Branch creation/deletion and tag creation/deletion events will not trigger an update. Only pushes to an existing branch will trigger an update.
1. Pushes in quick succession to a branch will not trigger subsequent updates. In the future, this functionality may be changed/improved.
1. Branch creation/deletion and tag creation/deletion events will not trigger an update. Only pushes to an existing branch will trigger an update.
1. Pushes in quick succession to a branch will queue subsequent updates. Once a build completes, the most recent commit will begin building and the other queued builds will be skipped.
## Add or Remove GitHub Repositories
@@ -1520,6 +1520,73 @@
}
}
},
"/threads/{thread_id}/stream": {
"get": {
"tags": [
"Threads"
],
"summary": "Join Thread Stream",
"description": "This endpoint streams output in real-time from a thread. The stream will include the output of each run executed sequentially on the thread and will remain open indefinitely. It is the responsibility of the calling client to close the connection.",
"operationId": "join_thread_stream_threads__thread_id__stream_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"
},
{
"required": false,
"schema": {
"type": "string",
"title": "Last Event ID",
"description": "The ID of the last event received. Used to resume streaming from a specific point. Pass '-' to resume from the beginning."
},
"name": "Last-Event-ID",
"in": "header"
}
],
"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"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
}
}
}
}
}
}
},
"/threads/{thread_id}/runs": {
"get": {
"tags": [
+1 -1
View File
@@ -1040,7 +1040,7 @@ def node_a(state: State, runtime: Runtime[ContextSchema]):
...
```
See [this guide](../how-tos/graph-api.ipynb#add-runtime-configuration) for a full breakdown on configuration.
See [this guide](../how-tos/graph-api.md#add-runtime-configuration) for a full breakdown on configuration.
:::
:::js
+2
View File
@@ -357,6 +357,8 @@ class HttpConfig(TypedDict, total=False):
You can include or exclude headers as configurable values to condition your
agent's behavior or permissions on a request's headers."""
logging_headers: Optional[ConfigurableHeaderConfig]
"""Optional. Defines which headers are excluded from logging."""
class Config(TypedDict, total=False):
+11
View File
@@ -576,6 +576,17 @@
"disable_threads": {
"type": "boolean",
"description": "Optional. If True, /threads routes are removed.\n\nDefault is False.\n"
},
"logging_headers": {
"anyOf": [
{
"$ref": "#/$defs/ConfigurableHeaderConfig"
},
{
"type": "null"
}
],
"description": "Optional. Defines which headers are excluded from logging."
}
},
"required": []
+11
View File
@@ -576,6 +576,17 @@
"disable_threads": {
"type": "boolean",
"description": "Optional. If True, /threads routes are removed.\n\nDefault is False.\n"
},
"logging_headers": {
"anyOf": [
{
"$ref": "#/$defs/ConfigurableHeaderConfig"
},
{
"type": "null"
}
],
"description": "Optional. Defines which headers are excluded from logging."
}
},
"required": []
@@ -443,7 +443,12 @@ class ToolNode(RunnableCallable):
return invalid_tool_message
try:
call_args = {**call, **{"type": "tool_call"}}
response = self.tools_by_name[call["name"]].invoke(call_args, config)
tool = self.tools_by_name[call["name"]]
try:
response = tool.invoke(call_args, config)
except NotImplementedError:
response = asyncio.run(tool.ainvoke(call_args, config))
# GraphInterrupt is a special exception that will always be raised.
# It can be triggered in the following scenarios,
+33
View File
@@ -1156,3 +1156,36 @@ async def test_tool_node_command_remove_all_messages():
command = result[0]
assert isinstance(command, Command)
assert command.update == {"messages": [RemoveMessage(id=REMOVE_ALL_MESSAGES)]}
async def test_async_tool_called_syncly() -> None:
"""Confirm that async tools can be called synchronously."""
@dec_tool
async def async_tool():
"""An async tool."""
return "async tool"
tool_node = ToolNode([async_tool])
result = tool_node.invoke(
{
"messages": [
AIMessage(
content="",
tool_calls=[
{
"name": "async_tool",
"args": {},
"id": "1",
"type": "tool_call",
}
],
)
]
}
)
assert result == {
"messages": [
ToolMessage(content="async tool", name="async_tool", tool_call_id="1")
]
}
+1 -1
View File
@@ -1,6 +1,6 @@
from langgraph_sdk.auth import Auth
from langgraph_sdk.client import get_client, get_sync_client
__version__ = "0.2.3"
__version__ = "0.2.4"
__all__ = ["Auth", "get_client", "get_sync_client"]
+184 -12
View File
@@ -15,6 +15,7 @@ import logging
import os
import re
import sys
import warnings
from collections.abc import AsyncIterator, Iterator, Mapping, Sequence
from types import TracebackType
from typing import (
@@ -45,6 +46,7 @@ from langgraph_sdk.schema import (
CronSelectField,
CronSortBy,
DisconnectMode,
Durability,
GraphSchema,
IfNotExists,
Item,
@@ -69,6 +71,7 @@ from langgraph_sdk.schema import (
ThreadSortBy,
ThreadState,
ThreadStatus,
ThreadStreamMode,
ThreadUpdateStateResponse,
)
from langgraph_sdk.sse import SSEDecoder, aiter_lines_raw, iter_lines_raw
@@ -1682,6 +1685,53 @@ class ThreadsClient:
params=params,
)
async def join_stream(
self,
thread_id: str,
*,
last_event_id: str | None = None,
stream_mode: ThreadStreamMode | Sequence[ThreadStreamMode] = "run_modes",
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> AsyncIterator[StreamPart]:
"""Get a stream of events for a thread.
Args:
thread_id: The ID of the thread to get the stream for.
last_event_id: The ID of the last event to get.
headers: Optional custom headers to include with the request.
params: Optional query parameters to include with the request.
Returns:
Iterator[StreamPart]: An iterator of stream parts.
???+ example "Example Usage"
```python
for chunk in client.threads.join_stream(
thread_id="my_thread_id",
last_event_id="my_event_id",
):
print(chunk)
```
""" # noqa: E501
query_params = {
"stream_mode": stream_mode,
}
if params:
query_params.update(params)
return self.http.stream(
f"/threads/{thread_id}/stream",
"GET",
headers={
**({"Last-Event-ID": last_event_id} if last_event_id else {}),
**(headers or {}),
},
params=query_params,
)
class RunsClient:
"""Client for managing runs in LangGraph.
@@ -1772,7 +1822,7 @@ class RunsClient:
context: Context | None = None,
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
interrupt_before: All | Sequence[str] | None = None,
interrupt_after: All | Sequence[str] | None = None,
feedback_keys: Sequence[str] | None = None,
@@ -1785,6 +1835,7 @@ class RunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> AsyncIterator[StreamPart]:
"""Create a run and stream the results.
@@ -1804,7 +1855,7 @@ class RunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
feedback_keys: Feedback keys to assign to run.
@@ -1822,6 +1873,10 @@ class RunsClient:
headers: Optional custom headers to include with the request.
params: Optional query parameters to include with the request.
on_run_created: Callback when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
AsyncIterator[StreamPart]: Asynchronous iterator of stream results.
@@ -1857,6 +1912,13 @@ class RunsClient:
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -1881,6 +1943,7 @@ class RunsClient:
"on_disconnect": on_disconnect,
"on_completion": on_completion,
"after_seconds": after_seconds,
"durability": durability,
}
endpoint = (
f"/threads/{thread_id}/runs/stream"
@@ -1971,7 +2034,7 @@ class RunsClient:
context: Context | None = None,
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
interrupt_before: All | Sequence[str] | None = None,
interrupt_after: All | Sequence[str] | None = None,
webhook: str | None = None,
@@ -1982,6 +2045,7 @@ class RunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> Run:
"""Create a background run.
@@ -2001,7 +2065,7 @@ class RunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
webhook: Webhook to call after LangGraph API call is done.
@@ -2015,6 +2079,10 @@ class RunsClient:
Use to schedule future runs.
headers: Optional custom headers to include with the request.
on_run_created: Optional callback to call when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
Run: The created background run.
@@ -2090,6 +2158,12 @@ class RunsClient:
}
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -2112,6 +2186,7 @@ class RunsClient:
"if_not_exists": if_not_exists,
"on_completion": on_completion,
"after_seconds": after_seconds,
"durability": durability,
}
payload = {k: v for k, v in payload.items() if v is not None}
@@ -2209,7 +2284,7 @@ class RunsClient:
context: Context | None = None,
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
interrupt_before: All | Sequence[str] | None = None,
interrupt_after: All | Sequence[str] | None = None,
webhook: str | None = None,
@@ -2222,6 +2297,7 @@ class RunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> list[dict] | dict[str, Any]:
"""Create a run, wait until it finishes and return the final state.
@@ -2237,7 +2313,7 @@ class RunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
webhook: Webhook to call after LangGraph API call is done.
@@ -2253,6 +2329,10 @@ class RunsClient:
Use to schedule future runs.
headers: Optional custom headers to include with the request.
on_run_created: Optional callback to call when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
Union[list[dict], dict[str, Any]]: The output of the run.
@@ -2306,6 +2386,12 @@ class RunsClient:
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -2326,6 +2412,7 @@ class RunsClient:
"on_disconnect": on_disconnect,
"on_completion": on_completion,
"after_seconds": after_seconds,
"durability": durability,
}
endpoint = (
f"/threads/{thread_id}/runs/wait" if thread_id is not None else "/runs/wait"
@@ -4733,6 +4820,54 @@ class SyncThreadsClient:
params=params,
)
def join_stream(
self,
thread_id: str,
*,
stream_mode: ThreadStreamMode | Sequence[ThreadStreamMode] = "run_modes",
last_event_id: str | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> Iterator[StreamPart]:
"""Get a stream of events for a thread.
Args:
thread_id: The ID of the thread to get the stream for.
last_event_id: The ID of the last event to get.
headers: Optional custom headers to include with the request.
params: Optional query parameters to include with the request.
Returns:
Iterator[StreamPart]: An iterator of stream parts.
???+ example "Example Usage"
```python
for chunk in client.threads.join_stream(
thread_id="my_thread_id",
last_event_id="my_event_id",
stream_mode="run_modes",
):
print(chunk)
```
""" # noqa: E501
query_params = {
"stream_mode": stream_mode,
}
if params:
query_params.update(params)
return self.http.stream(
f"/threads/{thread_id}/stream",
"GET",
headers={
**({"Last-Event-ID": last_event_id} if last_event_id else {}),
**(headers or {}),
},
params=query_params,
)
class SyncRunsClient:
"""Synchronous client for managing runs in LangGraph.
@@ -4823,7 +4958,7 @@ class SyncRunsClient:
context: Context | None = None,
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
interrupt_before: All | Sequence[str] | None = None,
interrupt_after: All | Sequence[str] | None = None,
feedback_keys: Sequence[str] | None = None,
@@ -4836,6 +4971,7 @@ class SyncRunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> Iterator[StreamPart]:
"""Create a run and stream the results.
@@ -4855,7 +4991,7 @@ class SyncRunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
feedback_keys: Feedback keys to assign to run.
@@ -4872,6 +5008,11 @@ class SyncRunsClient:
Use to schedule future runs.
headers: Optional custom headers to include with the request.
on_run_created: Optional callback to call when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
Iterator[StreamPart]: Iterator of stream results.
@@ -4904,6 +5045,12 @@ class SyncRunsClient:
StreamPart(event='end', data=None)
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -4928,6 +5075,7 @@ class SyncRunsClient:
"on_disconnect": on_disconnect,
"on_completion": on_completion,
"after_seconds": after_seconds,
"durability": durability,
}
endpoint = (
f"/threads/{thread_id}/runs/stream"
@@ -5018,7 +5166,7 @@ class SyncRunsClient:
context: Context | None = None,
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
interrupt_before: All | Sequence[str] | None = None,
interrupt_after: All | Sequence[str] | None = None,
webhook: str | None = None,
@@ -5029,6 +5177,7 @@ class SyncRunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> Run:
"""Create a background run.
@@ -5048,7 +5197,7 @@ class SyncRunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
webhook: Webhook to call after LangGraph API call is done.
@@ -5062,6 +5211,10 @@ class SyncRunsClient:
Use to schedule future runs.
headers: Optional custom headers to include with the request.
on_run_created: Optional callback to call when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
Run: The created background run.
@@ -5137,6 +5290,12 @@ class SyncRunsClient:
}
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -5159,6 +5318,7 @@ class SyncRunsClient:
"if_not_exists": if_not_exists,
"on_completion": on_completion,
"after_seconds": after_seconds,
"durability": durability,
}
payload = {k: v for k, v in payload.items() if v is not None}
@@ -5254,7 +5414,7 @@ class SyncRunsClient:
metadata: Mapping[str, Any] | None = None,
config: Config | None = None,
context: Context | None = None,
checkpoint_during: bool | None = None,
checkpoint_during: bool | None = None, # deprecated
checkpoint: Checkpoint | None = None,
checkpoint_id: str | None = None,
interrupt_before: All | Sequence[str] | None = None,
@@ -5269,6 +5429,7 @@ class SyncRunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> list[dict] | dict[str, Any]:
"""Create a run, wait until it finishes and return the final state.
@@ -5284,7 +5445,7 @@ class SyncRunsClient:
context: Static context to add to the assistant.
!!! version-added "Supported with langgraph>=0.6.0"
checkpoint: The checkpoint to resume from.
checkpoint_during: Whether to checkpoint during the run (or only at the end/interruption).
checkpoint_during: (deprecated) Whether to checkpoint during the run (or only at the end/interruption).
interrupt_before: Nodes to interrupt immediately before they get executed.
interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
webhook: Webhook to call after LangGraph API call is done.
@@ -5301,6 +5462,10 @@ class SyncRunsClient:
raise_error: Whether to raise an error if the run fails.
headers: Optional custom headers to include with the request.
on_run_created: Optional callback to call when a run is created.
durability: The durability to use for the run. Values are "sync", "async", or "exit".
"async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True
"sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False
"exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Returns:
Union[list[dict], dict[str, Any]]: The output of the run.
@@ -5355,6 +5520,12 @@ class SyncRunsClient:
```
""" # noqa: E501
if checkpoint_during is not None:
warnings.warn(
"`checkpoint_during` is deprecated and will be removed in a future version. Use `durability` instead.",
DeprecationWarning,
stacklevel=2,
)
payload = {
"input": input,
"command": (
@@ -5376,6 +5547,7 @@ class SyncRunsClient:
"on_completion": on_completion,
"after_seconds": after_seconds,
"raise_error": raise_error,
"durability": durability,
}
def on_response(res: httpx.Response):
+14
View File
@@ -38,6 +38,14 @@ Represents the status of a thread:
- "error": An exception occurred during task processing.
"""
ThreadStreamMode = Literal["run_modes", "lifecycle", "state_update"]
"""
Defines the mode of streaming:
- "run_modes": Stream the same events as the runs on thread, as well as run_done events.
- "lifecycle": Stream only run start/end events.
- "state_update": Stream state updates on the thread.
"""
StreamMode = Literal[
"values",
"messages",
@@ -91,6 +99,12 @@ Defines action after completion:
- "keep": Retain resources after completion.
"""
Durability = Literal["sync", "async", "exit"]
"""Durability mode for the graph execution.
- `"sync"`: Changes are persisted synchronously before the next step starts.
- `"async"`: Changes are persisted asynchronously while the next step executes.
- `"exit"`: Changes are persisted only when the graph exits."""
All = Literal["*"]
"""Represents a wildcard or 'all' selector."""