As software development moves from applications that use a single AI agent toward systems involving multiple cooperating agents, orchestration becomes increasingly important. Consider a system with several specialized agents: one plans a solution, another generates code, another reviews it, and perhaps additional agents perform testing, validation, or deployment.
Each agent is probabilistic. Its response is not guaranteed to be identical every time. The orchestration layer cannot be probabilistic.
At some point, our application needs to decide:
Which agent should execute next?
Should we continue or terminate?
Should we retry?
Should we request clarification?
Should we send the result to another agent?
Should we handle an error?
Have we covered all possible outcomes?
This is where pattern matching becomes especially interesting. The talk I delivered at Conf42 AI Agents 2026 on September 24 explores this idea through practical Java code examples.
The Video
The talk was captured on video. You can find that video on YouTube at https://youtu.be/Ef2ee-uObLo?si=zQsrjH8tBqKqCeZR.
The Slides
The slides are available online at https://speakerdeck.com/lifemichael/conf42-ai-agents-2026-orchestrating-ai-agents-with-pattern-matching.
The Code
The code is available for you to download at https://tinyurl.com/aiagentspatterns. If you encounter any diffculties with running these code samples don’t hesitate and let me know. I will be more than happy to assist.
AI is changing software development quickly. Many of the fundamental principles of software engineering remain important. Perhaps they are becoming even more important. As applications rely on more AI agents, developers need ways to control how those agents interact, how their outputs are interpreted, and how the system moves from one state to another. Pattern matching provides one interesting mechanism for doing exactly that.







