Skip to main content

Communicative Agents for Mind Exploration - Implementation of CAMEL paper

Project description

CAMEL Agents

Communicative Agents for "Mind" Exploration

中文文档 | English

ArchitectureInstallationQuick StartAPI Reference


A Python implementation of CAMEL, a framework for building communicative agents that collaborate through role-playing.

Architecture

CAMEL Architecture
│
├── CAMELSociety (Orchestrator)
│   ├── Manages multi-agent collaboration
│   ├── Handles turn-taking between agents
│   └── Tracks conversation progress
│
├── RolePlayingAgent (Agents)
│   ├── Role-based behavior
│   ├── Contextual responses
│   └── Goal-oriented communication
│
├── Conversation (Dialogue Manager)
│   ├── Message history
│   ├── Context formatting
│   └── OpenAI format export
│
└── Types (Data Structures)
    ├── Role - Agent role definition
    ├── Task - Collaborative task
    ├── Message - Single utterance
    └── TaskSpec - Task specification

Core Workflow

┌─────────────────────────────────────────────────────────────────┐
│                    CAMEL Collaboration Flow                      │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│   Task ──▶ Agent 1 (Role A) ◀──▶ Conversation ◀──▶ Agent 2     │
│              │                    │                    │         │
│              │                    │                    │         │
│              ▼                    ▼                    ▼         │
│           Respond              Update              Respond       │
│              │                    │                    │         │
│              └────────────────────┴────────────────────┘         │
│                         (Iterate until done)                     │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Installation

pip install camel-agents

Quick Start

from camel import CAMELSociety, Role, AgentType

# Create society
society = CAMELSociety(verbose=True, max_turns=10)

# Define roles
programmer = Role(
    name="Python Programmer",
    description="Expert Python developer who writes clean code",
    agent_type=AgentType.ASSISTANT
)

reviewer = Role(
    name="Code Reviewer",
    description="Meticulous reviewer ensuring quality",
    agent_type=AgentType.USER
)

# Run collaboration
result = society.collaborate(
    task="Write a function to sort a list",
    agents=[programmer, reviewer]
)

print(f"Success: {result.success}")
print(f"Output: {result.final_output}")
print(result.to_transcript())

Predefined Roles

Role Description
programmer Expert Python programmer
reviewer Code quality reviewer
teacher Educational instructor
student Eager learner
writer Content creator
editor Text quality editor

CLI Usage

# Quick collaboration with predefined roles
camel run "Write a sorting algorithm" --role1 programmer --role2 reviewer

# Interactive mode
camel interactive --role1 teacher --role2 student

# List available roles
camel roles

# Export result
camel run "Task" --export result.json

API Reference

CAMELSociety

Method Description
add_agent(role) Add an agent to the society
collaborate(task, agents) Run collaborative task
quick_collaborate(task, role1, role2) Use predefined roles
get_conversation() Get current conversation
get_agents() Get all agents

RolePlayingAgent

Method Description
respond(message) Generate response as role
introduce() Self-introduction
get_conversation() Get agent's conversation

Academic Reference

Implementation of the CAMEL paper:

CAMEL: Communicative Agents for "Mind" Exploration of Large Language Models

Guohao Li, Hasan Hammoud, Hani Itani, Dmitrii Khizbullin, Bernard Ghanem

NeurIPS 2023

Paper: https://arxiv.org/abs/2303.17760

@inproceedings{li2023camel,
  title={CAMEL: Communicative Agents for "Mind" Exploration of Large Language Models},
  author={Li, Guohao and Hammoud, Hasan and Itani, Hani and Khizbullin, Dmitrii and Ghanem, Bernard},
  booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
  year={2023}
}

License

MIT License


Made with ❤️ by AI Agent Research Team

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

camel_agents-0.1.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

camel_agents-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file camel_agents-0.1.0.tar.gz.

File metadata

  • Download URL: camel_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for camel_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 95782274af70510dff4ceded53f9377d8b64c1931e9a1ec466d041eb9f08170d
MD5 d73a9d987d3f66d7cb81496369ccafda
BLAKE2b-256 a397362865a4f1fbed408753ff7789edc43da73205278ceee2466f14e778e482

See more details on using hashes here.

File details

Details for the file camel_agents-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: camel_agents-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for camel_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53e618671d28dbbd621043d2658328bd76b592d0d7cf48fb22c525a73db7b85b
MD5 cd14ff5f4c58d2bcb279fa8485a592a5
BLAKE2b-256 fa579ba101f9a83c80c1df715c5caa6bb1408d1dd0648ce2bb076fb6e26536b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page