https://medium.com/@springrod/you-can-build-better-ai-agents-in-java-than-python-868eaf008493

Top highlight

You Can Build Better AI Agents in Java Than Python

Rod Johnson

Rod Johnson

14 min read

·

Aug 18, 2025

Too many people assume that Gen AI means Python. Not so.

In this blog I’ll demonstrate that the best programming model for writing agents is on the JVM, and that the Embabel agent framework offers significant advantages over Python alternatives.

I’ll take a nontrivial sample app from a leading Python framework and rewrite it in Java to be cleaner, more extensible, and require less code.

Press enter or click to view image in full sizeThe JVM strikes back

The JVM strikes back

The Task: Writing a Book

CrewAI is one of the most popular agent frameworks. Thus it’s a good candidate to benchmark Java versus Python.

I chose an example from the official collection of complete CrewAI applications, billed as containing “end-to-end implementations that showcase how to build real-world applications using CrewAI’s framework for orchestrating AI agents.”

The Write a Book Flow seemed a good place to start. Here’s their description of what it does:

This flow will guide you through the process of writing a book by leveraging multiple AI agents, each with specific roles. Here’s a brief overview of what will happen in this flow:

  1. Generate Book Outline: The flow starts by using the OutlineCrew to create a comprehensive outline for your book. This crew will search the internet, define the structure, and main topics of the book based on the provided goal and topic.

  2. Write Book Chapters: Once the outline is ready, the flow will kick off a new crew, WriteBookChapterCrew, for each chapter outlined in the previous step. Each crew will be responsible for writing a specific chapter, ensuring that the content is detailed and coherent.

  3. Join and Save Chapters: In the final step, the flow will combine all the chapters into a single markdown file, creating a complete book. This file will be saved in the root folder of your project.

By following this flow, you can efficiently produce a well-structured and comprehensive book, leveraging the power of multiple AI agents to handle different aspects of the writing process.

This is a nice multi-agent scenario, fun in itself and relevant to many real-world problems.