Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sdk-js): pass checkpoint when creating run #2066

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libs/sdk-js/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check notice on line 1 in libs/sdk-js/src/client.ts

View workflow job for this annotation

GitHub Actions / benchmark

Benchmark results

......................................... fanout_to_subgraph_10x: Mean +- std dev: 48.7 ms +- 0.8 ms ......................................... fanout_to_subgraph_10x_sync: Mean +- std dev: 43.9 ms +- 1.0 ms ......................................... fanout_to_subgraph_10x_checkpoint: Mean +- std dev: 70.1 ms +- 1.6 ms ......................................... fanout_to_subgraph_10x_checkpoint_sync: Mean +- std dev: 73.6 ms +- 1.6 ms ......................................... fanout_to_subgraph_100x: Mean +- std dev: 478 ms +- 10 ms ......................................... fanout_to_subgraph_100x_sync: Mean +- std dev: 422 ms +- 5 ms ......................................... fanout_to_subgraph_100x_checkpoint: Mean +- std dev: 706 ms +- 26 ms ......................................... fanout_to_subgraph_100x_checkpoint_sync: Mean +- std dev: 696 ms +- 5 ms ......................................... react_agent_10x: Mean +- std dev: 28.1 ms +- 0.6 ms ......................................... react_agent_10x_sync: Mean +- std dev: 20.2 ms +- 0.3 ms ......................................... react_agent_10x_checkpoint: Mean +- std dev: 44.4 ms +- 3.6 ms ......................................... WARNING: the benchmark result may be unstable * the standard deviation (4.64 ms) is 13% of the mean (35.1 ms) Try to rerun the benchmark with more runs, values and/or loops. Run 'python -m pyperf system tune' command to reduce the system jitter. Use pyperf stats, pyperf dump and pyperf hist to analyze results. Use --quiet option to hide these warnings. react_agent_10x_checkpoint_sync: Mean +- std dev: 35.1 ms +- 4.6 ms ......................................... react_agent_100x: Mean +- std dev: 323 ms +- 9 ms ......................................... react_agent_100x_sync: Mean +- std dev: 257 ms +- 7 ms ......................................... react_agent_100x_checkpoint: Mean +- std dev: 965 ms +- 42 ms ......................................... react_agent_100x_checkpoint_sync: Mean +- std dev: 883 ms +- 34 ms ......................................... wide_state_25x300: Mean +- std dev: 19.1 ms +- 0.3 ms ......................................... wide_state_25x300_sync: Mean +- std dev: 11.2 ms +- 0.2 ms ......................................... wide_state_25x300_checkpoint: Mean +- std dev: 243 ms +- 7 ms ......................................... wide_state_25x300_checkpoint_sync: Mean +- std dev: 243 ms +- 15 ms ......................................... wide_state_15x600: Mean +- std dev: 21.4 ms +- 0.4 ms ......................................... wide_state_15x600_sync: Mean +- std dev: 12.6 ms +- 0.1 ms ......................................... wide_state_15x600_checkpoint: Mean +- std dev: 418 ms +- 12 ms ......................................... wide_state_15x600_checkpoint_sync: Mean +- std dev: 419 ms +- 19 ms ......................................... wide_state_9x1200: Mean +- std dev: 21.5 ms +- 0.4 ms ......................................... wide_state_9x1200_sync: Mean +- std dev: 12.5 ms +- 0.1 ms ......................................... wide_state_9x1200_checkpoint: Mean +- std dev: 268 ms +- 7 ms ......................................... wide_state_9x1200_checkpoint_sync: Mean +- std dev: 270 ms +- 14 ms

Check notice on line 1 in libs/sdk-js/src/client.ts

View workflow job for this annotation

GitHub Actions / benchmark

Comparison against main

+-----------------------------------------+---------+-----------------------+ | Benchmark | main | changes | +=========================================+=========+=======================+ | fanout_to_subgraph_100x_checkpoint | 738 ms | 706 ms: 1.04x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x | 496 ms | 478 ms: 1.04x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600_sync | 13.0 ms | 12.6 ms: 1.03x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600 | 22.0 ms | 21.4 ms: 1.03x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200_checkpoint_sync | 277 ms | 270 ms: 1.03x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_checkpoint_sync | 714 ms | 696 ms: 1.03x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200_checkpoint | 275 ms | 268 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_checkpoint_sync | 249 ms | 243 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200_sync | 12.8 ms | 12.5 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_100x_sync | 431 ms | 422 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_9x1200 | 21.9 ms | 21.5 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_10x | 28.6 ms | 28.1 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_checkpoint | 71.3 ms | 70.1 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_sync | 44.6 ms | 43.9 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600_checkpoint | 424 ms | 418 ms: 1.02x faster | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_sync | 20.5 ms | 20.2 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x | 49.3 ms | 48.7 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_15x600_checkpoint_sync | 424 ms | 419 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_checkpoint | 246 ms | 243 ms: 1.01x faster | +-----------------------------------------+---------+-----------------------+ | fanout_to_subgraph_10x_checkpoint_sync | 73.9 ms | 73.6 ms: 1.00x faster | +-----------------------------------------+---------+-----------------------+ | wide_state_25x300_sync | 11.1 ms | 11.2 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_checkpoint | 954 ms | 965 ms: 1.01x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x_sync | 253 ms | 257 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_100x | 316 ms | 323 ms: 1.02x slower | +-----------------------------------------+---------+-----------------------+ | react_agent_10x_checkpoint_sync | 33.9 ms | 35.1 ms: 1.04x slower | +---------------------------------------
Assistant,
AssistantGraph,
Config,
Expand Down Expand Up @@ -674,6 +674,7 @@
assistant_id: assistantId,
interrupt_before: payload?.interruptBefore,
interrupt_after: payload?.interruptAfter,
checkpoint: payload?.checkpoint,
checkpoint_id: payload?.checkpointId,
webhook: payload?.webhook,
multitask_strategy: payload?.multitaskStrategy,
Expand Down Expand Up @@ -756,6 +757,7 @@
interrupt_before: payload?.interruptBefore,
interrupt_after: payload?.interruptAfter,
webhook: payload?.webhook,
checkpoint: payload?.checkpoint,
checkpoint_id: payload?.checkpointId,
multitask_strategy: payload?.multitaskStrategy,
after_seconds: payload?.afterSeconds,
Expand Down Expand Up @@ -822,6 +824,7 @@
assistant_id: assistantId,
interrupt_before: payload?.interruptBefore,
interrupt_after: payload?.interruptAfter,
checkpoint: payload?.checkpoint,
checkpoint_id: payload?.checkpointId,
webhook: payload?.webhook,
multitask_strategy: payload?.multitaskStrategy,
Expand Down
7 changes: 6 additions & 1 deletion libs/sdk-js/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config, Metadata } from "./schema.js";
import { Checkpoint, Config, Metadata } from "./schema.js";

export type StreamMode = "values" | "messages" | "updates" | "events" | "debug";
export type MultitaskStrategy = "reject" | "interrupt" | "rollback" | "enqueue";
Expand Down Expand Up @@ -37,6 +37,11 @@ interface RunsInvokePayload {
*/
checkpointId?: string;

/**
* Checkpoint for when creating a new run.
*/
checkpoint?: Omit<Checkpoint, "thread_id">;

/**
* Interrupt execution before entering these nodes.
*/
Expand Down
Loading