langgraph-api 0.4.38__py3-none-any.whl → 0.4.40__py3-none-any.whl
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/__init__.py +1 -1
- langgraph_api/auth/langsmith/backend.py +3 -2
- langgraph_api/auth/langsmith/client.py +13 -8
- langgraph_api/cli.py +3 -3
- langgraph_api/graph.py +1 -1
- langgraph_api/js/client.http.mts +12 -6
- langgraph_api/server.py +1 -1
- {langgraph_api-0.4.38.dist-info → langgraph_api-0.4.40.dist-info}/METADATA +1 -1
- {langgraph_api-0.4.38.dist-info → langgraph_api-0.4.40.dist-info}/RECORD +13 -13
- openapi.json +1 -1
- {langgraph_api-0.4.38.dist-info → langgraph_api-0.4.40.dist-info}/WHEEL +0 -0
- {langgraph_api-0.4.38.dist-info → langgraph_api-0.4.40.dist-info}/entry_points.txt +0 -0
- {langgraph_api-0.4.38.dist-info → langgraph_api-0.4.40.dist-info}/licenses/LICENSE +0 -0
langgraph_api/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.4.
|
|
1
|
+
__version__ = "0.4.40"
|
|
@@ -30,10 +30,11 @@ class AuthCacheEntry(TypedDict):
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
class LangsmithAuthBackend(AuthenticationBackend):
|
|
33
|
-
def __init__(self):
|
|
33
|
+
def __init__(self, *, base_url: str | None = None):
|
|
34
34
|
from langgraph_api.utils.cache import LRUCache
|
|
35
35
|
|
|
36
36
|
self._cache = LRUCache[AuthCacheEntry](max_size=1000, ttl=60)
|
|
37
|
+
self._base_url = base_url
|
|
37
38
|
|
|
38
39
|
def _get_cache_key(self, headers):
|
|
39
40
|
"""Generate cache key from authentication headers"""
|
|
@@ -61,7 +62,7 @@ class LangsmithAuthBackend(AuthenticationBackend):
|
|
|
61
62
|
if cached_entry := await self._cache.get(cache_key):
|
|
62
63
|
return cached_entry["credentials"], cached_entry["user"]
|
|
63
64
|
|
|
64
|
-
async with auth_client() as auth:
|
|
65
|
+
async with auth_client(base_url=self._base_url) as auth:
|
|
65
66
|
if not LANGSMITH_AUTH_VERIFY_TENANT_ID and not conn.headers.get(
|
|
66
67
|
"x-api-key"
|
|
67
68
|
):
|
|
@@ -85,8 +85,10 @@ class JsonHttpClient:
|
|
|
85
85
|
)
|
|
86
86
|
|
|
87
87
|
|
|
88
|
-
def create_client() -> JsonHttpClient:
|
|
88
|
+
def create_client(base_url: str | None = None) -> JsonHttpClient:
|
|
89
89
|
"""Create the auth http client."""
|
|
90
|
+
url = base_url if base_url is not None else LANGSMITH_AUTH_ENDPOINT
|
|
91
|
+
|
|
90
92
|
return JsonHttpClient(
|
|
91
93
|
httpx.AsyncClient(
|
|
92
94
|
transport=httpx.AsyncHTTPTransport(
|
|
@@ -97,7 +99,7 @@ def create_client() -> JsonHttpClient:
|
|
|
97
99
|
),
|
|
98
100
|
),
|
|
99
101
|
timeout=httpx.Timeout(2.0),
|
|
100
|
-
base_url=
|
|
102
|
+
base_url=url,
|
|
101
103
|
)
|
|
102
104
|
)
|
|
103
105
|
|
|
@@ -109,20 +111,23 @@ async def close_auth_client() -> None:
|
|
|
109
111
|
await _client.client.aclose()
|
|
110
112
|
|
|
111
113
|
|
|
112
|
-
async def initialize_auth_client() -> None:
|
|
114
|
+
async def initialize_auth_client(base_url: str | None = None) -> None:
|
|
113
115
|
"""Initialize the auth http client."""
|
|
114
116
|
await close_auth_client()
|
|
115
117
|
global _client
|
|
116
|
-
_client = create_client()
|
|
118
|
+
_client = create_client(base_url=base_url)
|
|
117
119
|
|
|
118
120
|
|
|
119
121
|
@asynccontextmanager
|
|
120
|
-
async def auth_client(
|
|
122
|
+
async def auth_client(
|
|
123
|
+
base_url: str | None = None,
|
|
124
|
+
) -> AsyncGenerator[JsonHttpClient, None]:
|
|
121
125
|
"""Get the auth http client."""
|
|
126
|
+
url = base_url if base_url is not None else LANGSMITH_AUTH_ENDPOINT
|
|
122
127
|
# pytest does something funny with event loops,
|
|
123
128
|
# so we can't use a global pool for tests
|
|
124
|
-
if
|
|
125
|
-
client = create_client()
|
|
129
|
+
if url.startswith("http://localhost"):
|
|
130
|
+
client = create_client(base_url=url)
|
|
126
131
|
try:
|
|
127
132
|
yield client
|
|
128
133
|
finally:
|
|
@@ -135,5 +140,5 @@ async def auth_client() -> AsyncGenerator[JsonHttpClient, None]:
|
|
|
135
140
|
if found:
|
|
136
141
|
yield _client
|
|
137
142
|
else:
|
|
138
|
-
await initialize_auth_client()
|
|
143
|
+
await initialize_auth_client(base_url=url)
|
|
139
144
|
yield _client
|
langgraph_api/cli.py
CHANGED
|
@@ -299,7 +299,7 @@ def run_server(
|
|
|
299
299
|
f"Server started in {time.time() - start_time:.2f}s"
|
|
300
300
|
)
|
|
301
301
|
thread_logger.info(
|
|
302
|
-
"🎨 Opening
|
|
302
|
+
"🎨 Opening Studio in your browser..."
|
|
303
303
|
)
|
|
304
304
|
thread_logger.info("URL: " + full_studio_url)
|
|
305
305
|
webbrowser.open(full_studio_url)
|
|
@@ -317,11 +317,11 @@ def run_server(
|
|
|
317
317
|
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴
|
|
318
318
|
|
|
319
319
|
- 🚀 API: \033[36m{local_url}\033[0m
|
|
320
|
-
- 🎨
|
|
320
|
+
- 🎨 Studio UI: \033[36m{full_studio_url}\033[0m
|
|
321
321
|
- 📚 API Docs: \033[36m{local_url}/docs\033[0m
|
|
322
322
|
|
|
323
323
|
This in-memory server is designed for development and testing.
|
|
324
|
-
For production use, please use
|
|
324
|
+
For production use, please use LangSmith Deployment.
|
|
325
325
|
|
|
326
326
|
"""
|
|
327
327
|
logger.info(welcome)
|
langgraph_api/graph.py
CHANGED
|
@@ -362,7 +362,7 @@ async def collect_graphs_from_env(register: bool = False) -> None:
|
|
|
362
362
|
if lg_api_config.API_VARIANT == "local_dev":
|
|
363
363
|
raise NotImplementedError(
|
|
364
364
|
"LangGraph.JS graphs are not yet supported in local development mode. "
|
|
365
|
-
"To run your JS graphs, either use the
|
|
365
|
+
"To run your JS graphs, either use the LangGraph Studio application "
|
|
366
366
|
"or run `langgraph up` to start the server in a Docker container."
|
|
367
367
|
)
|
|
368
368
|
import sys
|
langgraph_api/js/client.http.mts
CHANGED
|
@@ -47,7 +47,9 @@ const wrapHonoApp = (app: Hono) => {
|
|
|
47
47
|
// b/c the user's Hono version might be different than ours.
|
|
48
48
|
// See warning here: https://hono.dev/docs/guides/middleware#built-in-middleware
|
|
49
49
|
const newApp = new (Object.getPrototypeOf(app).constructor)() as Hono<{
|
|
50
|
-
Variables: {
|
|
50
|
+
Variables: {
|
|
51
|
+
"langgraph:body": string | ArrayBuffer | ReadableStream | null;
|
|
52
|
+
};
|
|
51
53
|
}>;
|
|
52
54
|
|
|
53
55
|
// This endpoint is used to check if we can yield the routing to the Python server early.
|
|
@@ -71,11 +73,15 @@ const wrapHonoApp = (app: Hono) => {
|
|
|
71
73
|
newApp.notFound(async (c) => {
|
|
72
74
|
// Send the request body back to the Python server
|
|
73
75
|
// Use the cached body in-case the user mutated the body
|
|
74
|
-
let payload:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
let payload: string | ArrayBuffer | ReadableStream | null =
|
|
77
|
+
c.get("langgraph:body");
|
|
78
|
+
|
|
79
|
+
if (payload == null) {
|
|
80
|
+
try {
|
|
81
|
+
payload = JSON.stringify(await c.req.json()) ?? null;
|
|
82
|
+
} catch {
|
|
83
|
+
// pass
|
|
84
|
+
}
|
|
79
85
|
}
|
|
80
86
|
|
|
81
87
|
return c.body(payload, {
|
langgraph_api/server.py
CHANGED
|
@@ -117,7 +117,7 @@ def update_openapi_spec(app):
|
|
|
117
117
|
schemas = SchemaGenerator(
|
|
118
118
|
{
|
|
119
119
|
"openapi": "3.1.0",
|
|
120
|
-
"info": {"title": "
|
|
120
|
+
"info": {"title": "LangSmith Deployment", "version": "0.1.0"},
|
|
121
121
|
}
|
|
122
122
|
)
|
|
123
123
|
spec = schemas.get_schema(routes=app.routes)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
langgraph_api/__init__.py,sha256=
|
|
1
|
+
langgraph_api/__init__.py,sha256=pha_-Rd-dI-gM_t5o_SGFnaO84vxXW0uH3Bs10X8-DE,23
|
|
2
2
|
langgraph_api/asgi_transport.py,sha256=XtiLOu4WWsd-xizagBLzT5xUkxc9ZG9YqwvETBPjBFE,5161
|
|
3
3
|
langgraph_api/asyncio.py,sha256=FEEkLm_N-15cbElo4vQ309MkDKBZuRqAYV8VJ1DocNw,9860
|
|
4
|
-
langgraph_api/cli.py,sha256=
|
|
4
|
+
langgraph_api/cli.py,sha256=Yl2GOChDChsoJcYAk8HhkuR1YKTy8rmbYlS5doqWBpk,19671
|
|
5
5
|
langgraph_api/command.py,sha256=Bh-rvuTLwdHCqFWryCjB1M8oWxPBwRBUjMNj_04KPxM,852
|
|
6
6
|
langgraph_api/config.py,sha256=gO25XRPc19Room51P3FewE54pSFvfwuVDtvyjkDSzEs,13251
|
|
7
7
|
langgraph_api/cron_scheduler.py,sha256=25wYzEQrhPEivZrAPYOmzLPDOQa-aFogU37mTXc9TJk,2566
|
|
8
8
|
langgraph_api/errors.py,sha256=zlnl3xXIwVG0oGNKKpXf1an9Rn_SBDHSyhe53hU6aLw,1858
|
|
9
9
|
langgraph_api/executor_entrypoint.py,sha256=CaX813ygtf9CpOaBkfkQXJAHjFtmlScCkrOvTDmu4Aw,750
|
|
10
10
|
langgraph_api/feature_flags.py,sha256=taZRhukeBV8r62EmEo92rxfBwYhIw56-P_UvSzQLzt8,576
|
|
11
|
-
langgraph_api/graph.py,sha256=
|
|
11
|
+
langgraph_api/graph.py,sha256=YDNncFFnjOjX_ylHDVY3Z4Ehj62zyHFJPaiRCkLAZus,25285
|
|
12
12
|
langgraph_api/http.py,sha256=fyK-H-0UfNy_BzuVW3aWWGvhRavmGAVMkDwDArryJ_4,5659
|
|
13
13
|
langgraph_api/http_metrics.py,sha256=vw3UT9uj9qgxQ_DwJq77HGZqh6LHSjyxylWhqkf2jAw,5095
|
|
14
14
|
langgraph_api/http_metrics_utils.py,sha256=sjxF7SYGTzY0Wz_G0dzatsYNnWr31S6ujej4JmBG2yo,866
|
|
@@ -21,7 +21,7 @@ langgraph_api/schema.py,sha256=spZ_XPT4AMJfw2YatsdnMZZLzgB9Sm3YR8n0SlgGdJ8,8480
|
|
|
21
21
|
langgraph_api/self_hosted_logs.py,sha256=9ljOz3KH3O1SwsD7eTKnreyJ80NbeR7nj7SuxBlrmCc,4422
|
|
22
22
|
langgraph_api/self_hosted_metrics.py,sha256=3FFezxjU0Vs-bsH39f4Dcwn7fporTLHV9REQ3UQ315A,14004
|
|
23
23
|
langgraph_api/serde.py,sha256=Jkww6ixP5o2YZmnXtM7ihuAYC6YSuNDNPvE-8ILoqVo,5499
|
|
24
|
-
langgraph_api/server.py,sha256=
|
|
24
|
+
langgraph_api/server.py,sha256=h4qeDzcEYF8NFCrTkpL1gsXXFbd7P2JN_wVpmy1Fgwg,9658
|
|
25
25
|
langgraph_api/sse.py,sha256=SLdtZmTdh5D8fbWrQjuY9HYLd2dg8Rmi6ZMmFMVc2iE,4204
|
|
26
26
|
langgraph_api/state.py,sha256=AjkLbUQakIwK7oGzJ8oqubazRsXxG3vDMnRa0s0mzDM,4716
|
|
27
27
|
langgraph_api/store.py,sha256=NIoNZojs6NbtG3VLBPQEFNttvp7XPkHAfjbQ3gY7aLY,4701
|
|
@@ -47,8 +47,8 @@ langgraph_api/auth/middleware.py,sha256=jDA4t41DUoAArEY_PNoXesIUBJ0nGhh85QzRdn5E
|
|
|
47
47
|
langgraph_api/auth/noop.py,sha256=Bk6Nf3p8D_iMVy_OyfPlyiJp_aEwzL-sHrbxoXpCbac,586
|
|
48
48
|
langgraph_api/auth/studio_user.py,sha256=fojJpexdIZYI1w3awiqOLSwMUiK_M_3p4mlfQI0o-BE,454
|
|
49
49
|
langgraph_api/auth/langsmith/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
50
|
-
langgraph_api/auth/langsmith/backend.py,sha256=
|
|
51
|
-
langgraph_api/auth/langsmith/client.py,sha256=
|
|
50
|
+
langgraph_api/auth/langsmith/backend.py,sha256=JVf8-q1IvB5EeiLJge3cOtPvDg6qHzK_4cR-R8hPXXQ,3753
|
|
51
|
+
langgraph_api/auth/langsmith/client.py,sha256=79kwCVeHU64nsHsxWipfZhf44lM6vfs2nlfTxlJF6LU,4142
|
|
52
52
|
langgraph_api/grpc_ops/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
53
53
|
langgraph_api/grpc_ops/client.py,sha256=VB740C9QMhJJrpAEjsADmasN-uGd0apGYtuv_ho0Rl8,2452
|
|
54
54
|
langgraph_api/grpc_ops/ops.py,sha256=VFmFIgXZmE3Xi1tGx-eZrqls6qMG0w5a2Ym7w2Wm9Iw,19733
|
|
@@ -61,7 +61,7 @@ langgraph_api/js/.prettierrc,sha256=0es3ovvyNIqIw81rPQsdt1zCQcOdBqyR_DMbFE4Ifms,
|
|
|
61
61
|
langgraph_api/js/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
62
62
|
langgraph_api/js/base.py,sha256=CJihwc51MwOVkis80f8zudRa1fQz_5jrom4rY8trww8,1133
|
|
63
63
|
langgraph_api/js/build.mts,sha256=wguMiExRjJYpnxol_IxNHuC65CnJFsasQhZiIVSZZq8,3377
|
|
64
|
-
langgraph_api/js/client.http.mts,sha256=
|
|
64
|
+
langgraph_api/js/client.http.mts,sha256=ZnikriJdcRSkBmUTBFMpLB3GKgK4xbiSqtUE-l9nqeM,4880
|
|
65
65
|
langgraph_api/js/client.mts,sha256=gDvYiW7Qfl4re2YhZ5oNqtuvffnW_Sf7DK5aUbKB3vw,32330
|
|
66
66
|
langgraph_api/js/errors.py,sha256=Cm1TKWlUCwZReDC5AQ6SgNIVGD27Qov2xcgHyf8-GXo,361
|
|
67
67
|
langgraph_api/js/global.d.ts,sha256=j4GhgtQSZ5_cHzjSPcHgMJ8tfBThxrH-pUOrrJGteOU,196
|
|
@@ -109,9 +109,9 @@ langgraph_runtime/retry.py,sha256=V0duD01fO7GUQ_btQkp1aoXcEOFhXooGVP6q4yMfuyY,11
|
|
|
109
109
|
langgraph_runtime/store.py,sha256=7mowndlsIroGHv3NpTSOZDJR0lCuaYMBoTnTrewjslw,114
|
|
110
110
|
LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
111
111
|
logging.json,sha256=3RNjSADZmDq38eHePMm1CbP6qZ71AmpBtLwCmKU9Zgo,379
|
|
112
|
-
openapi.json,sha256=
|
|
113
|
-
langgraph_api-0.4.
|
|
114
|
-
langgraph_api-0.4.
|
|
115
|
-
langgraph_api-0.4.
|
|
116
|
-
langgraph_api-0.4.
|
|
117
|
-
langgraph_api-0.4.
|
|
112
|
+
openapi.json,sha256=Oi2tU1b8PsXb-6XNHafQvcZv934vLNQhBNPYXr9e2nU,172620
|
|
113
|
+
langgraph_api-0.4.40.dist-info/METADATA,sha256=jkZKHqP86HksHgYEeZRc-IZwhLeB1AOvLRlSv13eNYI,4156
|
|
114
|
+
langgraph_api-0.4.40.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
115
|
+
langgraph_api-0.4.40.dist-info/entry_points.txt,sha256=hGedv8n7cgi41PypMfinwS_HfCwA7xJIfS0jAp8htV8,78
|
|
116
|
+
langgraph_api-0.4.40.dist-info/licenses/LICENSE,sha256=ZPwVR73Biwm3sK6vR54djCrhaRiM4cAD2zvOQZV8Xis,3859
|
|
117
|
+
langgraph_api-0.4.40.dist-info/RECORD,,
|
openapi.json
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|