During the two-day AI Festival in Milan, the main keywords that stood out were certainly RAG (Retrieval-Augmented Generation) systems and AI Agents. In this article, we will explain in detail what the new frontiers are in the development of solutions that exploit the potential of AI and give some examples of how such solutions can optimize the business workflows of our customers.

We have been hearing more and more often about AI Agents and new paradigms that, by means of interaction between different AI Agents, will outpace the current state of the art from the so-called SaaS (Software as a Service) applications to AaaS (Agent as a Service) applications. Like any trend and new keyword in the IT field, it is necessary first of all to understand in which contexts such architectures can actually give advantages and where it is more convenient to use simpler approaches. In this article, we want to explain what is meant by an AI Agent, how AI Agents can interact with each other to create complex applications, and in which contexts they can actually give advantages and where simpler approaches such as those based on workflows can be used instead.

What is an AI Agent?

We can define an AI agent as a software entity capable of operating autonomously to carry out a specific task assigned to it and capable of using, if necessary, a set of tools at its disposal to carry out this task. These tools could be normal external services or other AI agents specialized in different tasks.

A good AaaS system will therefore be able to carry out its tasks autonomously, perceiving the environment more precisely than the simple use of an LLM system, since in the interaction between the various agents and/or agents and services the data will be improved and enriched every time in order to obtain a higher quality result.

RAG Systems: A Use Case

Let’s start with a simple use case of a RAG system to understand the difference between workflows and agent-based systems and how the two approaches can be useful depending on the specific application context. Although LLMs can give articulate and precise answers on very different topics, they cannot be used in some particular contexts.

Let’s take the example of a company that wants to build a system capable of helping its employees, through a chatbot, to navigate the various company regulations. The answers given by the chatbot must be based only and solely on what is contained in the company documents and, for greater clarity and transparency, there will also be provided references to the documents from which the answers given to the user were taken.

In this case, it may be useful to use a RAG system, that is, an artificial intelligence system that combines an LLM model with an information retrieval mechanism. In short, when a question is asked, the RAG system first searches for information relevant to the context of the question from a database and then uses this data to provide a well-contextualized answer.

A possible architecture diagram of a RAG system is shown in the figure below:

As shown in the diagram, the user’s prompt is first used to extract a subset of documents pertinent to the question from the company regulations database. Then the prompt is given again to the LLM, together with the subset of documents in order to generate the answer for the user.

This scheme could be further refined by inserting an additional step so that to format the answer in accordance with company standards and a user feedback system based on the answer received. In this case, the user can leave positive or negative feedback (thumbs up or down) together with an explanatory comment on the feedback. This feedback could then be used to improve future responses by improving and expanding the RAG database.

A workflow has therefore been built that manages to implement well the use case in question and that does not require an agent implementation. However, there are scenarios where a purely workflow-based approach is limited.

Let’s take, for example, the case in which the answer to be given to the user depends, in addition to the internal regulations database, also on external factors that must be evaluated from time to time. For example, the internal regulation may refer to a decree-law or a European regulation which might need to be updated. In this case, the scheme shown above could be enriched by introducing two agents. The first agent will receive a preliminary answer and will have to decide whether it is necessary to verify if there is an update on a specific law. A second agent, called by the first, will instead be responsible for checking on the legislator’s website if a given law has been updated and, if so, enrich the answer for the user. Furthermore, the agent in charge of retrieving the law update may have a series of tools available (use of an API, web-scraping libraries, etc.) that it may decide to use independently to retrieve the necessary information on the internet.

Ultimately, the use of Agents is necessary in more complex cases where you want to create a system capable of making decisions autonomously, even using external tools. For systems where operations are more repetitive and do not require complex evaluations, a workflow architecture is easier to implement and more manageable, and therefore preferable.

Conclusions

The decision of using a simpler workflow or AI agents depends on the specific use-case. By way of example, we list some use cases that can be implemented through these architectures:

  • Document control against internal checklists, regulations or legislation
  • Automation of data collection and cleaning processes
  • Automation of verification processes
  • Automation of forms filling processes
  • Automation of customer support processes
  • Automation of onboarding processes for new employees
  • Appointment and reservation management
  • Supply chain management
  • Risk analysis and management

These are just some examples that can benefit from building applications that can automate and streamline business processes by combining different AI agents and creating operational workflows. Wondersys is available for analyzing specific use cases in detail and building ad-hoc solutions.

Giacomo Sergio

Managing Director @ Wondersys