Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ public AgentTaskItemListBuilder parallel(String name, Object... agents) {
List<AgentExecutor> execs = AgentAdapters.toExecutors(agents);
for (int i = 0; i < execs.size(); i++) {
AgentExecutor ex = execs.get(i);
fork.branch(
"branch-" + i + "-" + name,
AgentAdapters.toFunction(ex),
DefaultAgenticScope.class);
String agentName = ex.agentName() != null ? ex.agentName() : "branch-" + i + "-" + name;

fork.branch(agentName, AgentAdapters.toFunction(ex), DefaultAgenticScope.class);
}
});
return self();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void dslLoopAgents() {
@Test
void dslParallelAgents() {
var a1 = AgentsUtils.newMovieExpert();
var a2 = AgentsUtils.newMovieExpert();
var a2 = AgentsUtils.newMovieExpert2();

Workflow wf = workflow("forkFlow").parallel("fanout", a1, a2).build();

Expand All @@ -112,8 +112,8 @@ void dslParallelAgents() {
// two branches created
assertThat(fork.getFork().getBranches()).hasSize(2);
// branch names follow "branch-{index}-{name}"
assertThat(fork.getFork().getBranches().get(0).getName()).isEqualTo("branch-0-fanout");
assertThat(fork.getFork().getBranches().get(1).getName()).isEqualTo("branch-1-fanout");
assertThat(fork.getFork().getBranches().get(0).getName()).isEqualTo("findMovie");
assertThat(fork.getFork().getBranches().get(1).getName()).isEqualTo("findMovie2");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ public static Agents.MovieExpert newMovieExpert() {
.build());
}

public static Agents.MovieExpert newMovieExpert2() {
return spy(
AgenticServices.agentBuilder(Agents.MovieExpert.class)
.outputName("movies")
.name("findMovie2")
.chatModel(BASE_MODEL)
.build());
}

public static Agents.CreativeWriter newCreativeWriter() {
return spy(
AgenticServices.agentBuilder(Agents.CreativeWriter.class)
Expand Down