chore: state_updated_at sort by (#6857)

This commit is contained in:
William FH
2026-02-18 10:41:23 -08:00
committed by GitHub
parent e931c68669
commit 095da17833
14 changed files with 36 additions and 31 deletions
@@ -62,3 +62,4 @@ target-version = "py310"
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,6 +3,6 @@ from langgraph_sdk.client import get_client, get_sync_client
from langgraph_sdk.encryption import Encryption
from langgraph_sdk.encryption.types import EncryptionContext
__version__ = "0.3.6"
__version__ = "0.3.7"
__all__ = ["Auth", "Encryption", "EncryptionContext", "get_client", "get_sync_client"]
@@ -290,7 +290,7 @@ class AssistantsClient:
"""
get_params = {"recurse": recurse}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
if namespace is not None:
return await self.http.get(
f"/assistants/{assistant_id}/subgraphs/{namespace}",
+2 -2
View File
@@ -110,7 +110,7 @@ def get_client(
if url is None:
url = "http://api"
if os.environ.get("__LANGGRAPH_DEFER_LOOPBACK_TRANSPORT") == "true":
transport = get_asgi_transport()(app=None, root_path="/noauth")
transport = get_asgi_transport()(app=None, root_path="/noauth") # type: ignore[invalid-argument-type]
_registered_transports.append(transport)
else:
try:
@@ -122,7 +122,7 @@ def get_client(
"Failed to connect to in-process LangGraph server. Deferring configuration.",
exc_info=True,
)
transport = get_asgi_transport()(app=None, root_path="/noauth")
transport = get_asgi_transport()(app=None, root_path="/noauth") # type: ignore[invalid-argument-type]
_registered_transports.append(transport)
if transport is None:
+8 -7
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import builtins
import warnings
from collections.abc import AsyncIterator, Callable, Mapping, Sequence
from typing import Any, overload
@@ -507,11 +508,11 @@ class RunsClient:
async def create_batch(
self,
payloads: list[RunCreate],
payloads: builtins.list[RunCreate],
*,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> list[Run]:
) -> builtins.list[Run]:
"""Create a batch of stateless background runs."""
def filter_payload(payload: RunCreate):
@@ -547,7 +548,7 @@ class RunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
) -> list[dict] | dict[str, Any]: ...
) -> builtins.list[dict] | dict[str, Any]: ...
@overload
async def wait(
@@ -572,7 +573,7 @@ class RunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
) -> list[dict] | dict[str, Any]: ...
) -> builtins.list[dict] | dict[str, Any]: ...
async def wait(
self,
@@ -600,7 +601,7 @@ class RunsClient:
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> list[dict] | dict[str, Any]:
) -> builtins.list[dict] | dict[str, Any]:
"""Create a run, wait until it finishes and return the final state.
Args:
@@ -751,10 +752,10 @@ class RunsClient:
limit: int = 10,
offset: int = 0,
status: RunStatus | None = None,
select: list[RunSelectField] | None = None,
select: builtins.list[RunSelectField] | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> list[Run]:
) -> builtins.list[Run]:
"""List runs.
Args:
+1 -1
View File
@@ -138,7 +138,7 @@ class StoreClient:
if refresh_ttl is not None:
get_params["refresh_ttl"] = refresh_ttl
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
return await self.http.get("/store/items", params=get_params, headers=headers)
async def delete_item(
+2 -2
View File
@@ -543,7 +543,7 @@ class ThreadsClient:
elif checkpoint_id:
get_params = {"subgraphs": subgraphs}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
return await self.http.get(
f"/threads/{thread_id}/state/{checkpoint_id}",
params=get_params,
@@ -552,7 +552,7 @@ class ThreadsClient:
else:
get_params = {"subgraphs": subgraphs}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
return await self.http.get(
f"/threads/{thread_id}/state",
params=get_params,
@@ -294,7 +294,7 @@ class SyncAssistantsClient:
"""
get_params = {"recurse": recurse}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
if namespace is not None:
return self.http.get(
f"/assistants/{assistant_id}/subgraphs/{namespace}",
+8 -7
View File
@@ -2,6 +2,7 @@
from __future__ import annotations
import builtins
import warnings
from collections.abc import Callable, Iterator, Mapping, Sequence
from typing import Any, overload
@@ -503,11 +504,11 @@ class SyncRunsClient:
def create_batch(
self,
payloads: list[RunCreate],
payloads: builtins.list[RunCreate],
*,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> list[Run]:
) -> builtins.list[Run]:
"""Create a batch of stateless background runs."""
def filter_payload(payload: RunCreate):
@@ -543,7 +544,7 @@ class SyncRunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
) -> list[dict] | dict[str, Any]: ...
) -> builtins.list[dict] | dict[str, Any]: ...
@overload
def wait(
@@ -568,7 +569,7 @@ class SyncRunsClient:
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
) -> list[dict] | dict[str, Any]: ...
) -> builtins.list[dict] | dict[str, Any]: ...
def wait(
self,
@@ -596,7 +597,7 @@ class SyncRunsClient:
params: QueryParamTypes | None = None,
on_run_created: Callable[[RunCreateMetadata], None] | None = None,
durability: Durability | None = None,
) -> list[dict] | dict[str, Any]:
) -> builtins.list[dict] | dict[str, Any]:
"""Create a run, wait until it finishes and return the final state.
Args:
@@ -740,10 +741,10 @@ class SyncRunsClient:
limit: int = 10,
offset: int = 0,
status: RunStatus | None = None,
select: list[RunSelectField] | None = None,
select: builtins.list[RunSelectField] | None = None,
headers: Mapping[str, str] | None = None,
params: QueryParamTypes | None = None,
) -> list[Run]:
) -> builtins.list[Run]:
"""List runs.
Args:
+2 -2
View File
@@ -530,7 +530,7 @@ class SyncThreadsClient:
elif checkpoint_id:
get_params = {"subgraphs": subgraphs}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
return self.http.get(
f"/threads/{thread_id}/state/{checkpoint_id}",
params=get_params,
@@ -539,7 +539,7 @@ class SyncThreadsClient:
else:
get_params = {"subgraphs": subgraphs}
if params:
get_params = {**get_params, **params}
get_params = {**get_params, **dict(params)}
return self.http.get(
f"/threads/{thread_id}/state",
params=get_params,
+3 -1
View File
@@ -146,7 +146,9 @@ AssistantSortBy = Literal[
The field to sort by.
"""
ThreadSortBy = Literal["thread_id", "status", "created_at", "updated_at"]
ThreadSortBy = Literal[
"thread_id", "status", "created_at", "updated_at", "state_updated_at"
]
"""
The field to sort by.
"""
+2 -2
View File
@@ -19,7 +19,7 @@ class AsyncListByteStream(httpx.AsyncByteStream):
self._chunks = list(chunks)
self._exc = exc
async def __aiter__(self): # type: ignore[override]
async def __aiter__(self):
for chunk in self._chunks:
yield chunk
if self._exc is not None:
@@ -34,7 +34,7 @@ class ListByteStream(httpx.ByteStream):
self._chunks = list(chunks)
self._exc = exc
def __iter__(self): # type: ignore[override]
def __iter__(self):
yield from self._chunks
if self._exc is not None:
raise self._exc
+2 -2
View File
@@ -65,7 +65,7 @@ def test_raise_for_status_typed_maps_exceptions_and_sets_status_code(
with pytest.raises(exc_type) as ei:
_raise_for_status_typed(r)
err = cast("APIStatusError", ei.value)
err = ei.value
assert err.status_code == status
# response attribute should be present and match
assert err.response.status_code == status
@@ -113,7 +113,7 @@ def test_error_message_in_str_and_args() -> None:
r = make_response(422, json_body={"message": "Validation failed"})
with pytest.raises(UnprocessableEntityError) as ei:
_raise_for_status_typed(r)
err = cast("UnprocessableEntityError", ei.value)
err = ei.value
assert str(err) == "Validation failed"
assert err.args == ("Validation failed",)
assert err.message == "Validation failed"