Agents

Context

An β€œagent” is an automated reasoning and decision engine. It takes in a user input/query and can make internal decisions for executing that query in order to return the correct result. The key agent components can include, but are not limited to:

  • Breaking down a complex question into smaller ones

  • Choosing an external Tool to use + coming up with parameters for calling the Tool

  • Planning out a set of tasks

  • Storing previously completed tasks in a memory module

Research developments in LLMs (e.g. ChatGPT Plugins), LLM research (ReAct, Toolformer) and LLM tooling (LangChain, Semantic Kernel) have popularized the concept of agents.

Agents + LlamaIndex

LlamaIndex provides some amazing tools to manage and interact with your data within your LLM application. And it can be a core tool that you use while building an agent-based app.

  • On one hand, some components within LlamaIndex are β€œagent-like” - these make automated decisions to help a particular use case over your data.

  • On the other hand, LlamaIndex can be used as a core Tool within another agent framework.

In general, LlamaIndex components offer more explicit, constrained behavior for more specific use cases. Agent frameworks such as ReAct (implemented in LangChain) offer agents that are more unconstrained + capable of general reasoning.

There are tradeoffs for using both - less-capable LLMs typically do better with more constraints. Take a look at our blog post on this for a more information + a detailed analysis.

β€œAgent-like” Components within LlamaIndex

LlamaIndex provides core modules capable of automated reasoning for different use cases over your data. Please check out our use cases doc for more details on high-level use cases that LlamaIndex can help fulfill.

Some of these core modules are shown below along with example tutorials (not comprehensive, please click into the guides/how-tos for more details).

SubQuestionQueryEngine for Multi-Document Analysis

Query Transformations

Routing

LLM Reranking

Chat Engines

  • Chat Engines How-To

Using LlamaIndex as as Tool within an Agent Framework

LlamaIndex can be used as as Tool within an agent framework - including LangChain, ChatGPT. These integrations are described below.

LangChain

We have deep integrations with LangChain. LlamaIndex query engines can be easily packaged as Tools to be used within a LangChain agent, and LlamaIndex can also be used as a memory module / retriever. Check out our guides/tutorials below!

Resources

ChatGPT

LlamaIndex can be used as a ChatGPT retrieval plugin (we have a TODO to develop a more general plugin as well).

Resources