Using AI Agents to Chat With Your Data 

The advent of Agentic AI is one of the most exciting recent developments in artificial intelligence (AI) and promises to introduce a new era of LLM agents (see our Blogs Multi-agent systems: An introduction, Why the future is agentic, our Webinar and Podcast for an in-depth introduction). Conventional LLM chatbots are limited to solving tasks via language understanding or, more specifically, next word prediction. This means that any factual, mathematical, coding or domain-specific knowledge is only a by-product of having been trained on large texts from the internet with the objective to learn how to continue sentences. Agentic AI, on the other hand, grounds LLM chatbots in real-world knowledge.

In this blog post we will explore exciting possibilities enabled by AI agents. We will look at different industries and highlight potential use cases, with a focus on using Agentic AI to interact with your data using only natural language. We will showcase a compelling application we have developed: an AI agents-powered support system designed to assist users with no prior experience in graph databases. This system allows non-technical users to effortlessly write queries and conduct analyses with the underlying data. 

What are AI agents? 

Multi-agentic systems comprises groups of “agents”, which can interact with each other. Each agent consists of three components: Their ‘intelligence’ (usually an LLM, but this can be any foundation model), their ‘role’ (usually a system prompt specifying their general behaviour) and their ‘abilities’. Crucially, their ability can contain any functionality, ranging from web search to coding, code execution, retrieval augmented generation, mathematical reasoning or any custom function you can think of. Now your LLM chatbot can also execute functions and use tools, thus being capable of literally any task that can be written down as a function.

For example, a web search agent might interact with a code generation and a code execution agent to perform efficient web scraping. A content generation agent might be checked by a safety agent to keep sensitive information safe. From a technical perspective, this provides a framework for interacting tools or functions that can speak to each other. This is quite literally the case: These AI Agents interact via natural language, call functions, and interpret the output in natural language to take an informed decision – for instance to decide whether a coding problem has been solved or the generated code should be revised. 

This highlights an important concept of Agentic AI: human-in-the-loop design . By enabling interaction through natural language, users can actively participate in conversations with these agents, guide the discussion, and evaluate the outcome. Unlike traditional artificial intelligence systems, this approach allows users to engage in the analytical process without requiring in-depth knowledge of the underlying algorithms or coding expertise. Given all these aspects, Agentic AI is expected to introduce a new generation of artificial intelligence, potentially bringing us one step closer to artificial general intelligence (AGI).

Early success stories of AI Agents  

While still in its early stages, AI agents has already demonstrated success stories across various data and AI use cases. For example, Agentic AI has been successfully applied in the context of content generation, where different fictional characters interact to generate a marketing campaign, software development, where agents generate and automatically test code, or personalised recommender systems. One particularly powerful aspect of Agentic AI that we would like to highlight here is its use in understanding and analysing data. Such applications can range from complicated optimisation problems, performing fundamental analyses, such as causal discovery, to retrieving and joining data from different databases. 

AI Agent use cases across industries 

These multi-agentic use cases are particularly prominent in the manufacturing and production sector. Challenges such as optimizing complex systems—be it a supply chain, control system, or production line—are inherently multifaceted, involving numerous interdependent components. However, they bear great potential for optimisation and cost saving by increasing resource efficiency and optimising time management. Yet, it is very difficult to optimise such problems using one general algorithm. Instead, we can define expert agents that analyse specific components of a supply chain or production line and communicate with each other. This allows them to trigger targeted analyses about the time saving potential of changing certain parameters, which can be linked to insights and analyses about changes in the quality of a production site. Eventually, this provides a layout for a smart factory, where processes are optimised in a highly automated way whilst ensuring human control and involvement where necessary or desired.

Another important aspect of applications of AI agents is the idea of “speaking with your data’. Companies often deal with vast amounts of data. Insights about those data would often be immensely valuable but are difficult to obtain due to a lack of resources, time or expertise in processing those data and conducting specific types of analyses. For example, important questions in the manufacturing and production domain often relate to causal discovery. Wouldn’t it be great to find reasons why a small proportion of parts are failing at the end of a production, and ideally intervene early to avoid wasting time and money? In practice, this is often difficult to achieve: To perform such causal discovery analyses, we have to process vast amounts of data and conduct many causal intervention studies (‘if I manipulate measure X at the beginning of the production line, how will that affect product Y at the end of the line?’). Crucially, AI agents can do these analyses for you. You can design a multi-agentic system consisting of a code generation agent, a code executer, agents that have specific expertise about the production process and a human-in-the-loop agent. This system, when provided with data, can then perform tests queried by a human user and perform multiple analyses probing for causal relationships with a high degree of automation. The query ‘Find out why part Y is sometimes failing’, for instance, may trigger an expert agent to provide estimates about potential causes, which can subsequently be tested by the code generation and execution agents, sending back the results to the expert agents for interpretation. Such applications offer enormous potential for cost saving and optimisation, and we have successfully conducted such projects with various partners in the past.

As a final example, many companies who are in the process of digitalisation face another big problem: huge amounts of data are stored in different data lakes and warehouses, and questions like ‘where do we store which data’ or ‘how can we access these data’ are increasingly difficult to answer. However, AI agents can handle this task for you: An Agentic AI system can automatically search relevant databases, find the right way to connect to those databases, retrieve data, merge different data sources and perform descriptive analyses on those data. A common challenge in accessing data is that this may require some form of coding language that users might be unfamiliar with. While a conventional approach to retrieving data from a database would require users to learn a language like SQL and formulate queries to retrieve data, users working with AI agents can formulate their query in natural language, which is then translated into the correct query and executed by the AI agents. Users then receive their data and potential additional analyses without having to learn a (often outdated) coding language, thus dramatically increasing the accessibility of data to users.

What about users who don’t even know which tool or coding language to use to query their database? No problem, AI agents can find this information by relying on their inherent LLM knowledge, performing web search or analysing relevant documentation. 

From Neo to AI Agents: A practical example 

In the following, we provide a more in-depth illustration of the previous example. In a recent use case, we implemented a graph-based representation of a production process. Graph-based representations have become increasingly popular, since they allow for efficient representations of relational knowledge, such as between different parts in an assembly or between different nodes in a production site. We implemented this graph in a popular graph database called Neo4j. Besides many advantages and possibilities of such a graph representation, it also comes with one downside: Queries must be written in a coding language called Cypher, which many users may be unfamiliar with.

Does this mean that all potential users have to sit down and learn Cypher before they can query the data and the underlying relationships? Not in the age of Agentic AI: Figure 1 illustrates the step "From Neo to AI Agents". Users can ask a question about the graph data in natural language, which is then processed by AI agents. Since users don't always hit the right tone or specificity of a question (as illustrated in this example), an entry agent called "Smith" reformulates the question to make it easier to translate into a Cypher query. Such input processing is common practice with AI agents. Another example of this would be an agent that evaluates whether a topic can be found in an existing database or needs to be searched for on the web. 

Once agent Smith has reformulated and improved the natural language query, resulting in ‘how many nodes are there in the system’, the Cypher query is then generated by agent ‘Jones’, which is executed by agent ‘Brown’. Finally, agent ‘White’ translates the query output back into natural language. 

We found that this Agentic AI could handle user queries with high efficiency and provide correct analyses of the graph data based on user queries. Figure 2 illustrates a more realistic type of query, resulting in a more complex Cypher command and more extensive output (output not shown due to confidentiality reasons). Of course, the AI agents could also be set up as a group chat, where the agents test different queries and analyse the result until a certain quality criterion is reached. Importantly, this approach not only allows us to create fancy Matrix-themed Neo-Agent conversations or win the first price at a hackathon, but also create substantial impact and value in real-world use cases. 

This Multi-agent system can process user requests with high efficiency and provide correct analyses of the graph data on this basis. Figure 2 shows a more realistic type of query that leads to a more complex Cypher command and more comprehensive results (results not shown for confidentiality reasons). Of course, the AI agents could also be set up to act as a group chat system where agents test different queries and analyse the results until a certain quality criterion is reached. Importantly, this approach is not just for having fancy matrix-inspired conversations between neo-agents or winning first prize at a Hackathon but can also create considerable influence and value in real-life use cases. 

Figure 2. The agentic system can be scaled up in complexity quite easily. It can address more complex and realistic queries and coding challenges (output not shown due to data confidentiality), and it can also follow more complex communication patterns, such as a hierarchical group chat or feedback loops. 

Multi-agent LLM systems: The future is agent-based, Tech Deep Dive, Alexander Thamm GmbH

How LLM can be further developed through multi-agent systems: Limitations, challenges and developments

Why the future is agentic: An overview of Multi-Agent LLM Systems

Conclusion 

Agentic LLM systems will pave the way for a new generation of artificial intelligence that will profoundly transform both our daily lives and traditional business processes. We see enormous potential for applications of AI agents in various fields and have observed particularly successful applications in manufacturing and production that enable (non-technical) users to talk to their data. The human-in-the-loop architecture is a key element of such approaches and allows users to interact with these systems in natural language and actively guide and control the execution of an algorithm. We believe that such applications mark the beginning of a new level of smart factories that automate workflows through the use of AI agents and perform complex analyses based on natural language. 

Author

Dr Hedda Gressel

Dr Philipp Schwartenbeck

Philipp is a Principal Data Scientist and joined [at] in January 2023. Among other things, he works on large language models and reinforcement learning, which sparked his interest during his previous job as a computational neuroscientist. When he is not analysing data or thinking about AI algorithms, he is interested in various topics ranging from Bayesian inference to competing in sheepshead tournaments.

0 Kommentare