langgraph-sdk 0.2.6__tar.gz → 0.2.7__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.
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/PKG-INFO +1 -1
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/__init__.py +1 -1
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/client.py +46 -16
- langgraph_sdk-0.2.7/tests/fixtures/response.txt +239 -0
- langgraph_sdk-0.2.7/tests/test_client_stream.py +81 -0
- langgraph_sdk-0.2.7/uv.lock +525 -0
- langgraph_sdk-0.2.6/uv.lock +0 -525
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/.gitignore +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/LICENSE +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/Makefile +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/README.md +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/auth/__init__.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/auth/exceptions.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/auth/types.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/py.typed +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/schema.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/langgraph_sdk/sse.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/pyproject.toml +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/tests/test_api_parity.py +0 -0
- {langgraph_sdk-0.2.6 → langgraph_sdk-0.2.7}/tests/test_select_fields_sync.py +0 -0
|
@@ -157,27 +157,38 @@ def get_client(
|
|
|
157
157
|
headers: Mapping[str, str] | None = None,
|
|
158
158
|
timeout: TimeoutTypes | None = None,
|
|
159
159
|
) -> LangGraphClient:
|
|
160
|
-
"""
|
|
160
|
+
"""Create and configure a LangGraphClient.
|
|
161
|
+
|
|
162
|
+
The client provides programmatic access to a LangGraph Platform deployment. It supports
|
|
163
|
+
both remote servers and local in-process connections (when running inside a LangGraph server).
|
|
161
164
|
|
|
162
165
|
Args:
|
|
163
|
-
url:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
166
|
+
url:
|
|
167
|
+
Base URL of the LangGraph API.
|
|
168
|
+
– If `None`, the client first attempts an in-process connection via ASGI transport.
|
|
169
|
+
If that fails, it falls back to `http://localhost:8123`.
|
|
170
|
+
api_key:
|
|
171
|
+
API key for authentication. If omitted, the client reads from environment
|
|
172
|
+
variables in the following order:
|
|
173
|
+
1. Function argument
|
|
174
|
+
2. `LANGGRAPH_API_KEY`
|
|
175
|
+
3. `LANGSMITH_API_KEY`
|
|
176
|
+
4. `LANGCHAIN_API_KEY`
|
|
177
|
+
headers:
|
|
178
|
+
Additional HTTP headers to include in requests. Merged with authentication headers.
|
|
179
|
+
timeout:
|
|
180
|
+
HTTP timeout configuration. May be:
|
|
181
|
+
– `httpx.Timeout` instance
|
|
182
|
+
– float (total seconds)
|
|
183
|
+
– tuple `(connect, read, write, pool)` in seconds
|
|
184
|
+
Defaults: connect=5, read=300, write=300, pool=5.
|
|
175
185
|
|
|
176
186
|
Returns:
|
|
177
|
-
LangGraphClient:
|
|
178
|
-
|
|
187
|
+
LangGraphClient:
|
|
188
|
+
A top-level client exposing sub-clients for assistants, threads,
|
|
189
|
+
runs, and cron operations.
|
|
179
190
|
|
|
180
|
-
???+ example "
|
|
191
|
+
???+ example "Connect to a remote server:"
|
|
181
192
|
|
|
182
193
|
```python
|
|
183
194
|
from langgraph_sdk import get_client
|
|
@@ -188,6 +199,21 @@ def get_client(
|
|
|
188
199
|
# example usage: client.<model>.<method_name>()
|
|
189
200
|
assistants = await client.assistants.get(assistant_id="some_uuid")
|
|
190
201
|
```
|
|
202
|
+
|
|
203
|
+
???+ example "Connect in-process to a running LangGraph server:"
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
from langgraph_sdk import get_client
|
|
207
|
+
|
|
208
|
+
client = get_client(url=None)
|
|
209
|
+
|
|
210
|
+
async def my_node(...):
|
|
211
|
+
subagent_result = await client.runs.wait(
|
|
212
|
+
thread_id=None,
|
|
213
|
+
assistant_id="agent",
|
|
214
|
+
input={"messages": [{"role": "user", "content": "Foo"}]},
|
|
215
|
+
)
|
|
216
|
+
```
|
|
191
217
|
"""
|
|
192
218
|
|
|
193
219
|
transport: httpx.AsyncBaseTransport | None = None
|
|
@@ -457,6 +483,8 @@ class HttpClient:
|
|
|
457
483
|
sse = decoder.decode(line=line.rstrip(b"\n"))
|
|
458
484
|
if sse is not None:
|
|
459
485
|
yield sse
|
|
486
|
+
if sse := decoder.decode(b""):
|
|
487
|
+
yield sse
|
|
460
488
|
|
|
461
489
|
|
|
462
490
|
async def _aencode_json(json: Any) -> tuple[dict[str, str], bytes | None]:
|
|
@@ -3647,6 +3675,8 @@ class SyncHttpClient:
|
|
|
3647
3675
|
sse = decoder.decode(line.rstrip(b"\n"))
|
|
3648
3676
|
if sse is not None:
|
|
3649
3677
|
yield sse
|
|
3678
|
+
if sse := decoder.decode(b""):
|
|
3679
|
+
yield sse
|
|
3650
3680
|
|
|
3651
3681
|
|
|
3652
3682
|
def _encode_json(json: Any) -> tuple[dict[str, str], bytes]:
|