Skip to content

Commit 6403954

Browse files
authored
add agent(...) to the AgentWorkflowBuilder (#810)
Signed-off-by: Dmitrii Tikhomirov <[email protected]>
1 parent 7d4003d commit 6403954

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

experimental/fluent/agentic/src/main/java/io/serverlessworkflow/fluent/agentic/AgentWorkflowBuilder.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,17 @@ public static AgentWorkflowBuilder workflow(String name, String ns) {
4242
return new AgentWorkflowBuilder(name, ns, DEFAULT_VERSION);
4343
}
4444

45+
public AgentWorkflowBuilder agent(Object agent) {
46+
return agent(UUID.randomUUID().toString(), agent);
47+
}
48+
49+
public AgentWorkflowBuilder agent(String name, Object agent) {
50+
final AgentDoTaskBuilder doTaskBuilder = this.newDo();
51+
doTaskBuilder.agent(name, agent);
52+
this.workflow.setDo(doTaskBuilder.build().getDo());
53+
return this;
54+
}
55+
4556
public AgentWorkflowBuilder sequence(Object... agents) {
4657
return sequence(UUID.randomUUID().toString(), agents);
4758
}

0 commit comments

Comments
 (0)