langgraph-sdk 0.3.1__tar.gz → 0.3.2__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.
Files changed (29) hide show
  1. langgraph_sdk-0.3.2/.gitignore +102 -0
  2. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/PKG-INFO +1 -1
  3. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/__init__.py +1 -1
  4. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/client.py +12 -0
  5. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/schema.py +2 -0
  6. langgraph_sdk-0.3.1/.gitignore +0 -184
  7. langgraph_sdk-0.3.1/tests/test_select_fields_sync.py +0 -76
  8. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/LICENSE +0 -0
  9. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/Makefile +0 -0
  10. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/README.md +0 -0
  11. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/auth/__init__.py +0 -0
  12. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/auth/exceptions.py +0 -0
  13. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/auth/types.py +0 -0
  14. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/encryption/__init__.py +0 -0
  15. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/encryption/types.py +0 -0
  16. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/errors.py +0 -0
  17. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/py.typed +0 -0
  18. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/langgraph_sdk/sse.py +0 -0
  19. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/pyproject.toml +0 -0
  20. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/fixtures/response.txt +0 -0
  21. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_api_parity.py +0 -0
  22. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_assistants_client.py +0 -0
  23. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_client_stream.py +0 -0
  24. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_encryption.py +0 -0
  25. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_errors.py +0 -0
  26. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_serde.py +0 -0
  27. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_serde_schema.py +0 -0
  28. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/tests/test_skip_auto_load_api_key.py +0 -0
  29. {langgraph_sdk-0.3.1 → langgraph_sdk-0.3.2}/uv.lock +0 -0
@@ -0,0 +1,102 @@
1
+ .vs/
2
+ .vscode/
3
+ .idea/
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ pip-wheel-metadata/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+
54
+ # Django stuff:
55
+ *.log
56
+ local_settings.py
57
+ db.sqlite3
58
+ db.sqlite3-journal
59
+
60
+ # PyBuilder
61
+ target/
62
+
63
+ # Jupyter Notebook
64
+ .ipynb_checkpoints
65
+ notebooks/
66
+
67
+ # IPython
68
+ profile_default/
69
+ ipython_config.py
70
+
71
+ # pyenv
72
+ .python-version
73
+
74
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow
75
+ __pypackages__/
76
+
77
+ # Environments
78
+ .env
79
+ .envrc
80
+ .venv
81
+ .venvs
82
+ env/
83
+ venv/
84
+ ENV/
85
+ env.bak/
86
+ venv.bak/
87
+
88
+ # mypy
89
+ .mypy_cache/
90
+ .dmypy.json
91
+ dmypy.json
92
+
93
+ # Pyre type checker
94
+ .pyre/
95
+
96
+ # macOS display setting files
97
+ .DS_Store
98
+
99
+ .vercel
100
+ .turbo
101
+ .editorconfig
102
+ .scratch
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: langgraph-sdk
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: SDK for interacting with LangGraph API
5
5
  Project-URL: Source, https://github.com/langchain-ai/langgraph/tree/main/libs/sdk-py
6
6
  Project-URL: Twitter, https://x.com/LangChainAI
@@ -3,6 +3,6 @@ from langgraph_sdk.client import get_client, get_sync_client
3
3
  from langgraph_sdk.encryption import Encryption
4
4
  from langgraph_sdk.encryption.types import EncryptionContext
5
5
 
6
- __version__ = "0.3.1"
6
+ __version__ = "0.3.2"
7
7
 
8
8
  __all__ = ["Auth", "Encryption", "EncryptionContext", "get_client", "get_sync_client"]
@@ -3064,6 +3064,7 @@ class CronClient:
3064
3064
  interrupt_before: All | list[str] | None = None,
3065
3065
  interrupt_after: All | list[str] | None = None,
3066
3066
  webhook: str | None = None,
3067
+ on_run_completed: OnCompletionBehavior | None = None,
3067
3068
  multitask_strategy: str | None = None,
3068
3069
  headers: Mapping[str, str] | None = None,
3069
3070
  params: QueryParamTypes | None = None,
@@ -3083,6 +3084,10 @@ class CronClient:
3083
3084
  interrupt_before: Nodes to interrupt immediately before they get executed.
3084
3085
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
3085
3086
  webhook: Webhook to call after LangGraph API call is done.
3087
+ on_run_completed: What to do with the thread after the run completes.
3088
+ Must be one of 'delete' (default) or 'keep'. 'delete' removes the thread
3089
+ after execution. 'keep' creates a new thread for each execution but does not
3090
+ clean them up. Clients are responsible for cleaning up kept threads.
3086
3091
  multitask_strategy: Multitask strategy to use.
3087
3092
  Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
3088
3093
  headers: Optional custom headers to include with the request.
@@ -3120,6 +3125,7 @@ class CronClient:
3120
3125
  "interrupt_before": interrupt_before,
3121
3126
  "interrupt_after": interrupt_after,
3122
3127
  "webhook": webhook,
3128
+ "on_run_completed": on_run_completed,
3123
3129
  }
3124
3130
  if multitask_strategy:
3125
3131
  payload["multitask_strategy"] = multitask_strategy
@@ -6356,6 +6362,7 @@ class SyncCronClient:
6356
6362
  interrupt_before: All | list[str] | None = None,
6357
6363
  interrupt_after: All | list[str] | None = None,
6358
6364
  webhook: str | None = None,
6365
+ on_run_completed: OnCompletionBehavior | None = None,
6359
6366
  multitask_strategy: str | None = None,
6360
6367
  headers: Mapping[str, str] | None = None,
6361
6368
  params: QueryParamTypes | None = None,
@@ -6375,6 +6382,10 @@ class SyncCronClient:
6375
6382
  interrupt_before: Nodes to interrupt immediately before they get executed.
6376
6383
  interrupt_after: Nodes to Nodes to interrupt immediately after they get executed.
6377
6384
  webhook: Webhook to call after LangGraph API call is done.
6385
+ on_run_completed: What to do with the thread after the run completes.
6386
+ Must be one of 'delete' (default) or 'keep'. 'delete' removes the thread
6387
+ after execution. 'keep' creates a new thread for each execution but does not
6388
+ clean them up. Clients are responsible for cleaning up kept threads.
6378
6389
  multitask_strategy: Multitask strategy to use.
6379
6390
  Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
6380
6391
  headers: Optional custom headers to include with the request.
@@ -6412,6 +6423,7 @@ class SyncCronClient:
6412
6423
  "interrupt_after": interrupt_after,
6413
6424
  "webhook": webhook,
6414
6425
  "checkpoint_during": checkpoint_during,
6426
+ "on_run_completed": on_run_completed,
6415
6427
  "multitask_strategy": multitask_strategy,
6416
6428
  }
6417
6429
  payload = {k: v for k, v in payload.items() if v is not None}
@@ -354,6 +354,8 @@ class Cron(TypedDict):
354
354
  """The ID of the assistant."""
355
355
  thread_id: str | None
356
356
  """The ID of the thread."""
357
+ on_run_completed: OnCompletionBehavior | None
358
+ """What to do with the thread after the run completes. Only applicable for stateless crons."""
357
359
  end_time: datetime | None
358
360
  """The end date to stop running the cron."""
359
361
  schedule: str
@@ -1,184 +0,0 @@
1
- .vs/
2
- .vscode/
3
- .idea/
4
- # Byte-compiled / optimized / DLL files
5
- __pycache__/
6
- *.py[cod]
7
- *$py.class
8
-
9
- # C extensions
10
- *.so
11
-
12
- # Distribution / packaging
13
- .Python
14
- build/
15
- develop-eggs/
16
- dist/
17
- downloads/
18
- eggs/
19
- .eggs/
20
- lib/
21
- lib64/
22
- parts/
23
- sdist/
24
- var/
25
- wheels/
26
- pip-wheel-metadata/
27
- share/python-wheels/
28
- *.egg-info/
29
- .installed.cfg
30
- *.egg
31
- MANIFEST
32
-
33
- # PyInstaller
34
- # Usually these files are written by a python script from a template
35
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
36
- *.manifest
37
- *.spec
38
-
39
- # Installer logs
40
- pip-log.txt
41
- pip-delete-this-directory.txt
42
-
43
- # Unit test / coverage reports
44
- htmlcov/
45
- .tox/
46
- .nox/
47
- .coverage
48
- .coverage.*
49
- .cache
50
- nosetests.xml
51
- coverage.xml
52
- *.cover
53
- *.py,cover
54
- .hypothesis/
55
- .pytest_cache/
56
-
57
- # Translations
58
- *.mo
59
- *.pot
60
-
61
- # Django stuff:
62
- *.log
63
- local_settings.py
64
- db.sqlite3
65
- db.sqlite3-journal
66
-
67
- # Flask stuff:
68
- instance/
69
- .webassets-cache
70
-
71
- # Scrapy stuff:
72
- .scrapy
73
-
74
- # Sphinx documentation
75
- docs/_build/
76
- docs/docs/_build/
77
-
78
- # PyBuilder
79
- target/
80
-
81
- # Jupyter Notebook
82
- .ipynb_checkpoints
83
- notebooks/
84
-
85
- # IPython
86
- profile_default/
87
- ipython_config.py
88
-
89
- # pyenv
90
- .python-version
91
-
92
- # pipenv
93
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
94
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
95
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
96
- # install all needed dependencies.
97
- #Pipfile.lock
98
-
99
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow
100
- __pypackages__/
101
-
102
- # Celery stuff
103
- celerybeat-schedule
104
- celerybeat.pid
105
-
106
- # SageMath parsed files
107
- *.sage.py
108
-
109
- # Environments
110
- .env
111
- .envrc
112
- .venv
113
- .venvs
114
- env/
115
- venv/
116
- ENV/
117
- env.bak/
118
- venv.bak/
119
-
120
- # Spyder project settings
121
- .spyderproject
122
- .spyproject
123
-
124
- # Rope project settings
125
- .ropeproject
126
-
127
- # mkdocs documentation
128
- /site
129
-
130
- # mypy
131
- .mypy_cache/
132
- .dmypy.json
133
- dmypy.json
134
-
135
- # Pyre type checker
136
- .pyre/
137
-
138
- # macOS display setting files
139
- .DS_Store
140
-
141
- # Wandb directory
142
- wandb/
143
-
144
- # asdf tool versions
145
- .tool-versions
146
- /.ruff_cache/
147
-
148
- *.pkl
149
- *.bin
150
-
151
- # integration test artifacts
152
- data_map*
153
- \[('_type', 'fake'), ('stop', None)]
154
-
155
- # Replit files
156
- *replit*
157
-
158
- node_modules
159
- docs/.yarn/
160
- docs/node_modules/
161
- docs/.docusaurus/
162
- docs/.cache-loader/
163
- docs/_dist
164
- docs/api_reference/api_reference.rst
165
- docs/api_reference/experimental_api_reference.rst
166
- docs/api_reference/_build
167
- docs/api_reference/*/
168
- !docs/api_reference/_static/
169
- !docs/api_reference/templates/
170
- !docs/api_reference/themes/
171
- docs/docs_skeleton/build
172
- docs/docs_skeleton/node_modules
173
- docs/docs_skeleton/yarn.lock
174
-
175
- # Any new jupyter notebooks
176
- # not intended for the repo
177
- Untitled*.ipynb
178
-
179
- Chinook.db
180
-
181
- .vercel
182
- .turbo
183
- .editorconfig
184
- .scratch
@@ -1,76 +0,0 @@
1
- import functools
2
- import json
3
- import os
4
- from pathlib import Path
5
- from typing import get_args
6
-
7
- from langgraph_sdk.schema import (
8
- AssistantSelectField,
9
- CronSelectField,
10
- RunSelectField,
11
- ThreadSelectField,
12
- )
13
-
14
- current_dir = os.path.dirname(os.path.abspath(__file__))
15
-
16
-
17
- @functools.cache
18
- def _load_spec() -> dict:
19
- with (
20
- Path(current_dir).parents[2]
21
- / "docs"
22
- / "docs"
23
- / "cloud"
24
- / "reference"
25
- / "api"
26
- / "openapi.json"
27
- ).open() as f:
28
- return json.load(f)
29
-
30
-
31
- def _enum_from_request_select(spec: dict, path: str, method: str) -> set[str]:
32
- schema = spec["paths"][path][method]["requestBody"]["content"]["application/json"][
33
- "schema"
34
- ]
35
- if "properties" in schema:
36
- props = schema["properties"]
37
- elif "$ref" in schema:
38
- component = spec
39
- index = schema["$ref"].split("/")[1:]
40
- for part in index:
41
- component = component[part]
42
- props = component["properties"]
43
- else:
44
- raise ValueError(f"Unknown schema: {schema}")
45
- sel = props["select"]
46
- return set(sel["items"]["enum"])
47
-
48
-
49
- def _enum_from_query_select(spec: dict, path: str, method: str) -> set[str]:
50
- params = spec["paths"][path][method]["parameters"]
51
- sel = next(p for p in params if p["name"] == "select")
52
- return set(sel["schema"]["items"]["enum"])
53
-
54
-
55
- def test_assistants_select_enum_matches_sdk():
56
- spec = _load_spec()
57
- expected = set(get_args(AssistantSelectField))
58
- assert _enum_from_request_select(spec, "/assistants/search", "post") == expected
59
-
60
-
61
- def test_threads_select_enum_matches_sdk():
62
- spec = _load_spec()
63
- expected = set(get_args(ThreadSelectField))
64
- assert _enum_from_request_select(spec, "/threads/search", "post") == expected
65
-
66
-
67
- def test_runs_select_enum_matches_sdk():
68
- spec = _load_spec()
69
- expected = set(get_args(RunSelectField))
70
- assert _enum_from_query_select(spec, "/threads/{thread_id}/runs", "get") == expected
71
-
72
-
73
- def test_crons_select_enum_matches_sdk():
74
- spec = _load_spec()
75
- expected = set(get_args(CronSelectField))
76
- assert _enum_from_request_select(spec, "/runs/crons/search", "post") == expected
File without changes
File without changes
File without changes
File without changes