langgraph-api 0.2.86__tar.gz → 0.2.89__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.86 → langgraph_api-0.2.89}/PKG-INFO +2 -2
- langgraph_api-0.2.89/langgraph_api/__init__.py +1 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/langsmith/backend.py +2 -1
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/config.py +4 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/client.mts +2 -1
- langgraph_api-0.2.89/langgraph_api/js/traceblock.mts +25 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/models/run.py +3 -2
- langgraph_api-0.2.89/langgraph_api/traceblock.py +22 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/worker.py +39 -27
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/pyproject.toml +1 -1
- langgraph_api-0.2.86/langgraph_api/__init__.py +0 -1
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/.gitignore +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/LICENSE +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/Makefile +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/README.md +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/.gitignore +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/Makefile +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/README.md +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/burst.js +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/ramp.js +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/benchmark/weather.js +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/constraints.txt +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/forbidden.txt +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/healthcheck.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/assistants.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/mcp.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/meta.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/openapi.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/runs.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/store.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/threads.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/api/ui.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/asgi_transport.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/asyncio.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/custom.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/langsmith/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/langsmith/client.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/middleware.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/noop.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/auth/studio_user.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/cli.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/command.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/cron_scheduler.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/errors.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/graph.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/http.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/http_metrics.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/.gitignore +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/.prettierrc +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/base.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/build.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/client.http.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/errors.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/global.d.ts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/package.json +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/remote.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/schema.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/graph.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/load.hooks.mjs +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/preload.mjs +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/utils/files.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/utils/importMap.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/utils/pythonSchemas.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/src/utils/serde.mts +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/sse.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/tsconfig.json +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/ui.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/js/yarn.lock +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/logging.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/metadata.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/middleware/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/middleware/http_logger.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/middleware/private_network.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/middleware/request_id.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/models/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/patch.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/queue_entrypoint.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/route.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/schema.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/serde.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/server.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/sse.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/state.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/store.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/stream.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/thread_ttl.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/tunneling/cloudflare.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/utils/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/utils/cache.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/utils/config.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/utils/future.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/utils.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/validation.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_api/webhook.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_license/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_license/validation.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/__init__.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/checkpoint.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/database.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/lifespan.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/metrics.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/ops.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/queue.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/retry.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/langgraph_runtime/store.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/logging.json +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/openapi.json +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/scripts/create_license.py +0 -0
- {langgraph_api-0.2.86 → langgraph_api-0.2.89}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langgraph-api
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.89
|
|
4
4
|
Author-email: Nuno Campos <nuno@langchain.dev>, Will Fu-Hinthorn <will@langchain.dev>
|
|
5
5
|
License: Elastic-2.0
|
|
6
6
|
License-File: LICENSE
|
|
@@ -11,7 +11,7 @@ Requires-Dist: httpx>=0.25.0
|
|
|
11
11
|
Requires-Dist: jsonschema-rs<0.30,>=0.20.0
|
|
12
12
|
Requires-Dist: langchain-core>=0.3.64
|
|
13
13
|
Requires-Dist: langgraph-checkpoint>=2.0.23
|
|
14
|
-
Requires-Dist: langgraph-runtime-inmem<0.
|
|
14
|
+
Requires-Dist: langgraph-runtime-inmem<0.5,>=0.4.0
|
|
15
15
|
Requires-Dist: langgraph-sdk>=0.1.71
|
|
16
16
|
Requires-Dist: langgraph>=0.3.27
|
|
17
17
|
Requires-Dist: langsmith>=0.3.45
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.2.89"
|
|
@@ -14,7 +14,6 @@ from langgraph_api.config import (
|
|
|
14
14
|
LANGSMITH_AUTH_VERIFY_TENANT_ID,
|
|
15
15
|
LANGSMITH_TENANT_ID,
|
|
16
16
|
)
|
|
17
|
-
from langgraph_api.utils.cache import LRUCache
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
class AuthDict(TypedDict):
|
|
@@ -31,6 +30,8 @@ class AuthCacheEntry(TypedDict):
|
|
|
31
30
|
|
|
32
31
|
class LangsmithAuthBackend(AuthenticationBackend):
|
|
33
32
|
def __init__(self):
|
|
33
|
+
from langgraph_api.utils.cache import LRUCache
|
|
34
|
+
|
|
34
35
|
self._cache = LRUCache[AuthCacheEntry](max_size=1000, ttl=60)
|
|
35
36
|
|
|
36
37
|
def _get_cache_key(self, headers):
|
|
@@ -6,6 +6,8 @@ import orjson
|
|
|
6
6
|
from starlette.config import Config, undefined
|
|
7
7
|
from starlette.datastructures import CommaSeparatedStrings
|
|
8
8
|
|
|
9
|
+
from langgraph_api import traceblock
|
|
10
|
+
|
|
9
11
|
# types
|
|
10
12
|
|
|
11
13
|
|
|
@@ -372,3 +374,5 @@ if not os.getenv("LANGCHAIN_REVISION_ID") and (
|
|
|
372
374
|
# This is respected by the langsmith SDK env inference
|
|
373
375
|
# https://github.com/langchain-ai/langsmith-sdk/blob/1b93e4c13b8369d92db891ae3babc3e2254f0e56/python/langsmith/env/_runtime_env.py#L190
|
|
374
376
|
os.environ["LANGCHAIN_REVISION_ID"] = ref_sha
|
|
377
|
+
|
|
378
|
+
traceblock.patch_requests()
|
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
getStaticGraphSchema,
|
|
57
57
|
} from "@langchain/langgraph-api/schema";
|
|
58
58
|
import { filterValidExportPath } from "./src/utils/files.mts";
|
|
59
|
+
import { patchFetch } from "./traceblock.mts";
|
|
59
60
|
|
|
60
61
|
const logger = createLogger({
|
|
61
62
|
level: "debug",
|
|
@@ -1114,6 +1115,6 @@ async function getNodesExecutedRequest(
|
|
|
1114
1115
|
nodesExecuted = 0;
|
|
1115
1116
|
return { nodesExecuted: value };
|
|
1116
1117
|
}
|
|
1117
|
-
|
|
1118
|
+
patchFetch();
|
|
1118
1119
|
asyncExitHook(() => awaitAllCallbacks(), { wait: 3_000 });
|
|
1119
1120
|
main();
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { overrideFetchImplementation } from "langsmith";
|
|
2
|
+
|
|
3
|
+
const RUNS_RE = /^https:\/\/api\.smith\.langchain\.com\/.*runs(\/|$)/i;
|
|
4
|
+
|
|
5
|
+
export function patchFetch() {
|
|
6
|
+
const shouldBlock =
|
|
7
|
+
typeof process !== "undefined" &&
|
|
8
|
+
!!(process.env && process.env.LANGSMITH_DISABLE_SAAS_RUNS === "true");
|
|
9
|
+
|
|
10
|
+
if (shouldBlock) {
|
|
11
|
+
overrideFetchImplementation(
|
|
12
|
+
async (input: RequestInfo, init?: RequestInit) => {
|
|
13
|
+
const req = input instanceof Request ? input : new Request(input, init);
|
|
14
|
+
|
|
15
|
+
if (req.method.toUpperCase() === "POST" && RUNS_RE.test(req.url)) {
|
|
16
|
+
throw new Error(
|
|
17
|
+
`Policy-blocked POST to ${new URL(req.url).pathname} — run tracking disabled`,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return fetch(req);
|
|
22
|
+
},
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -312,6 +312,7 @@ async def create_valid_run(
|
|
|
312
312
|
after_seconds = payload.get("after_seconds", 0)
|
|
313
313
|
configurable["__after_seconds__"] = after_seconds
|
|
314
314
|
put_time_start = time.time()
|
|
315
|
+
if_not_exists = payload.get("if_not_exists", "reject")
|
|
315
316
|
run_coro = Runs.put(
|
|
316
317
|
conn,
|
|
317
318
|
assistant_id,
|
|
@@ -337,7 +338,7 @@ async def create_valid_run(
|
|
|
337
338
|
multitask_strategy=multitask_strategy,
|
|
338
339
|
prevent_insert_if_inflight=prevent_insert_if_inflight,
|
|
339
340
|
after_seconds=after_seconds,
|
|
340
|
-
if_not_exists=
|
|
341
|
+
if_not_exists=if_not_exists,
|
|
341
342
|
)
|
|
342
343
|
run_ = await run_coro
|
|
343
344
|
|
|
@@ -364,7 +365,7 @@ async def create_valid_run(
|
|
|
364
365
|
stream_mode=stream_mode,
|
|
365
366
|
temporary=temporary,
|
|
366
367
|
after_seconds=after_seconds,
|
|
367
|
-
if_not_exists=
|
|
368
|
+
if_not_exists=if_not_exists,
|
|
368
369
|
run_create_ms=(
|
|
369
370
|
int(time.time() * 1_000) - request_start_time
|
|
370
371
|
if request_start_time
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from urllib.parse import urlparse
|
|
3
|
+
|
|
4
|
+
from requests.sessions import Session
|
|
5
|
+
|
|
6
|
+
_HOST = "api.smith.langchain.com"
|
|
7
|
+
_PATH_PREFIX = "/runs"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def patch_requests():
|
|
11
|
+
if os.getenv("LANGSMITH_DISABLE_SAAS_RUNS") != "true":
|
|
12
|
+
return
|
|
13
|
+
_orig = Session.request
|
|
14
|
+
|
|
15
|
+
def _guard(self, method, url, *a, **kw):
|
|
16
|
+
if method.upper() == "POST":
|
|
17
|
+
u = urlparse(url)
|
|
18
|
+
if u.hostname == _HOST and _PATH_PREFIX in u.path:
|
|
19
|
+
raise RuntimeError(f"POST to {url} blocked by policy")
|
|
20
|
+
return _orig(self, method, url, *a, **kw)
|
|
21
|
+
|
|
22
|
+
Session.request = _guard
|
|
@@ -113,6 +113,8 @@ async def worker(
|
|
|
113
113
|
run_creation_ms=run_creation_ms,
|
|
114
114
|
run_queue_ms=ms(run_started_at_dt, run["created_at"]),
|
|
115
115
|
run_stream_start_ms=ms(run_stream_started_at_dt, run_started_at_dt),
|
|
116
|
+
temporary=temporary,
|
|
117
|
+
resumable=resumable,
|
|
116
118
|
)
|
|
117
119
|
|
|
118
120
|
def on_checkpoint(checkpoint_arg: CheckpointPayload):
|
|
@@ -242,47 +244,55 @@ async def worker(
|
|
|
242
244
|
run_id=str(run_id),
|
|
243
245
|
run_attempt=attempt,
|
|
244
246
|
)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
247
|
+
if not temporary:
|
|
248
|
+
await Threads.set_joint_status(
|
|
249
|
+
conn, run["thread_id"], run_id, status, checkpoint=checkpoint
|
|
250
|
+
)
|
|
248
251
|
elif isinstance(exception, TimeoutError):
|
|
249
252
|
status = "timeout"
|
|
250
253
|
await logger.awarning(
|
|
251
254
|
"Background run timed out",
|
|
252
255
|
**log_info,
|
|
253
256
|
)
|
|
254
|
-
|
|
255
|
-
conn, run["thread_id"], run_id, status, checkpoint=checkpoint
|
|
256
|
-
)
|
|
257
|
-
elif isinstance(exception, UserRollback):
|
|
258
|
-
status = "rollback"
|
|
259
|
-
try:
|
|
257
|
+
if not temporary:
|
|
260
258
|
await Threads.set_joint_status(
|
|
261
259
|
conn, run["thread_id"], run_id, status, checkpoint=checkpoint
|
|
262
260
|
)
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
261
|
+
elif isinstance(exception, UserRollback):
|
|
262
|
+
status = "rollback"
|
|
263
|
+
if not temporary:
|
|
264
|
+
try:
|
|
265
|
+
await Threads.set_joint_status(
|
|
266
|
+
conn,
|
|
267
|
+
run["thread_id"],
|
|
268
|
+
run_id,
|
|
269
|
+
status,
|
|
270
|
+
checkpoint=checkpoint,
|
|
271
|
+
)
|
|
269
272
|
await logger.ainfo(
|
|
270
|
-
"
|
|
273
|
+
"Background run rolled back",
|
|
271
274
|
**log_info,
|
|
272
275
|
)
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
except HTTPException as e:
|
|
277
|
+
if e.status_code == 404:
|
|
278
|
+
await logger.ainfo(
|
|
279
|
+
"Ignoring rollback error for missing run",
|
|
280
|
+
**log_info,
|
|
281
|
+
)
|
|
282
|
+
else:
|
|
283
|
+
raise
|
|
284
|
+
|
|
285
|
+
checkpoint = None # reset the checkpoint
|
|
277
286
|
elif isinstance(exception, UserInterrupt):
|
|
278
287
|
status = "interrupted"
|
|
279
288
|
await logger.ainfo(
|
|
280
289
|
"Background run interrupted",
|
|
281
290
|
**log_info,
|
|
282
291
|
)
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
292
|
+
if not temporary:
|
|
293
|
+
await Threads.set_joint_status(
|
|
294
|
+
conn, run["thread_id"], run_id, status, checkpoint, exception
|
|
295
|
+
)
|
|
286
296
|
elif isinstance(exception, ALL_RETRIABLE_EXCEPTIONS):
|
|
287
297
|
status = "retry"
|
|
288
298
|
await logger.awarning(
|
|
@@ -290,6 +300,7 @@ async def worker(
|
|
|
290
300
|
**log_info,
|
|
291
301
|
)
|
|
292
302
|
# Don't update thread status yet.
|
|
303
|
+
# Apply this even for temporary runs, so we retry
|
|
293
304
|
await Runs.set_status(conn, run_id, "pending")
|
|
294
305
|
else:
|
|
295
306
|
status = "error"
|
|
@@ -303,13 +314,14 @@ async def worker(
|
|
|
303
314
|
exc_info=not isinstance(exception, RemoteException),
|
|
304
315
|
**log_info,
|
|
305
316
|
)
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
317
|
+
if not temporary:
|
|
318
|
+
await Threads.set_joint_status(
|
|
319
|
+
conn, run["thread_id"], run_id, status, checkpoint, exception
|
|
320
|
+
)
|
|
309
321
|
|
|
310
322
|
# delete thread if it's temporary and we don't want to retry
|
|
311
323
|
if temporary and not isinstance(exception, ALL_RETRIABLE_EXCEPTIONS):
|
|
312
|
-
await Threads.
|
|
324
|
+
await Threads._delete_with_run(conn, run["thread_id"], run_id)
|
|
313
325
|
|
|
314
326
|
if isinstance(exception, ALL_RETRIABLE_EXCEPTIONS):
|
|
315
327
|
await logger.awarning("RETRYING", exc_info=exception)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.2.86"
|
|
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
|
|
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
|