From a0a303ff759bafaba8ad4348ffd0d50fb769c948 Mon Sep 17 00:00:00 2001 From: Tomas Dvorak Date: Thu, 19 Dec 2024 15:51:21 +0100 Subject: [PATCH] feat: update flows examples Signed-off-by: Tomas Dvorak --- examples/flows/simple.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/flows/simple.ts b/examples/flows/simple.ts index ff2daf9f..3ee6f216 100644 --- a/examples/flows/simple.ts +++ b/examples/flows/simple.ts @@ -1,4 +1,4 @@ -import { Flow } from "bee-agent-framework/flows"; +import { Flow } from "bee-agent-framework/experimental/flows"; import { z } from "zod"; const schema = z.object({ @@ -6,14 +6,11 @@ const schema = z.object({ }); const flow = new Flow({ schema }) - .addStep("a", async (state) => ({})) // does nothing - .addStep("b", async (state) => ({ - // adds one and moves to b + .addStep("a", async (state) => ({ update: { hops: state.hops + 1 }, })) - .addStep("c", async (state) => ({ - update: { hops: state.hops + 1 }, - next: Math.random() > 0.5 ? "b" : Flow.END, + .addStep("b", () => ({ + next: Math.random() > 0.5 ? Flow.PREV : Flow.END, })); const response = await flow.run({ hops: 0 }).observe((emitter) => {