langgraph-api 0.2.126__tar.gz → 0.2.129__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.
Potentially problematic release.
This version of langgraph-api might be problematic. Click here for more details.
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/Makefile +3 -3
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/PKG-INFO +1 -1
- langgraph_api-0.2.129/langgraph_api/__init__.py +1 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/models/run.py +15 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/server.py +5 -1
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/stream.py +59 -3
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/worker.py +9 -4
- langgraph_api-0.2.126/langgraph_api/__init__.py +0 -1
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/.gitignore +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/LICENSE +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/README.md +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/.gitignore +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/Makefile +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/README.md +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/burst.js +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/ramp.js +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/benchmark/weather.js +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/constraints.txt +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/forbidden.txt +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/healthcheck.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/assistants.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/mcp.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/meta.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/openapi.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/runs.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/store.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/threads.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/api/ui.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/asgi_transport.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/asyncio.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/custom.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/langsmith/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/langsmith/backend.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/langsmith/client.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/middleware.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/noop.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/auth/studio_user.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/cli.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/command.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/config.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/cron_scheduler.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/errors.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/feature_flags.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/graph.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/http.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/http_metrics.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/.gitignore +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/.prettierrc +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/base.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/build.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/client.http.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/client.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/errors.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/global.d.ts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/package.json +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/remote.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/schema.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/graph.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/load.hooks.mjs +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/preload.mjs +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/utils/files.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/utils/importMap.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/utils/pythonSchemas.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/utils/serde.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/sse.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/traceblock.mts +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/tsconfig.json +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/ui.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/yarn.lock +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/logging.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/metadata.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/middleware/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/middleware/http_logger.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/middleware/private_network.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/middleware/request_id.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/models/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/patch.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/queue_entrypoint.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/route.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/schema.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/serde.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/sse.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/state.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/store.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/thread_ttl.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/traceblock.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/tunneling/cloudflare.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils/cache.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils/config.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils/future.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils/headers.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/utils.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/validation.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/webhook.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_license/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_license/validation.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/__init__.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/checkpoint.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/database.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/lifespan.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/metrics.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/ops.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/queue.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/retry.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_runtime/store.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/logging.json +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/openapi.json +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/pyproject.toml +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/scripts/create_license.py +0 -0
- {langgraph_api-0.2.126 → langgraph_api-0.2.129}/uv.lock +0 -0
|
@@ -54,7 +54,7 @@ start:
|
|
|
54
54
|
LANGGRAPH_RUNTIME_EDITION=inmem \
|
|
55
55
|
LANGGRAPH_AES_KEY='$(LANGGRAPH_AES_KEY)' \
|
|
56
56
|
N_JOBS_PER_WORKER=2 \
|
|
57
|
-
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "custom_lifespan": "./tests/graphs/my_router.py:graph", "single_node": "./tests/graphs/single_node.py:graph", "benchmark": "./tests/graphs/benchmark.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
57
|
+
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "custom_lifespan": "./tests/graphs/my_router.py:graph", "single_node": "./tests/graphs/single_node.py:graph", "benchmark": "./tests/graphs/benchmark.py:graph", "config_graph": "./tests/graphs/config_graph.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
58
58
|
LANGGRAPH_STORE='$(STORE_CONFIG)' \
|
|
59
59
|
LANGGRAPH_CONFIG='{"agent": {"configurable": {"model_name": "openai"}}}' \
|
|
60
60
|
LANGSMITH_LANGGRAPH_API_VARIANT=test \
|
|
@@ -77,7 +77,7 @@ start-auth-jwt:
|
|
|
77
77
|
LANGGRAPH_RUNTIME_EDITION=inmem LANGGRAPH_HTTP='$(HTTP_CONFIG)' \
|
|
78
78
|
LANGGRAPH_AES_KEY='$(LANGGRAPH_AES_KEY)' \
|
|
79
79
|
N_JOBS_PER_WORKER=2 \
|
|
80
|
-
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
80
|
+
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "config_graph": "./tests/graphs/config_graph.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
81
81
|
LANGGRAPH_STORE='$(STORE_CONFIG)' \
|
|
82
82
|
LANGGRAPH_AUTH='{"path": "tests/graphs/jwt_auth.py:auth"}' \
|
|
83
83
|
LANGSMITH_LANGGRAPH_API_VARIANT=test \
|
|
@@ -95,7 +95,7 @@ start-auth-jwt:
|
|
|
95
95
|
start-auth-fastapi-jwt:
|
|
96
96
|
LANGGRAPH_RUNTIME_EDITION=inmem LANGGRAPH_HTTP='$(HTTP_CONFIG)' \
|
|
97
97
|
N_JOBS_PER_WORKER=2 \
|
|
98
|
-
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
98
|
+
LANGSERVE_GRAPHS='{"agent": "./tests/graphs/agent.py:graph", "config_graph": "./tests/graphs/config_graph.py:graph", "other": "./tests/graphs/other.py:make_graph", "weather": "./tests/graphs/weather.py:mk_weather_graph", "searchy": "./tests/graphs/searchy.py:graph", "agent_simple": "./tests/graphs/agent_simple.py:graph", "simple_runtime": "./tests/graphs/simple_runtime.py:graph"}' \
|
|
99
99
|
LANGGRAPH_STORE='$(STORE_CONFIG)' \
|
|
100
100
|
LANGGRAPH_AUTH='{"path": "./tests/graphs/fastapi_jwt_auth.py:auth"}' \
|
|
101
101
|
LANGSMITH_LANGGRAPH_API_VARIANT=test \
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.129"
|
|
@@ -275,6 +275,20 @@ async def create_valid_run(
|
|
|
275
275
|
config = payload.get("config") or {}
|
|
276
276
|
context = payload.get("context") or {}
|
|
277
277
|
configurable = config.setdefault("configurable", {})
|
|
278
|
+
|
|
279
|
+
if configurable and context:
|
|
280
|
+
raise HTTPException(
|
|
281
|
+
status_code=400,
|
|
282
|
+
detail="Cannot specify both configurable and context. Prefer setting context alone. Context was introduced in LangGraph 0.6.0 and is the long term planned replacement for configurable.",
|
|
283
|
+
)
|
|
284
|
+
|
|
285
|
+
# Keep config and context in sync for user provided params
|
|
286
|
+
if context:
|
|
287
|
+
configurable = context.copy()
|
|
288
|
+
config["configurable"] = configurable
|
|
289
|
+
else:
|
|
290
|
+
context = configurable.copy()
|
|
291
|
+
|
|
278
292
|
if checkpoint_id:
|
|
279
293
|
configurable["checkpoint_id"] = str(checkpoint_id)
|
|
280
294
|
if checkpoint := payload.get("checkpoint"):
|
|
@@ -300,6 +314,7 @@ async def create_valid_run(
|
|
|
300
314
|
configurable["__after_seconds__"] = after_seconds
|
|
301
315
|
put_time_start = time.time()
|
|
302
316
|
if_not_exists = payload.get("if_not_exists", "reject")
|
|
317
|
+
|
|
303
318
|
run_coro = Runs.put(
|
|
304
319
|
conn,
|
|
305
320
|
assistant_id,
|
|
@@ -71,7 +71,11 @@ middleware.extend(
|
|
|
71
71
|
allow_credentials=True,
|
|
72
72
|
allow_methods=["*"],
|
|
73
73
|
allow_headers=["*"],
|
|
74
|
-
expose_headers=[
|
|
74
|
+
expose_headers=[
|
|
75
|
+
"x-pagination-total",
|
|
76
|
+
"x-pagination-next",
|
|
77
|
+
"content-location",
|
|
78
|
+
],
|
|
75
79
|
)
|
|
76
80
|
if config.CORS_CONFIG is None
|
|
77
81
|
else Middleware(
|
|
@@ -40,6 +40,42 @@ from langgraph_runtime.ops import Runs
|
|
|
40
40
|
|
|
41
41
|
logger = structlog.stdlib.get_logger(__name__)
|
|
42
42
|
|
|
43
|
+
|
|
44
|
+
async def _filter_context_by_schema(
|
|
45
|
+
context: dict[str, Any], context_schema: dict | None
|
|
46
|
+
) -> dict[str, Any]:
|
|
47
|
+
"""Filter context parameters based on the context schema.
|
|
48
|
+
|
|
49
|
+
Args:
|
|
50
|
+
context: The context dictionary to filter
|
|
51
|
+
context_schema: The JSON schema for valid context parameters
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
Filtered context dictionary containing only valid parameters
|
|
55
|
+
"""
|
|
56
|
+
if not context_schema or not context:
|
|
57
|
+
return context
|
|
58
|
+
|
|
59
|
+
# Extract valid properties from the schema
|
|
60
|
+
properties = context_schema.get("properties", {})
|
|
61
|
+
if not properties:
|
|
62
|
+
return context
|
|
63
|
+
|
|
64
|
+
# Filter context to only include parameters defined in the schema
|
|
65
|
+
filtered_context = {}
|
|
66
|
+
for key, value in context.items():
|
|
67
|
+
if key in properties:
|
|
68
|
+
filtered_context[key] = value
|
|
69
|
+
else:
|
|
70
|
+
await logger.adebug(
|
|
71
|
+
f"Filtering out context parameter '{key}' not found in context schema",
|
|
72
|
+
context_key=key,
|
|
73
|
+
available_keys=list(properties.keys()),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
return filtered_context
|
|
77
|
+
|
|
78
|
+
|
|
43
79
|
AnyStream = AsyncIterator[tuple[str, Any]]
|
|
44
80
|
|
|
45
81
|
|
|
@@ -107,6 +143,17 @@ async def astream_state(
|
|
|
107
143
|
checkpointer=None if temporary else Checkpointer(),
|
|
108
144
|
)
|
|
109
145
|
)
|
|
146
|
+
|
|
147
|
+
# Filter context parameters based on context schema if available
|
|
148
|
+
if context and USE_RUNTIME_CONTEXT_API and not isinstance(graph, BaseRemotePregel):
|
|
149
|
+
try:
|
|
150
|
+
context_schema = graph.get_context_jsonschema()
|
|
151
|
+
context = await _filter_context_by_schema(context, context_schema)
|
|
152
|
+
except Exception as e:
|
|
153
|
+
await logger.adebug(
|
|
154
|
+
f"Failed to get context schema for filtering: {e}", exc_info=e
|
|
155
|
+
)
|
|
156
|
+
|
|
110
157
|
input = kwargs.pop("input")
|
|
111
158
|
if cmd := kwargs.pop("command"):
|
|
112
159
|
input = map_cmd(cmd)
|
|
@@ -348,7 +395,17 @@ async def astream_state(
|
|
|
348
395
|
yield "feedback", feedback_urls
|
|
349
396
|
|
|
350
397
|
|
|
351
|
-
async def consume(
|
|
398
|
+
async def consume(
|
|
399
|
+
stream: AnyStream,
|
|
400
|
+
run_id: str,
|
|
401
|
+
resumable: bool = False,
|
|
402
|
+
stream_modes: set[StreamMode] | None = None,
|
|
403
|
+
) -> None:
|
|
404
|
+
stream_modes = stream_modes or set()
|
|
405
|
+
if "messages-tuple" in stream_modes:
|
|
406
|
+
stream_modes.add("messages")
|
|
407
|
+
stream_modes.add("metadata")
|
|
408
|
+
|
|
352
409
|
async with aclosing(stream):
|
|
353
410
|
try:
|
|
354
411
|
async for mode, payload in stream:
|
|
@@ -356,7 +413,7 @@ async def consume(stream: AnyStream, run_id: str, resumable: bool = False) -> No
|
|
|
356
413
|
run_id,
|
|
357
414
|
mode,
|
|
358
415
|
await run_in_executor(None, json_dumpb, payload),
|
|
359
|
-
resumable=resumable,
|
|
416
|
+
resumable=resumable and mode.split("|")[0] in stream_modes,
|
|
360
417
|
)
|
|
361
418
|
except Exception as e:
|
|
362
419
|
if isinstance(e, ExceptionGroup):
|
|
@@ -365,7 +422,6 @@ async def consume(stream: AnyStream, run_id: str, resumable: bool = False) -> No
|
|
|
365
422
|
run_id,
|
|
366
423
|
"error",
|
|
367
424
|
await run_in_executor(None, json_dumpb, e),
|
|
368
|
-
resumable=resumable,
|
|
369
425
|
)
|
|
370
426
|
raise e
|
|
371
427
|
|
|
@@ -20,7 +20,7 @@ from langgraph_api.config import (
|
|
|
20
20
|
from langgraph_api.errors import UserInterrupt, UserRollback, UserTimeout
|
|
21
21
|
from langgraph_api.js.errors import RemoteException
|
|
22
22
|
from langgraph_api.metadata import incr_runs
|
|
23
|
-
from langgraph_api.schema import Run
|
|
23
|
+
from langgraph_api.schema import Run, StreamMode
|
|
24
24
|
from langgraph_api.state import state_snapshot_to_thread_state
|
|
25
25
|
from langgraph_api.stream import AnyStream, astream_state, consume
|
|
26
26
|
from langgraph_api.utils import with_user
|
|
@@ -130,9 +130,11 @@ async def worker(
|
|
|
130
130
|
break
|
|
131
131
|
|
|
132
132
|
# Wrap the graph execution to separate user errors from server errors
|
|
133
|
-
async def wrap_user_errors(
|
|
133
|
+
async def wrap_user_errors(
|
|
134
|
+
stream: AnyStream, run_id: str, resumable: bool, stream_modes: set[StreamMode]
|
|
135
|
+
):
|
|
134
136
|
try:
|
|
135
|
-
await consume(stream, run_id, resumable)
|
|
137
|
+
await consume(stream, run_id, resumable, stream_modes)
|
|
136
138
|
except Exception as e:
|
|
137
139
|
if not isinstance(e, UserRollback | UserInterrupt):
|
|
138
140
|
logger.error(
|
|
@@ -184,8 +186,11 @@ async def worker(
|
|
|
184
186
|
on_checkpoint=on_checkpoint,
|
|
185
187
|
on_task_result=on_task_result,
|
|
186
188
|
)
|
|
189
|
+
stream_modes: set[StreamMode] = set(
|
|
190
|
+
run["kwargs"].get("stream_mode", [])
|
|
191
|
+
)
|
|
187
192
|
await asyncio.wait_for(
|
|
188
|
-
wrap_user_errors(stream, run_id, resumable),
|
|
193
|
+
wrap_user_errors(stream, run_id, resumable, stream_modes),
|
|
189
194
|
BG_JOB_TIMEOUT_SECS,
|
|
190
195
|
)
|
|
191
196
|
except (Exception, asyncio.CancelledError) as ee:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.126"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{langgraph_api-0.2.126 → langgraph_api-0.2.129}/langgraph_api/js/src/utils/pythonSchemas.mts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|