This project provides an AI Agent Engine designed for the all-time-high project, in order to support multiple agents orchestration. It offers endpoints for creating agents and evaluating battles between agents by leveraging state-of-the-art LLM models.
This project is powered by Swarms
The Engine serves as a plugin into the All Time High project.
- Heartbeat Endpoint: Test the availability of the API.
- Create Agent Endpoint: Generate a new swarms agent by specifying an agent name and a prompt.
- Evaluate Battle Endpoint: Evaluate player-versus-player (PvP) battles between agents using provided attacker and defender prompts.
- URL:
/api/heartbeat
- Method: GET
- Response:
{ "status": "ok" }
- URL:
/api/createAgent
- Method: GET
- Query Parameters:
agent_name
: Name to be assigned to the agent.prompt
: Initial prompt for the agent.
- Response:
{ "response": "Agent creation response text" }
- URL:
/api/evaluateBattle
- Method: GET
- Query Parameters:
attacker_name
: Attacker agent's name.attacker_prompt
: Prompt associated with the attacker.defender_name
: Defender agent's name.defender_prompt
: Prompt associated with the defender.
- Response:
{ "result": "Battle evaluation result" }
-
Clone the Repository
git clone <repository-url> cd <repository-directory>
-
Create a Virtual Environment and Install Dependencies
python -m venv venv source venv/bin/activate # For Windows, use `venv\Scripts\activate` pip install -r requirements.txt
-
Configure Environment Variables
- Create a
.env
file in the project root directory. - Add the following configuration:
OPENAI_API_KEY=your_openai_api_key
- Create a
-
Run the Application
python run.py
├── app
│ ├── init.py # Initializes the Flask app and registers the API blueprint
│ ├── api.py # Contains endpoints for creating agents and evaluating battles
│ └── agent_logic.py # Implements logic for generating agent responses and evaluating battles using OpenAI's API
├── run.py # Application entry point
└── .gitignore # Files and directories to be ignored by version control
- Python 3.x
- Flask
- OpenAI Python package
- Additional dependencies as listed in
requirements.txt
This project is licensed under the MIT License.