langgraph-api 0.0.37__py3-none-any.whl → 0.0.39__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/api/__init__.py +2 -2
- langgraph_api/api/mcp.py +12 -4
- langgraph_api/auth/custom.py +25 -1
- langgraph_api/cli.py +3 -0
- langgraph_api/config.py +2 -0
- langgraph_api/graph.py +38 -12
- langgraph_api/js/base.py +5 -2
- langgraph_api/js/build.mts +10 -3
- langgraph_api/js/client.mts +75 -20
- langgraph_api/js/global.d.ts +1 -0
- langgraph_api/js/package.json +2 -2
- langgraph_api/js/remote.py +50 -10
- langgraph_api/js/src/graph.mts +26 -9
- langgraph_api/js/tests/api.test.mts +164 -93
- langgraph_api/js/tests/compose-postgres.yml +1 -1
- langgraph_api/js/tests/graphs/dynamic.mts +24 -0
- langgraph_api/js/tests/graphs/langgraph.json +1 -0
- langgraph_api/js/tests/utils.mts +5 -5
- langgraph_api/js/yarn.lock +8 -8
- langgraph_api/models/run.py +27 -8
- langgraph_api/worker.py +52 -1
- {langgraph_api-0.0.37.dist-info → langgraph_api-0.0.39.dist-info}/METADATA +5 -3
- {langgraph_api-0.0.37.dist-info → langgraph_api-0.0.39.dist-info}/RECORD +30 -32
- {langgraph_api-0.0.37.dist-info → langgraph_api-0.0.39.dist-info}/WHEEL +1 -1
- langgraph_storage/database.py +7 -7
- langgraph_storage/inmem_stream.py +1 -0
- langgraph_storage/ops.py +5 -3
- langgraph_storage/queue.py +44 -0
- langgraph_api-0.0.37.dist-info/LICENSE +0 -93
- logging.json +0 -22
- openapi.json +0 -4596
- /LICENSE → /langgraph_api-0.0.39.dist-info/LICENSE +0 -0
- {langgraph_api-0.0.37.dist-info → langgraph_api-0.0.39.dist-info}/entry_points.txt +0 -0
langgraph_api/js/src/graph.mts
CHANGED
|
@@ -26,13 +26,17 @@ export function filterValidGraphSpecs(specs: Record<string, string>) {
|
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
export type CompiledGraphFactory<T extends string> = (config: {
|
|
30
|
+
configurable?: Record<string, unknown>;
|
|
31
|
+
}) => Promise<CompiledGraph<T>>;
|
|
32
|
+
|
|
29
33
|
export async function resolveGraph(
|
|
30
34
|
spec: string,
|
|
31
35
|
options?: { onlyFilePresence?: false }
|
|
32
36
|
): Promise<{
|
|
33
37
|
sourceFile: string;
|
|
34
38
|
exportSymbol: string;
|
|
35
|
-
resolved: CompiledGraph<string>;
|
|
39
|
+
resolved: CompiledGraph<string> | CompiledGraphFactory<string>;
|
|
36
40
|
}>;
|
|
37
41
|
|
|
38
42
|
export async function resolveGraph(
|
|
@@ -58,7 +62,9 @@ export async function resolveGraph(
|
|
|
58
62
|
type GraphUnknown =
|
|
59
63
|
| GraphLike
|
|
60
64
|
| Promise<GraphLike>
|
|
61
|
-
| ((
|
|
65
|
+
| ((config: {
|
|
66
|
+
configurable?: Record<string, unknown>;
|
|
67
|
+
}) => GraphLike | Promise<GraphLike>)
|
|
62
68
|
| undefined;
|
|
63
69
|
|
|
64
70
|
const isGraph = (graph: GraphLike): graph is Graph<string> => {
|
|
@@ -71,13 +77,24 @@ export async function resolveGraph(
|
|
|
71
77
|
);
|
|
72
78
|
|
|
73
79
|
// obtain the graph, and if not compiled, compile it
|
|
74
|
-
const resolved: CompiledGraph<string>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
const resolved: CompiledGraph<string> | CompiledGraphFactory<string> =
|
|
81
|
+
await (async () => {
|
|
82
|
+
if (!graph) throw new Error("Failed to load graph: graph is nullush");
|
|
83
|
+
|
|
84
|
+
const afterResolve = (graphLike: GraphLike): CompiledGraph<string> => {
|
|
85
|
+
const graph = isGraph(graphLike) ? graphLike.compile() : graphLike;
|
|
86
|
+
return graph;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (typeof graph === "function") {
|
|
90
|
+
return async (config: { configurable?: Record<string, unknown> }) => {
|
|
91
|
+
const graphLike = await graph(config);
|
|
92
|
+
return afterResolve(graphLike);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return afterResolve(await graph);
|
|
97
|
+
})();
|
|
81
98
|
|
|
82
99
|
return { sourceFile, exportSymbol, resolved };
|
|
83
100
|
}
|