Agentic Apps
Lessons Learnt From Creating Agentic Applications
By:
Michal Polanowski and Srikrishna Iyer (Krishna)
Group Technology Office
GTO AI.DA: What We Do?
We incorporate the latest Gen AI research into various POCs and MVPs.
Focus on the Agentic Approaches.
Primarily work on TRL 3-7 projects.
Have projects that vary from a single to as many as 5 agents. Upcoming projects are expected to incorporate 20+ different agents, agents in simulation environments and robotic agents.
AI Agents Are LLMs With Additional Abilities
AI agents can encompass a wide range of functionalities beyond natural language processing including decision-making, problem-solving, interacting with external environments and executing actions.��AI agents work in a self-directing loop, setting tasks for AI, determining priorities, and re-prioritizing tasks until the overall goal is achieved.
Agentic Project Features
Information hub: can answer queries about the users' current situation, responsibilities, and expectations.
Empathetic listening: a safe space for users to express their thoughts, concerns, and experiences.
Memory: learns about the user and offers individual and personalised interactions with the recognition and recollection of past interactions.
Survey: incorporates evidence-based surveys to help monitor user well-being.
Adaptive support: offers personalized guidance and coping strategies to help users navigate challenges they may face.
Reliable Agentic Approach Is Difficult
Here are some challenges that we will discuss:
Transition Slide
Popular Agentic Frameworks Did Not Work For Us
The frameworks are either too fragile or too slow to work in a “normal” conversation mode.
Also, there is no need for an agent to go through a plan at every interaction with a user.
Lastly, these solutions become very expensive due to loops and unnecessary actions.
Our Agentic Approach Needs To Be a State Machine
SMs Exert More Precise Control Over Agentic Systems
Sweet spot?
The above paper is a great overview of the solution we have created.��“A state represents the status of a running process. The transitions between states are controlled by heuristic rules or decisions made by the LLM, allowing for a dynamic and adaptive progression.”
States Determine the Behaviour of the System
States have three levels:
L0 Temporal: Pre | During | Post (eg. Pre-Course, During-Course, Post-Course)
L1 Chatbot Module: Empathetic, RAG (eg. General course queries), Counsellor RAG (eg. Tutor), Survey (eg. Assessment)
L2 Chatbot State: Enter, Execute, End
The challenge is to properly and reliably design the states and transitions.
[Design 1] Agentic Only Approach (Fail)
RAG
[Design 2]: Semantic only routing (Fail)
RAG
RAG
Transitions: Semantic, Hybrid, Agentic (Supervisor), LLMs
We can control the transitions using different approaches and at different States.
Static (If-Then)
Dynamic (LLM)
System Level
Conversation Level
Hybrid Approach
Semantic Routing
If-Then Rules
Conversation LLM
Agentic Supervisor
L0
L1
L1
L2
[Final] Hybrid Approach: Hierarchical LLM state machine
L1 Chatbot Modules:
Empathetic, Counsellor, Survey, RAG
Temporal router
RAG
L0 Temporal:
Pre, During, Post
L2 Chatbot State:
Enter, Execute, End
Pre
During
Post
L1 Chatbot Module:
Empathetic, RAG, Counsellor RAG, Survey
Evaluation results
Note : Excludes the survey state
Single Task | |||
Difficulty | Hybrid (Ours) | Agentic | Semantic |
Easy | 0.9 | 0.9 | 0.6 |
Medium | 1 | 1 | 0.9 |
Hard | 0.8 | 0.8 | 0.7 |
| | | |
Double Task | |||
Difficulty | Hybrid (Ours) | Agentic | Semantic |
Easy | 0.85 | 0.8 | 0.75 |
Medium | 0.8 | 0.85 | 0.65 |
Hard | 0.95 | 0.95 | 0.7 |
| | | |
Triple Task | |||
Difficulty | Hybrid (Ours) | Agentic | Semantic |
Easy | 0.7 | 0.67 | 0.67 |
Medium | 0.8 | 0.7 | 0.5 |
Hard | 0.9 | 0.63 | 0.6 |
Comparison of Success rates
(proportion of correctly classified states)
LLM Slide
How to structure the prompt?
There are many ways to design a prompt to make LLMs behave consistently.
There are huge differences between a Chat prompt vs a Production prompt.
We Got Lucky With A Claude 3.5 Artifact Prompt Leak
XML tags are very useful and generate consistent code behaviour.
Can be used for:
Our LLMs Handle L2 State Transitions (Execute + End)
Conclusions
Figuring out these elements took very long as we could not find any online references on how to do it well.
Start with understanding how your app will�behave (LLMs, transitions, functionality, etc).
Figure out what is static (if-then) and what should�be dynamic.
Prompt XML tags are your best friend for any�function calling or a dynamic chat information �Retrieval.
It is a lot of system engineering :(
About The GenAI Team
Srikrishna Iyer (Krishna) (Senior AI Engineer). He focuses on applied research, system design and development of generative AI (LLMs and multi-agent AI) solutions. Previously worked as a data analyst for ASMPT pte. Ltd. on data driven semiconductor process optimisation as well as a research assistant in SingTel Cognitive and AI lab (SCALE@NTU) for enterprises (Connect).
Michal Polanowski (Head of the Generative AI). Spearheads efforts to translate Gen AI research into commercial solutions. Has over a decade of experience leading DS, ML, and AI teams for local and international firms like Delhaize, Disney, Lazada, and GoTo (Connect).
Ryzal Kamis (MLOps Lead) Focuses on system administration, DevOps, and development. He works with on AI-enabled solutions, ranging from conventional ML applications to Gen AI solutions. In the past, he managed an MLOps team and initiatives for an AI-centric national program (AI Singapore), was a teaching assistant at NUS, and a research analyst for an MNC (Connect).