Skip to content
forked from camel-ai/camel

🐫 CAMEL: Finding the Scaling Law of Agents. The first and the best multi-agent framework. https://www.camel-ai.org

License

Notifications You must be signed in to change notification settings

amaan-ai20/camel

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Colab Hugging Face Slack Discord Wechat Twitter


CAMEL: Finding the Scaling Laws of Agents

Python Version PyTest Status Documentation Star Package License

Community | Installation | Documentation | Examples | Paper | Citation | Contributing | CAMEL-AI

Community

🐫 CAMEL is an open-source community dedicated to finding the scaling laws of agents. We believe that studying these agents on a large scale offers valuable insights into their behaviors, capabilities, and potential risks. To facilitate research in this field, we implement and support various types of agents, tasks, prompts, models, and simulated environments.

Join us (Discord, WeChat or Slack) in pushing the boundaries of finding the scaling laws of agents.

What Can You Build With CAMEL?

πŸ€– Customize Agents

  • Customizable agents are the fundamental entities of the CAMEL architecture. CAMEL empowers you to customize agents using our modular components for specific tasks.

βš™οΈ Build Multi-Agent Systems

  • We propose a multi-agent framework to address agents' autonomous cooperation challenges, guiding agents toward task completion while maintaining human intentions.

πŸ’» Practical Applications

  • The CAMEL framework serves as a generic infrastructure for a wide range of multi-agent applications, including task automation, data generation, and world simulations.

Why Should You Use CAMEL?

  1. Comprehensive Customization and Collaboration:

    • Integrates over 20 advanced model platforms (e.g., commercial models like OpenAI, open-source models such as Llama3, and self-deployment frameworks like Ollama.).

    • Supports extensive external tools (e.g., Search, Twitter, Github, Google Maps, Reddit, Slack utilities).

    • Includes memory and prompt components for deep customization.

    • Facilitates complex multi-agent systems with advanced collaboration features.

  2. User-Friendly with Transparent Internal Structure:

    • Designed for transparency and consistency in internal structure.

    • Offers comprehensive tutorials and detailed docstrings for all functions.

    • Ensures an approachable learning curve for newcomers.

Try It Yourself

We provide a Google Colab demo showcasing a conversation between two ChatGPT agents playing roles as a python programmer and a stock trader collaborating on developing a trading bot for stock market.

Installation

From PyPI

To install the base CAMEL library:

pip install camel-ai

Some features require extra dependencies:

  • To install with all dependencies:
    pip install 'camel-ai[all]'
  • To use the HuggingFace agents:
    pip install 'camel-ai[huggingface-agent]'
  • To enable RAG or use agent memory:
    pip install 'camel-ai[tools]'

From Source

Install CAMEL from source with poetry (Recommended):

# Make sure your python version is later than 3.10
# You can use pyenv to manage multiple python versions in your system

# Clone github repo
git clone https://github.com/camel-ai/camel.git

# Change directory into project directory
cd camel

# If you didn't install poetry before
pip install poetry  # (Optional)

# We suggest using python 3.10
poetry env use python3.10  # (Optional)

# Activate CAMEL virtual environment
poetry shell

# Install the base CAMEL library
# It takes about 90 seconds
poetry install

# Install CAMEL with all dependencies
poetry install -E all # (Optional)

# Exit the virtual environment
exit

Tip

If you encounter errors when running poetry install, it may be due to a cache-related problem. You can try running:

poetry install --no-cache

Install CAMEL from source with conda and pip:

# Create a conda virtual environment
conda create --name camel python=3.10

# Activate CAMEL conda environment
conda activate camel

# Clone github repo
git clone -b v0.2.15a0 https://github.com/camel-ai/camel.git

# Change directory into project directory
cd camel

# Install CAMEL from source
pip install -e .

# Or if you want to use all other extra packages
pip install -e .[all] # (Optional)

From Docker

Detailed guidance can be find here

Quick Start

By default, the agent uses the ModelType.DEFAULT model from the ModelPlatformType.DEFAULT. You can configure the default model platform and model type using environment variables. If these are not set, the agent will fall back to the default settings:

ModelPlatformType.DEFAULT = "openai"
ModelType.DEFAULT = "gpt-4o-mini"

Setting Default Model Platform and Model Type (Optional)

You can customize the default model platform and model type by setting the following environment variables:

export DEFAULT_MODEL_PLATFORM_TYPE=<your preferred platform>  # e.g., openai, anthropic, etc.
export DEFAULT_MODEL_TYPE=<your preferred model>  # e.g., gpt-3.5-turbo, gpt-4o-mini, etc.

Setting Your Model API Key (Using OpenAI as an Example)

For Bash shell (Linux, macOS, Git Bash on Windows):

# Export your OpenAI API key
export OPENAI_API_KEY=<insert your OpenAI API key>
OPENAI_API_BASE_URL=<inert your OpenAI API BASE URL>  #(Should you utilize an OpenAI proxy service, kindly specify this)

For Windows Command Prompt:

REM export your OpenAI API key
set OPENAI_API_KEY=<insert your OpenAI API key>
set OPENAI_API_BASE_URL=<inert your OpenAI API BASE URL>  #(Should you utilize an OpenAI proxy service, kindly specify this)

For Windows PowerShell:

# Export your OpenAI API key
$env:OPENAI_API_KEY="<insert your OpenAI API key>"
$env:OPENAI_API_BASE_URL="<inert your OpenAI API BASE URL>"  #(Should you utilize an OpenAI proxy service, kindly specify this)

Replace <insert your OpenAI API key> with your actual OpenAI API key in each case. Make sure there are no spaces around the = sign.

Please note that the environment variable is session-specific. If you open a new terminal window or tab, you will need to set the API key again in that new session.

For .env File:

To simplify the process of managing API Keys, you can use store information in a .env file and load them into your application dynamically.

  1. Modify .env file in the root directory of CAMEL and fill the following lines:
OPENAI_API_KEY=<fill your API KEY here>

Replace with your actual API key.

  1. Load the .env file in your Python script: Use the load_dotenv() function from the dotenv module to load the variables from the .env file into the environment. Here's an example:
from dotenv import load_dotenv
import os

# Load environment variables from the .env file
load_dotenv()

For more details about the key names in project and how to apply key, you can refer to here.

Tip

By default, the load_dotenv() function does not overwrite existing environment variables that are already set in your system. It only populates variables that are missing. If you need to overwrite existing environment variables with the values from your .env file, use the override=True parameter:

load_dotenv(override=True)

After setting the OpenAI API key, you can run the role_playing.py script. Find tasks for various assistant-user roles here.

# You can change the role pair and initial prompt in role_playing.py
python examples/ai_society/role_playing.py

Also feel free to run any scripts below that interest you:

# You can change the role pair and initial prompt in these python files

# Examples of two agents role-playing
python examples/ai_society/role_playing.py

# The agent answers questions by utilizing code execution tools.
python examples/toolkits/code_execution_toolkit.py

# Generating a knowledge graph with an agent
python examples/knowledge_graph/knowledge_graph_agent_example.py  

# Multiple agents collaborating to decompose and solve tasks
python examples/workforce/multiple_single_agents.py 

# Use agent to generate creative image
python examples/vision/image_crafting.py

For additional feature examples, see the examples directory.

Documentation

The complete documentation pages for the CAMEL package. Also, detailed tutorials for each part are provided below:

Agents

Explore different types of agents, their roles, and their applications.


Key Modules

Core components and utilities to build, operate, and enhance CAMEL-AI agents and societies.

Module Description
Models Model architectures and customization options for agent intelligence.
Messages Messaging protocols for agent communication.
Memory Memory storage and retrieval mechanisms.
Tools Tools integration for specialized agent tasks.
Prompts Prompt engineering and customization.
Tasks Task creation and management for agent workflows.
Loaders Data loading tools for agent operation.
Storages Storage solutions for agent.
Society Components for building agent societies and inter-agent collaboration.
Embeddings Embedding models for RAG.
Retrievers Retrieval methods for knowledge access.

Cookbooks

Practical guides and tutorials for implementing specific functionalities in CAMEL-AI agents and societies.

Cookbook Description
Creating Your First Agent A step-by-step guide to building your first agent.
Creating Your First Agent Society Learn to build a collaborative society of agents.
Society Cookbook Advanced configurations for agent societies.
Model Speed Comparison Cookbook Benchmarking models for performance.
Message Cookbook Best practices for message handling in agents.
Tools Cookbook Integrating tools for enhanced functionality.
Memory Cookbook Implementing memory systems in agents.
RAG Cookbook Recipes for Retrieval-Augmented Generation.
Prompting Cookbook Techniques for effective prompt creation.
Task Generation Cookbook Automating task generation for agents.
Graph RAG Cookbook Leveraging knowledge graphs with RAG.
Role-Playing Scraper for Report & Knowledge Graph Generation Create role-playing agents for data scraping and reporting.
Video Analysis Techniques for agents in video data analysis.
Track CAMEL Agents with AgentOps Tools for tracking and managing agents in operations.
Create A Hackathon Judge Committee with Workforce Building a team of agents for collaborative judging.
3 Ways to Ingest Data from Websites with Firecrawl Explore three methods for extracting and processing data from websites using Firecrawl.
Data Deneration with CAMEL and Finetuning with Unsloth Learn how to generate data with CAMEL and fine-tune models effectively with Unsloth.
Customer Service Discord Bot with Agentic RAG Learn how to build a robust customer service bot for Discord using Agentic RAG.
Create AI Agents that work with your PDFs using Chunkr & Mistral AI Learn how to create AI agents that work with your PDFs using Chunkr and Mistral AI.
Data Gen with Real Function Calls and Hermes Format Explore how to generate data with real function calls and the Hermes format.

Utilize Various LLMs as Backends

For more details, please see our Models Documentation.

Data (Hosted on Hugging Face)

Dataset Chat format Instruction format Chat format (translated)
AI Society Chat format Instruction format Chat format (translated)
Code Chat format Instruction format x
Math Chat format x x
Physics Chat format x x
Chemistry Chat format x x
Biology Chat format x x

Visualizations of Instructions and Tasks

Dataset Instructions Tasks
AI Society Instructions Tasks
Code Instructions Tasks
Misalignment Instructions Tasks

Implemented Research Ideas from Other Works

We implemented amazing research ideas from other works for you to build, compare and customize your agents. If you use any of these modules, please kindly cite the original works:

Other Research Works Based on Camel

  • Agent Trust: Can Large Language Model Agents Simulate Human Trust Behavior?

  • CRAB: Cross-environment Agent Benchmark for Multimodal Language Model Agents.

  • OASIS: Open Agents Social Interaction Simulations on a Large Scale.

We warmly invite you to use CAMEL for your impactful research.

News

πŸ“’ Added support for Qwen models, Deepseek models to the 🐫 CAMEL framework!. (Nov 28, 2024)

  • Integrate SGLang into the 🐫 CAMEL framework. (Dec, 13, 2024)
  • Integrated Reward Model into the 🐫 CAMEL framework. (Dec, 13, 2024)
  • Added GAIA Benchmark! (Dec, 09, 2024)
  • ...
  • Released AI Society and Code dataset (April 2, 2023)
  • Initial release of CAMEL python library (March 21, 2023)

Citation

@inproceedings{li2023camel,
  title={CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Society},
  author={Li, Guohao and Hammoud, Hasan Abed Al Kader and Itani, Hani and Khizbullin, Dmitrii and Ghanem, Bernard},
  booktitle={Thirty-seventh Conference on Neural Information Processing Systems},
  year={2023}
}

Acknowledgment

Special thanks to Nomic AI for giving us extended access to their data set exploration tool (Atlas).

We would also like to thank Haya Hammoud for designing the initial logo of our project.

License

The source code is licensed under Apache 2.0.

Contributing to CAMEL 🐫

We appreciate your interest in contributing to our open-source initiative. We provide a document of contributing guidelines which outlines the steps for contributing to CAMEL. Please refer to this guide to ensure smooth collaboration and successful contributions. πŸ€πŸš€

Contact

For more information please contact [email protected].

About

🐫 CAMEL: Finding the Scaling Law of Agents. The first and the best multi-agent framework. https://www.camel-ai.org

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.8%
  • Other 0.2%