Agent-LLM is an Artificial Intelligence Automation Platform designed for efficient AI instruction management across multiple providers. Equipped with adaptive memory, this versatile solution offers a powerful plugin system that supports a wide range of commands, including web browsing. With growing support for numerous AI providers and models, Agent-LLM is constantly evolving to cater to diverse applications.
- Agent-LLM
-
Adaptive long-term and short-term memory management
-
Versatile plugin system with extensible commands for various AI models
-
Wide compatibility with multiple AI providers, including:
-
OpenAI GPT-3.5, GPT-4
-
Oobabooga Text Generation Web UI
-
Kobold
-
llama.cpp
-
FastChat
-
Google Bard
-
And More!
-
-
Web browsing and command execution capabilities
-
Code evaluation support
-
Seamless Docker deployment
-
Integration with Huggingface for audio-to-text conversion
-
Interoperability with platforms like Twitter, GitHub, Google, DALL-E, and more
-
Text-to-speech options featuring Brian TTS, Mac OS TTS, and ElevenLabs
-
Continuously expanding support for new AI providers and services
The frontend web application of Agent-LLM provides an intuitive and interactive user interface for users to:
- Manage agents: View the list of available agents, add new agents, delete agents, and switch between agents.
- Set objectives: Input objectives for the selected agent to accomplish.
- Start tasks: Initiate the task manager to execute tasks based on the set objective.
- Instruct agents: Interact with agents by sending instructions and receiving responses in a chat-like interface.
- Available commands: View the list of available commands and click on a command to insert it into the objective or instruction input boxes.
- Dark mode: Toggle between light and dark themes for the frontend.
The frontend is built using React and Material-UI and communicates with the backend through API endpoints.
- Obtain an OpenAI API key from OpenAI.
- Set the
OPENAI_API_KEY
in your.env
file using the provided .env.example as a template. - Run the following Docker command in the folder with your
.env
file:
docker compose up -d --build
- Access the web interface at http://localhost
For more detailed setup and configuration instructions, refer to the sections below.
- Clone the repository.
git clone https://github.com/Josh-XT/Agent-LLM
- Install the required Python packages:
pip install -r requirements.txt
- Configure the necessary environment variables in the
.env
file using.env.example
as a template. - Launch Agent-LLM using Docker (recommended) or by following the steps in the "Local Setup (Alternative)" section to set up the frontend and run the
app.py
script.
Agent-LLM utilizes a .env
configuration file to store AI language model settings, API keys, and other options. Use the supplied .env.example
as a template to create your personalized .env
file. Configuration settings include:
- INSTANCE CONFIG: Set the agent name, objective, and initial task.
- AI_PROVIDER: Choose between OpenAI, llama.cpp, or Oobabooga for your AI provider.
- AI_PROVIDER_URI: Set the URI for custom AI providers such as Oobabooga Text Generation Web UI (default is http://127.0.0.1:7860).
- MODEL_PATH: Set the path to the AI model if using llama.cpp or other custom providers.
- BING_CONVERSATION_STYLE: Set the conversation style if using Microsoft Bing (options are creative, balanced, and precise).
- CHATGPT_USERNAME and CHATGPT_PASSWORD: Set the ChatGPT username and password.
- COMMANDS_ENABLED: Enable or disable command extensions.
- MEMORY SETTINGS: Configure short-term and long-term memory settings.
- AI_MODEL: Specify the AI model to be used (e.g., gpt-3.5-turbo, gpt-4, text-davinci-003, vicuna, etc.).
- AI_TEMPERATURE: Set the AI temperature (leave default if unsure).
- MAX_TOKENS: Set the maximum number of tokens for AI responses (default is 2000).
- WORKING_DIRECTORY: Set the agent's working directory.
- EXTENSIONS_SETTINGS: Configure settings for OpenAI, Huggingface, Selenium, Twitter, and GitHub.
- VOICE_OPTIONS: Choose between Brian TTS, Mac OS TTS, or ElevenLabs for text-to-speech.
For a detailed explanation of each setting, refer to the .env.example
file provided in the repository.
To launch the project using Docker:
- Install Docker on your system.
- Access the project's root folder.
- Execute the following command to build and activate the containers for both the Flask backend server and the frontend React application:
docker run -it --pull always -p 80:3000 --env-file=.env ghcr.io/josh-xt/agent-llm-frontend:main
docker run -it --pull always -p 5000:5000 --env-file=.env ghcr.io/josh-xt/agent-llm-backend:main
Access the web interface at http://localhost
To run Agent-LLM without Docker:
- Set up and run the frontend:
- Head to the
frontend
folder. - Execute the following command to install the necessary dependencies:
npm install npm run build
- In a separate terminal, navigate to the project's root folder and run the following command to activate the Flask backend server:
python app.py
- Return to the
frontend
folder and run the following command to initiate the frontend React application:
npm start
- Head to the
Agent-LLM provides several API endpoints for managing agents, managing tasks, and managing chains. The following are the available API endpoints:
-
Get Agents:
/api/agent
(GET)Retrieves a list of all available agents.
Output:
{"agents": ["agent1", "agent2", "agent3"]}
-
Add Agent:
/api/agent
(POST)Adds a new agent with the given agent name.
Output:
{"message": "Agent 'agent1' added"}
-
Get Agent Config:
/api/agent/<string:agent_name>
(GET)Retrieves the configuration of an agent with the given agent name.
Output:
{"agent_config": {"agent_name": "agent1", "agent_type": "task", "commands": {"command1": "true", "command2": "false"}}}
-
Rename Agent:
/api/agent/<string:agent_name>
(PUT)Renames an existing agent to a new name.
Output:
{"message": "Agent 'agent1' renamed to 'agent2'"}
-
Delete Agent:
/api/agent/<string:agent_name>
(DELETE)Deletes an existing agent with the given agent name.
Output:
{"message": "Agent 'agent1' deleted"}
-
Get Commands:
/api/agent/<string:agent_name>/command
(GET)Retrieves a list of available commands for an agent.
Output:
{"commands": [ {"friendly_name": "Friendly Name", "name": "command1", "enabled": True}, {"friendly_name": "Friendly Name 2", "name": "command2", "enabled": False }]}
-
Toggle Command:
/api/agent/<string:agent_name>/command
(PUT)Toggles a specific command for an agent.
Output:
{"message": "Command 'command1' enabled for agent 'agent1'"}
-
Chat:
/api/agent/<string:agent_name>/chat
(POST)Sends a chat prompt to the agent and receives a response.
Output:
{"message": "Prompt sent to agent 'agent1'"}
-
Get Chat History:
/api/<string:agent_name>/chat
(GET)Retrieves the chat history of an agent with the given agent name.
Output:
{"chat_history": ["chat1", "chat2", "chat3"]}
-
Instruct:
/api/agent/<string:agent_name>/instruct
(POST)
Sends an instruction prompt to the agent and receives a response.
Output: {"message": "Prompt sent to agent 'agent1'"}
- Wipe Agent Memories:
/api/agent/<string:agent_name>/memory
(DELETE)
Wipes the memories of an agent with the given agent name.
Output: {"message": "Agent 'agent1' memories wiped"}
- Toggle Task Agent:
/api/agent/<string:agent_name>/task
(PUT)
Toggles the task agent with the given agent name on and off.
Output: {"message": "Task agent 'agent1' started"}
Output: {"message": "Task agent 'agent1' stopped"}
- Get Task Output:
/api/agent/<string:agent_name>/task
(GET)
Retrieves the output of the task agent with the given agent name.
Output: {"output": "output"}
-
Get Task Status:
/api/agent/<string:agent_name>/task/status
(GET)Retrieves the status of the task agent with the given agent name.
Output:
{"status": "status"}
-
Get Chains:
/api/chain
(GET)Retrieves all available chains.
Output:
{chain_name: {step_number: {prompt_type: prompt}}}
-
Get Chain:
/api/chain/<string:chain_name>
(GET)Retrieves a specific chain.
Output:
{step_number: {prompt_type: prompt}}
-
Add Chain:
/api/chain
(POST)Adds a new chain.
Output:
{step_number: {prompt_type: prompt}}
-
Add Chain Step:
/api/chain/<string:chain_name>/step
(POST)Adds a step to an existing chain.
Output:
{step_number: {prompt_type: prompt}}
-
Update Step:
/api/chain/<string:chain_name>/step/<string:step_number>
(PUT)Updates a step in an existing chain.
Output:
{step_number: {prompt_type: prompt}}
-
Delete Chain:
/api/chain/<string:chain_name>
(DELETE)Deletes a specific chain.
Output:
{step_number: {prompt_type: prompt}}
-
Delete Chain Step:
/api/chain/<string:chain_name>/step/<string:step_number>
(DELETE)Deletes a step from an existing chain.
Output:
{step_number: {prompt_type: prompt}}
-
Run Chain:
/api/chain/<string:chain_name>/run
(POST)Runs a specific chain for an agent.
Output:
{step_number: {prompt_type: prompt}}
To learn more about the API endpoints and their usage, visit the API documentation at http://localhost:5000/api/docs when running the application locally, or http://localhost/api/docs if running with Docker.
To introduce new commands, generate a new Python file in the commands
folder and define a class inheriting from the Commands
class. Implement the desired functionality as methods within the class and incorporate them into the commands
dictionary.
To switch AI providers, adjust the AI_PROVIDER
setting in the .env
file. The application is compatible with OpenAI, Oobabooga Text Generation Web UI, and llama.cpp. To support additional providers, create a new Python file in the provider
folder and implement the required functionality.
Agent-LLM employs a plugin system with customizable prompts for instructing various AI models. These prompts are stored in the model-prompts
folder and are categorized by model name. Each model has five prompt types:
- model-prompts/{model}/execute.txt
- model-prompts/{model}/priority.txt
- model-prompts/{model}/system.txt
- model-prompts/{model}/task.txt
- model-prompts/{model}/script.txt
For a comprehensive explanation of prompt formats and usage, refer to the PROMPTS.md file.
The project is organized into several folders:
commands
: Stores pluggable command modules for enhancing Agent-LLM's functionality.frontend
: Contains frontend code for Agent-LLM's web interface.model-prompts
: Houses prompt templates for the various AI models used by Agent-LLM.provider
: Holds the implementations for the supported AI providers.
This project was inspired by and utilizes code from the following repositories:
Please consider exploring and contributing to these projects as well.
We welcome contributions to Agent-LLM! If you're interested in contributing, please check out the open issues, submit pull requests, or suggest new features. To stay updated on the project's progress, follow @Josh_XT on Twitter.
We appreciate any support for Agent-LLM's development, including donations, sponsorships, and any other kind of assistance. If you would like to support us, please contact us through our Discord server or Twitter @Josh_XT.
We're always looking for ways to improve Agent-LLM and make it more useful for our users. Your support will help us continue to develop and enhance the application. Thank you for considering to support us!
Run Agent-LLM using Docker (recommended) or by running the app.py
script. The application will load the initial task and objective from the configuration file and begin task execution. As tasks are completed, Agent-LLM will generate new tasks, prioritize them, and continue working through the task list.