Skip to content

Commit 3f5efec

Browse files
committed
updated sequence demo
Signed-off-by: Dmitrii Tikhomirov <[email protected]>
1 parent 9cab274 commit 3f5efec

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

experimental/fluent/agentic/src/test/java/io/serverlessworkflow/fluent/agentic/LC4JEquivalenceIT.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.conditional;
2020
import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.doTasks;
2121
import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.loop;
22+
import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.tryCatch;
2223
import static io.serverlessworkflow.fluent.spec.dsl.DSL.tasks;
2324
import static org.assertj.core.api.Assertions.assertThat;
2425
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -49,7 +50,7 @@ public void sequentialWorkflow() {
4950

5051
Workflow wf =
5152
workflow("seqFlow")
52-
.tasks(tasks -> tasks.sequence("process", creativeWriter, audienceEditor, styleEditor))
53+
.sequence("process", creativeWriter, audienceEditor, styleEditor)
5354
.build();
5455

5556
List<TaskItem> items = wf.getDo();
@@ -120,6 +121,8 @@ public void loopWorkflowWithMaxIterations() {
120121

121122
Predicate<AgenticScope> until = s -> s.readState("score", 0).doubleValue() >= 0.8;
122123

124+
tryCatch(loop(until, scorer, 5, editor));
125+
123126
Workflow wf =
124127
AgentWorkflowBuilder.workflow("retryFlow").tasks(loop(until, scorer, 5, editor)).build();
125128

@@ -185,6 +188,9 @@ public void errorHandling() {
185188
var audienceEditor = AgentsUtils.newAudienceEditor();
186189
var styleEditor = AgentsUtils.newStyleEditor();
187190

191+
workflow("seqFlow")
192+
.tasks(tasks -> tasks.c
193+
188194
Workflow wf =
189195
workflow("seqFlow")
190196
.tasks(tasks -> tasks.sequence("process", creativeWriter, audienceEditor, styleEditor))

experimental/fluent/agentic/src/test/java/io/serverlessworkflow/fluent/agentic/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ String story = (String) novelCreator.invoke(input);
8080
### Serverless Workflow
8181

8282
```java
83-
Workflow wf = workflow("seqFlow").tasks(tasks -> tasks.sequence("process", creativeWriter, audienceEditor, styleEditor)).build();
83+
Workflow wf = workflow("seqFlow").sequence("process", creativeWriter, audienceEditor, styleEditor).build();
8484

8585
try (WorkflowApplication app = WorkflowApplication.builder().build()) {
8686
String result = app.workflowDefinition(wf).instance(input).start().get().asText().orElseThrow();

0 commit comments

Comments
 (0)