langgraph-api 0.0.13__py3-none-any.whl → 0.0.15__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 -1
- langgraph_api/api/assistants.py +4 -4
- langgraph_api/config.py +1 -0
- langgraph_api/graph.py +6 -13
- langgraph_api/js/base.py +9 -0
- langgraph_api/js/build.mts +2 -0
- langgraph_api/js/client.mts +383 -409
- langgraph_api/js/client.new.mts +856 -0
- langgraph_api/js/errors.py +11 -0
- langgraph_api/js/package.json +2 -0
- langgraph_api/js/remote.py +16 -673
- langgraph_api/js/remote_new.py +685 -0
- langgraph_api/js/remote_old.py +657 -0
- langgraph_api/js/schema.py +29 -0
- langgraph_api/js/src/utils/serde.mts +7 -0
- langgraph_api/js/tests/api.test.mts +35 -1
- langgraph_api/js/tests/compose-postgres.yml +2 -1
- langgraph_api/js/tests/graphs/delay.mts +25 -0
- langgraph_api/js/tests/graphs/langgraph.json +2 -1
- langgraph_api/js/yarn.lock +866 -14
- langgraph_api/queue.py +85 -27
- langgraph_api/stream.py +4 -4
- {langgraph_api-0.0.13.dist-info → langgraph_api-0.0.15.dist-info}/METADATA +2 -2
- {langgraph_api-0.0.13.dist-info → langgraph_api-0.0.15.dist-info}/RECORD +28 -21
- langgraph_storage/ops.py +2 -2
- {langgraph_api-0.0.13.dist-info → langgraph_api-0.0.15.dist-info}/LICENSE +0 -0
- {langgraph_api-0.0.13.dist-info → langgraph_api-0.0.15.dist-info}/WHEEL +0 -0
- {langgraph_api-0.0.13.dist-info → langgraph_api-0.0.15.dist-info}/entry_points.txt +0 -0
|
@@ -447,7 +447,7 @@ describe("runs", () => {
|
|
|
447
447
|
await sql`DELETE FROM store`;
|
|
448
448
|
});
|
|
449
449
|
|
|
450
|
-
it.
|
|
450
|
+
it.concurrent("list runs", async () => {
|
|
451
451
|
const assistant = await client.assistants.create({ graphId: "agent" });
|
|
452
452
|
const thread = await client.threads.create();
|
|
453
453
|
await client.runs.wait(thread.thread_id, assistant.assistant_id, {
|
|
@@ -1650,3 +1650,37 @@ describe("errors", () => {
|
|
|
1650
1650
|
expect(runState.status).toEqual("error");
|
|
1651
1651
|
});
|
|
1652
1652
|
});
|
|
1653
|
+
|
|
1654
|
+
describe("long running tasks", () => {
|
|
1655
|
+
it.concurrent.for([1000, 8000, 12000])(
|
|
1656
|
+
"long running task with %dms delay",
|
|
1657
|
+
{ timeout: 15_000 },
|
|
1658
|
+
async (delay) => {
|
|
1659
|
+
const assistant = await client.assistants.create({ graphId: "delay" });
|
|
1660
|
+
const thread = await client.threads.create();
|
|
1661
|
+
|
|
1662
|
+
const run = await client.runs.create(
|
|
1663
|
+
thread.thread_id,
|
|
1664
|
+
assistant.assistant_id,
|
|
1665
|
+
{
|
|
1666
|
+
input: { messages: [], delay },
|
|
1667
|
+
config: globalConfig,
|
|
1668
|
+
}
|
|
1669
|
+
);
|
|
1670
|
+
|
|
1671
|
+
await client.runs.join(thread.thread_id, run.run_id);
|
|
1672
|
+
|
|
1673
|
+
const runState = await client.runs.get(thread.thread_id, run.run_id);
|
|
1674
|
+
expect(runState.status).toEqual("success");
|
|
1675
|
+
|
|
1676
|
+
const runResult = await client.threads.getState<{
|
|
1677
|
+
messages: BaseMessageLike[];
|
|
1678
|
+
delay: number;
|
|
1679
|
+
}>(thread.thread_id);
|
|
1680
|
+
|
|
1681
|
+
expect(runResult.values.messages).toMatchObject([
|
|
1682
|
+
{ content: `finished after ${delay}ms` },
|
|
1683
|
+
]);
|
|
1684
|
+
}
|
|
1685
|
+
);
|
|
1686
|
+
});
|
|
@@ -34,7 +34,7 @@ services:
|
|
|
34
34
|
ADD . /deps/graphs
|
|
35
35
|
WORKDIR /deps/graphs
|
|
36
36
|
RUN yarn install --frozen-lockfile
|
|
37
|
-
ENV LANGSERVE_GRAPHS='{"agent":"./agent.mts:graph", "nested": "./nested.mts:graph", "weather": "./weather.mts:graph", "error": "./error.mts:graph"}'
|
|
37
|
+
ENV LANGSERVE_GRAPHS='{"agent":"./agent.mts:graph", "nested": "./nested.mts:graph", "weather": "./weather.mts:graph", "error": "./error.mts:graph", "delay": "./delay.mts:graph"}'
|
|
38
38
|
ENV LANGGRAPH_CONFIG='{"agent": {"configurable": {"model_name": "openai"}}}'
|
|
39
39
|
RUN tsx /api/langgraph_api/js/build.mts
|
|
40
40
|
depends_on:
|
|
@@ -54,3 +54,4 @@ services:
|
|
|
54
54
|
DATABASE_URI: postgres://postgres:postgres@langgraph-postgres:5432/postgres?sslmode=disable
|
|
55
55
|
N_JOBS_PER_WORKER: "2"
|
|
56
56
|
LANGGRAPH_CLOUD_LICENSE_KEY: ${LANGGRAPH_CLOUD_LICENSE_KEY}
|
|
57
|
+
FF_JS_ZEROMQ_ENABLED: ${FF_JS_ZEROMQ_ENABLED}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MessagesAnnotation,
|
|
3
|
+
StateGraph,
|
|
4
|
+
END,
|
|
5
|
+
START,
|
|
6
|
+
Annotation,
|
|
7
|
+
} from "@langchain/langgraph";
|
|
8
|
+
|
|
9
|
+
const StateSchema = Annotation.Root({
|
|
10
|
+
...MessagesAnnotation.spec,
|
|
11
|
+
delay: Annotation<number>(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const longRunning = async (
|
|
15
|
+
state: typeof StateSchema.State
|
|
16
|
+
): Promise<typeof StateSchema.Update> => {
|
|
17
|
+
await new Promise((resolve) => setTimeout(resolve, state.delay));
|
|
18
|
+
return { messages: [`finished after ${state.delay}ms`] };
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const graph = new StateGraph(StateSchema)
|
|
22
|
+
.addNode("long_running", longRunning)
|
|
23
|
+
.addEdge(START, "long_running")
|
|
24
|
+
.addEdge("long_running", END)
|
|
25
|
+
.compile();
|