Skip to content

Introduce Agentic DSL #667

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

ricardozanini
Copy link
Member

Many thanks for submitting your Pull Request ❤️!

What this PR does / why we need it:

Special notes for reviewers:

Additional information (if needed):

Signed-off-by: Ricardo Zanini <[email protected]>
Signed-off-by: Ricardo Zanini <[email protected]>
Signed-off-by: Ricardo Zanini <[email protected]>
Signed-off-by: Ricardo Zanini <[email protected]>
@ricardozanini ricardozanini marked this pull request as ready for review July 23, 2025 23:17
@ricardozanini ricardozanini requested a review from fjtirado as a code owner July 23, 2025 23:17
@ricardozanini
Copy link
Member Author

ricardozanini commented Jul 23, 2025

The PR is ready, but it requires the work done here: https://github.com/langchain4j/langchain4j/blob/agentic-poc/langchain4j-agentic/

@mariofusco fyi - I'll open a PR on your branch with this DSL. You can see the tests in this PR, but you can do things like:

    Agents.MovieExpert a1 = AgentsUtils.newMovieExpert();
    Agents.MovieExpert a2 = AgentsUtils.newMovieExpert();
    Agents.MovieExpert a3 = AgentsUtils.newMovieExpert();

    Workflow wf = AgenticWorkflowBuilder.workflow().tasks(d -> d.parallel(a1, a2, a3)).build();
            
     // and Run it:
     try (WorkflowApplication app = WorkflowApplication.builder().build()) {
         app.workflowDefinition(workflow)
                  .instance(input).start().get().asJavaObject()
     }

You get "for free" all the control flows from the CNCF Workflow Spec, such as then, set, callHTTP, and so on.

One could do:

Workflow wf = AgenticWorkflowBuilder.workflow().tasks(d -> 
    d.parallel("p", a1, a2, a3).compete(false))
     .callHTTP(c -> c.url("http://endpoint")).build();

Of course, we can make the Agentic DSL even more friendly to LC4J use cases - the intention of this module is to be built on top of the langchain4j-agentic. So we are free to add all the shortcuts/generics/types required.

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.

1 participant