|
19 | 19 | import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.conditional;
|
20 | 20 | import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.doTasks;
|
21 | 21 | import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.loop;
|
| 22 | +import static io.serverlessworkflow.fluent.agentic.dsl.AgenticDSL.tryCatch; |
22 | 23 | import static io.serverlessworkflow.fluent.spec.dsl.DSL.tasks;
|
23 | 24 | import static org.assertj.core.api.Assertions.assertThat;
|
24 | 25 | import static org.junit.jupiter.api.Assertions.assertEquals;
|
@@ -49,7 +50,7 @@ public void sequentialWorkflow() {
|
49 | 50 |
|
50 | 51 | Workflow wf =
|
51 | 52 | workflow("seqFlow")
|
52 |
| - .tasks(tasks -> tasks.sequence("process", creativeWriter, audienceEditor, styleEditor)) |
| 53 | + .sequence("process", creativeWriter, audienceEditor, styleEditor) |
53 | 54 | .build();
|
54 | 55 |
|
55 | 56 | List<TaskItem> items = wf.getDo();
|
@@ -120,8 +121,9 @@ public void loopWorkflowWithMaxIterations() {
|
120 | 121 |
|
121 | 122 | Predicate<AgenticScope> until = s -> s.readState("score", 0).doubleValue() >= 0.8;
|
122 | 123 |
|
123 |
| - Workflow wf = |
124 |
| - AgentWorkflowBuilder.workflow("retryFlow").tasks(loop(until, scorer, 5, editor)).build(); |
| 124 | + tryCatch(loop(until, scorer, 5, editor)); |
| 125 | + |
| 126 | + Workflow wf = workflow("retryFlow").loop(until, scorer, 5, editor).build(); |
125 | 127 |
|
126 | 128 | List<TaskItem> items = wf.getDo();
|
127 | 129 | assertThat(items).hasSize(1);
|
@@ -186,9 +188,7 @@ public void errorHandling() {
|
186 | 188 | var styleEditor = AgentsUtils.newStyleEditor();
|
187 | 189 |
|
188 | 190 | Workflow wf =
|
189 |
| - workflow("seqFlow") |
190 |
| - .tasks(tasks -> tasks.sequence("process", creativeWriter, audienceEditor, styleEditor)) |
191 |
| - .build(); |
| 191 | + workflow("seqFlow").sequence("process", creativeWriter, audienceEditor, styleEditor).build(); |
192 | 192 |
|
193 | 193 | List<TaskItem> items = wf.getDo();
|
194 | 194 | assertThat(items).hasSize(3);
|
|
0 commit comments