@@ -97,11 +97,7 @@ String story = (String) novelCreator.invoke(input);
9797  ;
9898  ;
9999
100- try (WorkflowApplication app = WorkflowApplication.builder().build()) {
101- String result = app.workflowDefinition(wf).instance(input).start().get().asText().orElseThrow();
102- } catch (Exception e) {
103- throw new RuntimeException("Workflow execution failed", e);
104- }
100+ String result = app.workflowDefinition(wf).instance(input).start().get().asText().orElseThrow();
105101
106102</code >
107103</pre >
@@ -194,11 +190,7 @@ Workflow wf = workflow("retryFlow")
194190  ;
195191  ;
196192  ;
197- try (WorkflowApplication app = WorkflowApplication.builder().build()) {
198- String result = app.workflowDefinition(wf).instance(input).start().get().asText().orElseThrow();
199- } catch (Exception e) {
200- throw new RuntimeException("Workflow execution failed", e);
201- }
193+ String result = app.workflowDefinition(wf).instance(input).start().get().asText().orElseThrow();
202194
203195</code >
204196</pre >
@@ -304,13 +296,10 @@ Workflow wf = workflow("forkFlow")
304296  ;
305297  ;
306298  ;
299+   ;
307300Map< ; String, Object> input = Map.of("mood", "I am hungry and bored");
308301
309- try (WorkflowApplication app = WorkflowApplication.builder().build()) {
310- Map<String, Object > result = app.workflowDefinition(wf).instance(input).start().get().asMap().orElseThrow();
311- } catch (Exception e) {
312- throw new RuntimeException("Workflow execution failed", e);
313- }
302+ Map<String, Object > result = app.workflowDefinition(wf).instance(input).start().get().asMap().orElseThrow();
314303
315304</code >
316305</pre >
@@ -390,13 +379,9 @@ Workflow wf = workflow("seqFlow")
390379 .sequence(astrologyAgent, humanInTheLoop)
391380 .build();
392381
393- Map<String, Object > input = Map.of("request", "My name is Mario. What is my horoscope?");
394-
395- try (WorkflowApplication app = WorkflowApplication.builder().build()) {
396- String result = app.workflowDefinition(wf).instance(input).start().get().asMap().orElseThrow();
397- } catch (Exception e) {
398- throw new RuntimeException("Workflow execution failed", e);
399- }
382+   ;
383+   ;
384+ String result = app.workflowDefinition(wf).instance("My name is Mario. What is my horoscope?").start().get().asMap().orElseThrow();
400385
401386</code >
402387</pre >
0 commit comments