langgraph-sdk 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-sdk
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: SDK for interacting with LangGraph API
5
5
  Project-URL: Repository, https://www.github.com/langchain-ai/langgraph
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  from langgraph_sdk.auth import Auth
2
2
  from langgraph_sdk.client import get_client, get_sync_client
3
3
 
4
- __version__ = "0.2.2"
4
+ __version__ = "0.2.3"
5
5
 
6
6
  __all__ = ["Auth", "get_client", "get_sync_client"]
@@ -991,6 +991,34 @@ class AssistantsClient:
991
991
  params=params,
992
992
  )
993
993
 
994
+ async def count(
995
+ self,
996
+ *,
997
+ metadata: Json = None,
998
+ graph_id: str | None = None,
999
+ headers: Mapping[str, str] | None = None,
1000
+ params: QueryParamTypes | None = None,
1001
+ ) -> int:
1002
+ """Count assistants matching filters.
1003
+
1004
+ Args:
1005
+ metadata: Metadata to filter by. Exact match for each key/value.
1006
+ graph_id: Optional graph id to filter by.
1007
+ headers: Optional custom headers to include with the request.
1008
+ params: Optional query parameters to include with the request.
1009
+
1010
+ Returns:
1011
+ int: Number of assistants matching the criteria.
1012
+ """
1013
+ payload: dict[str, Any] = {}
1014
+ if metadata:
1015
+ payload["metadata"] = metadata
1016
+ if graph_id:
1017
+ payload["graph_id"] = graph_id
1018
+ return await self.http.post(
1019
+ "/assistants/count", json=payload, headers=headers, params=params
1020
+ )
1021
+
994
1022
  async def get_versions(
995
1023
  self,
996
1024
  assistant_id: str,
@@ -1340,6 +1368,38 @@ class ThreadsClient:
1340
1368
  params=params,
1341
1369
  )
1342
1370
 
1371
+ async def count(
1372
+ self,
1373
+ *,
1374
+ metadata: Json = None,
1375
+ values: Json = None,
1376
+ status: ThreadStatus | None = None,
1377
+ headers: Mapping[str, str] | None = None,
1378
+ params: QueryParamTypes | None = None,
1379
+ ) -> int:
1380
+ """Count threads matching filters.
1381
+
1382
+ Args:
1383
+ metadata: Thread metadata to filter on.
1384
+ values: State values to filter on.
1385
+ status: Thread status to filter on.
1386
+ headers: Optional custom headers to include with the request.
1387
+ params: Optional query parameters to include with the request.
1388
+
1389
+ Returns:
1390
+ int: Number of threads matching the criteria.
1391
+ """
1392
+ payload: dict[str, Any] = {}
1393
+ if metadata:
1394
+ payload["metadata"] = metadata
1395
+ if values:
1396
+ payload["values"] = values
1397
+ if status:
1398
+ payload["status"] = status
1399
+ return await self.http.post(
1400
+ "/threads/count", json=payload, headers=headers, params=params
1401
+ )
1402
+
1343
1403
  async def copy(
1344
1404
  self,
1345
1405
  thread_id: str,
@@ -2855,6 +2915,34 @@ class CronClient:
2855
2915
  "/runs/crons/search", json=payload, headers=headers, params=params
2856
2916
  )
2857
2917
 
2918
+ async def count(
2919
+ self,
2920
+ *,
2921
+ assistant_id: str | None = None,
2922
+ thread_id: str | None = None,
2923
+ headers: Mapping[str, str] | None = None,
2924
+ params: QueryParamTypes | None = None,
2925
+ ) -> int:
2926
+ """Count cron jobs matching filters.
2927
+
2928
+ Args:
2929
+ assistant_id: Assistant ID to filter by.
2930
+ thread_id: Thread ID to filter by.
2931
+ headers: Optional custom headers to include with the request.
2932
+ params: Optional query parameters to include with the request.
2933
+
2934
+ Returns:
2935
+ int: Number of crons matching the criteria.
2936
+ """
2937
+ payload: dict[str, Any] = {}
2938
+ if assistant_id:
2939
+ payload["assistant_id"] = assistant_id
2940
+ if thread_id:
2941
+ payload["thread_id"] = thread_id
2942
+ return await self.http.post(
2943
+ "/runs/crons/count", json=payload, headers=headers, params=params
2944
+ )
2945
+
2858
2946
 
2859
2947
  class StoreClient:
2860
2948
  """Client for interacting with the graph's shared storage.
@@ -3974,6 +4062,34 @@ class SyncAssistantsClient:
3974
4062
  params=params,
3975
4063
  )
3976
4064
 
4065
+ def count(
4066
+ self,
4067
+ *,
4068
+ metadata: Json = None,
4069
+ graph_id: str | None = None,
4070
+ headers: Mapping[str, str] | None = None,
4071
+ params: QueryParamTypes | None = None,
4072
+ ) -> int:
4073
+ """Count assistants matching filters.
4074
+
4075
+ Args:
4076
+ metadata: Metadata to filter by. Exact match for each key/value.
4077
+ graph_id: Optional graph id to filter by.
4078
+ headers: Optional custom headers to include with the request.
4079
+ params: Optional query parameters to include with the request.
4080
+
4081
+ Returns:
4082
+ int: Number of assistants matching the criteria.
4083
+ """
4084
+ payload: dict[str, Any] = {}
4085
+ if metadata:
4086
+ payload["metadata"] = metadata
4087
+ if graph_id:
4088
+ payload["graph_id"] = graph_id
4089
+ return self.http.post(
4090
+ "/assistants/count", json=payload, headers=headers, params=params
4091
+ )
4092
+
3977
4093
  def get_versions(
3978
4094
  self,
3979
4095
  assistant_id: str,
@@ -4306,6 +4422,38 @@ class SyncThreadsClient:
4306
4422
  "/threads/search", json=payload, headers=headers, params=params
4307
4423
  )
4308
4424
 
4425
+ def count(
4426
+ self,
4427
+ *,
4428
+ metadata: Json = None,
4429
+ values: Json = None,
4430
+ status: ThreadStatus | None = None,
4431
+ headers: Mapping[str, str] | None = None,
4432
+ params: QueryParamTypes | None = None,
4433
+ ) -> int:
4434
+ """Count threads matching filters.
4435
+
4436
+ Args:
4437
+ metadata: Thread metadata to filter on.
4438
+ values: State values to filter on.
4439
+ status: Thread status to filter on.
4440
+ headers: Optional custom headers to include with the request.
4441
+ params: Optional query parameters to include with the request.
4442
+
4443
+ Returns:
4444
+ int: Number of threads matching the criteria.
4445
+ """
4446
+ payload: dict[str, Any] = {}
4447
+ if metadata:
4448
+ payload["metadata"] = metadata
4449
+ if values:
4450
+ payload["values"] = values
4451
+ if status:
4452
+ payload["status"] = status
4453
+ return self.http.post(
4454
+ "/threads/count", json=payload, headers=headers, params=params
4455
+ )
4456
+
4309
4457
  def copy(
4310
4458
  self,
4311
4459
  thread_id: str,
@@ -5781,6 +5929,34 @@ class SyncCronClient:
5781
5929
  "/runs/crons/search", json=payload, headers=headers, params=params
5782
5930
  )
5783
5931
 
5932
+ def count(
5933
+ self,
5934
+ *,
5935
+ assistant_id: str | None = None,
5936
+ thread_id: str | None = None,
5937
+ headers: Mapping[str, str] | None = None,
5938
+ params: QueryParamTypes | None = None,
5939
+ ) -> int:
5940
+ """Count cron jobs matching filters.
5941
+
5942
+ Args:
5943
+ assistant_id: Assistant ID to filter by.
5944
+ thread_id: Thread ID to filter by.
5945
+ headers: Optional custom headers to include with the request.
5946
+ params: Optional query parameters to include with the request.
5947
+
5948
+ Returns:
5949
+ int: Number of crons matching the criteria.
5950
+ """
5951
+ payload: dict[str, Any] = {}
5952
+ if assistant_id:
5953
+ payload["assistant_id"] = assistant_id
5954
+ if thread_id:
5955
+ payload["thread_id"] = thread_id
5956
+ return self.http.post(
5957
+ "/runs/crons/count", json=payload, headers=headers, params=params
5958
+ )
5959
+
5784
5960
 
5785
5961
  class SyncStoreClient:
5786
5962
  """A client for synchronous operations on a key-value store.
File without changes
File without changes
File without changes
File without changes
File without changes