2025 04 GIDS OptimizingWorkflows EventDrivenMultiAgentic
2025 04 GIDS OptimizingWorkflows EventDrivenMultiAgentic
Mary Grygleski
Director of Emerging Technologies
@mgrygles April 2025
● Who’s Mary?
Agenda
● Applying Event Approach to: RAG
● Challenges of GenAI
● Resources
2
01
Who is Mary?
3
mgrygles
Mary Grygleski
mary-grygleski
Java Champion
Passionate mgrygles
Advocate
mgrygles
Chicago Java
Users Group
President
➢ Generative AI
GenAI Collective - Chicago
➢ Streaming
Chapter Organizer ➢ Distributed Systems
➢ Reactive Systems
Director of Emerging Technologies ➢ IoT/MQTT
➢ Real-Time AI/ML
02
Generative AI and
Agentic Architecture
5
DATA
Generative Models
b l e
i ni Sta usion
m f
Ge
e mma Dif
G
GPT-3.5 BERT (
?)
GPT-4.0 Dall
ex o ini
Mid
Jo Cod - 4
T o-m ini -E
urne
y
P
G 4
PT- o1-m
G & ral
o1 Mist
er
LL
op
ic Whisp Co
he
aM 3
LL
r re
th )
aM
An udepus, Hai C
ku
a2
om
Clanet, O m
a
n an
Grok
(S
o
d R
Stepping Things Up - Beyond the Hype
● LLMs’ limitations
○ No memory
○ Probabilistic results
○ Opague - can’t add attribution to its answers
○ Outrageous cost
● The hype: “one-shot” usages (or zero-shot)
● More will be required to make it ready for prime time:
○ Scalability
○ Complex task (e.g. workflows)
○ Memory - remembering the state (particularly for enterprise-level usages)
Agentic Architecture
● Structure and Design of AI Systems that leverages on AI agents to perform tasks:
○ Autonomous execution
○ Tool integration
○ Seamless scalability
○ Resilience and recoverability
9
Agentic Architecture - Key Concepts
● Vertical Architecture - One agent leading
● Horizontal Architecture - Multiple agents collaborating
● Agentic Orchestration
● Complex Task Execution
● Autonomous Decision-making
○ Reasoning and planning
● Continuous Learning
10
AI: Infusing into All Fabrics of our Lives
11
A fascinating
look at the
GenAI “era”
12
Generative Apps
ear n
eyL
M onk n A I
ChatGPT tio
N o
Wor
Gi -Pil
dtun
tH o t
Co
SEO A e
ub
rd I
Ba i
Gemin
c e AI
r
Sa lesfo g A I
Bi n
Expanding Modality / Multi-Modal
Audio Video 3D
Generative Pre-Trained Transformer (GPT)
15
What is Natural Language Processing
(NLP)?
● An interdisciplinary sub-field of linguistics of computer science
● Primary concern is to process natural language datasets (as such text
corpora or speech corpora)
● Uses rule-based or probabilistic machine learning approaches
● Enables computer to learn from contents, including the contextual
nuances of the language itself
● Ideally to draw insights from the documents
16
Large Language Models (LLMs)
18
03
The Event-Driven World and
AI ?
19
At the Heart
of AI:
20
Working with Data
21
Generative AI Streaming usages
● GenAI App Input
○ Prompts
■ Command-line
■ Browser (different devices)
■ Mobile App
● GenAI Intermediary steps:
○ During RAG operations:
■ different sources (DB, filesystem, socket?, message queue, Kafka
topic…)
■ Sending requests to LLMs
● GenAI App Output
○ Responses sent from LLMs
22
Benefits of the Event-Driven Approach
● Handles the dynamic nature of data and its flow patterns
● Communicates asynchronously via event streams
● Enables scalability and flexibility (independent scaling of loosely-coupled
components)
● Facilitates integration of diverse AI models and services
● BUT, be aware of the challenges:
○ More difficult to debug
○ Harder to track the flow of calls and the data they carry
○ Observability needs more work
23
04
Applying Event Approach to
-Retrieval-Augmented
Generation (RAG)
24
What is RAG?
25
Source: Vectorize.io [https://docs.vectorize.io/core-concepts/retrieval-augmented-generation]
Role of the Retrieval Model
27
Role of the Generative Model
● Act as creative writers, synthesizing the retrieved information into coherent and contextually relevant
text.
● Usually built upon Large Language Models (LLMs), generative models have the capability to create
text that is grammatically correct, semantically meaningful, and aligned with the initial query or prompt.
● They take the raw data selected by the retrieval models and give it a narrative structure, making the
information easily digestible and actionable.
● In the RAG framework, generative models serve as the final piece of the puzzle, providing the textual
output we interact with.
28
05
Applying Event Approach to
- Agents and Workflows
29
Fundamentals: Agents and Agentic
● Agents
○ one who is authorized to act for or in the place of another
○ a computer application designed to automate certain tasks
● Agentic
○ Agentic refers to someone or something capable of achieving outcomes
independently (“functioning like an agent”) or possessing such ability, means, or
power (“having agency").
○ It is especially used with a type of artificial intelligence (AI), often referred to as
an AI agent, designed to execute complex tasks autonomously or with little
human involvement
30
Gen AI Agents (within the software context)
● Software entities
○ Orchestrate complex workflows
○ Coordinate the activities of multiple agents
○ Process logic
○ Evaluate answers
31
Multi-Agentic Systems
● Multiple autonomous agents working together
● Each agent specializes in different task(s)
● Emergent intelligence from agent interactions
○ Divide complex tasks into manageable subtasks
○ Leverage strengths of different AI models
○ Increased robustness and fault tolerance
32
Fundamental Building Blocks
● Within the Java context, and leveraging on Langchain4j’s approach:
○ AIServices
■ More flexible than the old “Chains” concept in Langchain
■ Declarative interface to the desired API underneath via
and object (proxy)
33
Towards Standardization?
Model Context Protocol (MCP)
● Originated by Anthropic
● MCP is an open protocol that standardizes how applications provide context to LLMs.
● MCP helps you build agents and complex workflows on top of LLMs. LLMs frequently
need to integrate with data and tools
● https://modelcontextprotocol.io/
● MCP Provides:
● A growing list of pre-built integrations that your LLM can directly plug into
● The flexibility to switch between LLM providers and vendors
● Best practices for securing your data within your infrastructure
34
Towards Standardization - More !!
Agent2Agent Protocol (A2A)
● From Google:
● TLDR; Agentic applications need both A2A and MCP. We recommend MCP for tools and
A2A for agents.
● https://google.github.io/A2A/
● Complementary to MCP:
● https://google.github.io/A2A/#/topics/a2a_and_mcp?id=a2a-%e2%9d%a4%ef%b8%8f-mcp
35
Intersection of A2A and MCP
36
● Use events to Key Components:
Combining coordinate agent ● Event Bus: Manage event
EDA and activities
●
streams
API Gateway: Handles
Multi-Agent ● Event streams enable external events
asynchronous agent ● Agents: Autonomous
for GenAI communications
components w/ specific
capabilities
● Event-driven workflow ● AI Models: Underlying
generative models (e.g.
orchestrate multi-step
GPT, DALL-E, Mistral…)
generation
37
Event Types: Agent Types:
Event Types ● UserRequest: Initial ● Coordinator: Decomposes
generation request
and ● SubtaskAssigned: Agent ●
tasks, assigns to agents
Generator: Produces
Agent Types ●
given a special subtask
ResultGenerated:
content using AI models
● Evaluator: Assesses
Output from an
agent/model quality/relevance of
● FinalResponse: generated content
Completed result for ● Refiner: Improves/iterates
user on initial outputs
38
An AutoGen Example with Different Types of
LLM Agents, including Humans in the Loop
S
AutoGen: Enabling Next Gen LLM Apps via Multi-Agent Conversations (https://arxiv.org/abs/2308.08155)
39
Agentic Design Patterns
● Reflection
● Tool Use
● Planning
● Multi-Agent Collaboration
40
Reflection
https://www.deeplearning.ai/the-batch/agentic-design-patterns-part-2-reflection
41
Tool Use
https://www.deeplearning.ai/the-batch/agentic-design-patterns-part-3-tool-use
42
Tool Use (Illustrated, from CrewAI)
Source: https://github.com/crewAIInc/crewAI/blob/main/docs/crewAI-mindmap.png
43
Planning
https://www.deeplearning.ai/the-batch/agentic-design-patterns-part-4-planning
44
Multi-Agentic Collaboration
https://www.deeplearning.ai/the-batch/agentic-design-patterns-part-5-multi-agent-collaboration/
45
Examples of a Few Multi-Agentic Libraries
● AutoGen
● CrewAI
● LangGraph
● And on the Java side: Quarkus-LangChain4j (CDI)
○ https://docs.quarkiverse.io/quarkus-langchain4j/dev/agent-and-tools.html
46
Examples from CrewAI
● https://docs.crewai.com/examples/example
● GitHub: https://github.com/mgrygles-lab/crewAI-examples/tree/main
47
Agentic Use Cases
48
06
Challenges
49
Be aware of the following issues (partial list)
● Sustainability issues
○ Eco-unfriendly
● Prompt Injection
50
Resources
This slide deck can be accessed here:
https://bit.ly/4iusuNx
Information
● arxiv.org Paper (AutoGen: Enabling Next-Gen LLM Apps via Multi Agent
Conversations):
https://arxiv.org/abs/2308.08155
● OSS Insight Collection (GenAI Agentic Libraries):
https://ossinsight.io/analyze/microsoft/autogen
https://ossinsight.io/analyze/langchain-ai/langgraph
https://ossinsight.io/analyze/crewAIInc/crewAI
● Mary’s Article on Java Advent Calendar (December 2024):
https://bit.ly/3CFaSjd
53
Follow Mary’s Stream
&
The Elusive AI Podcast
[Different topics: GenAI/ChatGPT, AI/ML, Java, Python, JS/TS, Open Source, Distributed Messaging, Event-Streaming,
Cloud, DevOps, etc]
Wed|Thurs|Fri-afternoon-US/Central
https://twitch.tv/mgrygles
https://youtube.com/@marygrygleski9271
Thank You
Mary Grygleski
Chicago Java Users Group: https://www.linkedin.com/in/mary-grygleski/
https://cjug.org