Skip to content

We should be able to use an agentic loop without explicitly specifyin…#843

Merged
ricardozanini merged 1 commit intoserverlessworkflow:mainfrom
treblereel:agentic_loop_maxIterations
Oct 1, 2025
Merged

We should be able to use an agentic loop without explicitly specifyin…#843
ricardozanini merged 1 commit intoserverlessworkflow:mainfrom
treblereel:agentic_loop_maxIterations

Conversation

@treblereel
Copy link
Collaborator

…g maxIterations

During the construction ForTaskFunction at LoopAgentsBuilder we must explicitly pass .withCollection, in other case we get the exception:

Caused by: java.lang.NullPointerException: Cannot invoke "java.util.Optional.isPresent()" because the return value of "io.serverlessworkflow.api.types.func.ForTaskFunction.getForClass()" is null
at io.serverlessworkflow.impl.executors.func.JavaForExecutorBuilder.collectionFilterObject(JavaForExecutorBuilder.java:70)
at io.serverlessworkflow.impl.executors.func.JavaForExecutorBuilder.buildCollectionFilter(JavaForExecutorBuilder.java:65)
at io.serverlessworkflow.impl.executors.ForExecutor$ForExecutorBuilder.(ForExecutor.java:47)
at io.serverlessworkflow.impl.executors.func.JavaForExecutorBuilder.(JavaForExecutorBuilder.java:37)
at io.serverlessworkflow.impl.executors.func.JavaTaskExecutorFactory.getTaskExecutor(JavaTaskExecutorFactory.java:30)
at io.serverlessworkflow.impl.executors.TaskExecutorHelper.createExecutorBuilderList(TaskExecutorHelper.java:93)
at io.serverlessworkflow.impl.executors.TaskExecutorHelper.createExecutorList(TaskExecutorHelper.java:65)
at io.serverlessworkflow.impl.WorkflowDefinition.(WorkflowDefinition.java:59)
at io.serverlessworkflow.impl.WorkflowDefinition.of(WorkflowDefinition.java:69)
at io.serverlessworkflow.impl.WorkflowDefinition.of(WorkflowDefinition.java:64)
at io.serverlessworkflow.impl.WorkflowApplication.lambda$workflowDefinition$0(WorkflowApplication.java:259)
at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
at io.serverlessworkflow.impl.WorkflowApplication.workflowDefinition(WorkflowApplication.java:258)
at io.serverlessworkflow.fluent.agentic.AgenticServices$AgentInvocationHandler.invoke(AgenticServices.java:119)

…g maxIterations

Signed-off-by: Dmitrii Tikhomirov <chani.liet@gmail.com>
@treblereel treblereel requested a review from fjtirado as a code owner October 1, 2025 23:02
@ricardozanini ricardozanini merged commit cc4fdea into serverlessworkflow:main Oct 1, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments