ARA - AutoGen Research Assistant

ARA is an Autogen-powered AI research assistant that can converse with you to help you conduct research, write and execute code, run saved skills, learn new skills by demonstration, and adapt in response to your interactions.

Project Structure:

  • backend/ code for the web api, served by FastAPI.
  • frontend/ code for the webui, built with Gatsby and Tailwind

Getting Started

Install requirements:

cd backend
pip install -r requirements.txt

AutoGen requires access to an LLM. Please see the AutoGen docs on how to configure access to your LLM. We recommend setting the OAI_CONFIG_LIST environment variable to point to your LLM config file.

Also, if you plan to use bing search, set the BING_API_KEY

export OAI_CONFIG_LIST=/path/to/OAI_CONFIG_LIST
export BING_API_KEY=<your bing api key>

Build and Run Frontend UI

cd frontend
npm install
npm run build

The command above will build the frontend ui and copy the build artifacts to the backend folder. Note that you may have to run npm install --force to force resolve some peer dependencies.

Run the web ui:

cd backend
uvicorn main:app --reload --port 8000

Navigate to http://localhost:8000/ to view the web ui.

To update the web ui, navigate to the frontend directory, make changes and rebuild the ui.

Capabilities

This demo focuses on the research assistant use case with some generalizations:

  • Skills: The agent is provided with a list of skills that it can leverage while attempting to address a user's query. Each skill is a python function that may be in any file in a folder made availabe to the agents. We separate the concept of global skills available to all agents backend/files/global_utlis_dir and user level skills backend/files/user/<user_hash>/utils_dir, relevant in a multi user environment. Agents are aware skills as they are appended to the system message. A list of example skills is available in the backend/global_utlis_dir folder. Modify the file or create a new file with a function in the same directory to create new global skills.

-Conversation Persistence: Conversation history is persisted in an sqlite database database.sqlite.

  • User Keywords: The research assistant also accepts explicit keywords that trigger specific behaviors.
    • @execute : This app is designed such that code execution is an explicit request from the end user. For example, the agents are setup to not execute generated code by default. Rather, the user can respond with @execute to execute the most recent code block or make modifications.
    • @memorize: The app also supports an @memorize key word that runs a workflow where a new python skill is synthesized based on the recent conversation history. This is intended as an example of teachability where an agent can learn reusable skills.

Example Usage

Let us use a simple query demonstrating the capabilities of the research assistant.

Plot a chart of NVDA and TESLA stock price YTD. Save the result to a file named nvda_tesla.png

The agents responds by writing code to create a python program to generate the chart with the stock prices. You can use the @execute meta-prompt to execute the code generated.

Note than there could be multiple turns between the AssistantAgent and the UserProxyAgent to produce and execute the code in order to complete the task.

ARA

Note: You can also view the debug console that generates useful information to see how the agents are interacting in the background.

FAQ

  • How do I add more skills to the research assistant? This can be done by adding a new (documented) function to the files/global_utils_dir directory.
  • How do I reset the conversation? You can reset the conversation by deleting the database.sqlite file. You can also delete user files by deleting the backend/files/user/<user_hash> folder.
  • How do I view messages generated by agents? You can view the messages generated by the agents in the debug console. You can also view the messages in the database.sqlite file.

Acknowledgements

Based on the AutoGen project. Adapted in October 2023 from a research prototype (original credits: Gagan Bansal, Adam Fourney, Victor Dibia, Piali Choudhury, Saleema Amershi, Ahmed Awadallah, Chi Wang)