CAMEL: Communicative Agents for AI Society Study
raw JSON → 0.2.90 verified Fri May 01 auth: no python
CAMEL is a multi-agent communication framework for building autonomous AI agents that can role-play, collaborate, and solve complex tasks. It provides model backends (OpenAI, Anthropic, DeepSeek, etc.), toolkits, memory, and planning. Current stable version is 0.2.90 (Python 3.10–3.14). Development is active with frequent pre-releases (e.g., 0.2.91a4).
pip install camel-ai Common errors
error ModuleNotFoundError: No module named 'camel.agents' ↓
cause Old code using plural 'agents' after API change.
fix
Use
from camel.agent import ChatAgent (singular). error AttributeError: module 'camel' has no attribute 'ChatAgent' ↓
cause Trying to import ChatAgent from top-level camel instead of camel.agent.
fix
Correct import:
from camel.agent import ChatAgent. error ImportError: cannot import name 'ModelFactory' from 'camel' ↓
cause ModelFactory is not in top-level camel.
fix
Use
from camel.models import ModelFactory. Warnings
breaking As of v0.2.0, the top-level API was restructured. Many classes moved from `camel.agent` to `camel.agents` (note the 's') and then back. Always check import paths. ↓
fix Use `from camel.agent import ChatAgent` (singular) for v0.2.90.
breaking In v0.2.50+, `ModelFactory.create()` changed signature; `model_name` parameter was renamed to `model_type`. ↓
fix Use `ModelFactory.create(model_type='gpt-4o-mini', api_key=...)`.
gotcha The library installs with minimal dependencies by default. Many features (e.g., Anthropic, DeepSeek, web search) require extra installs like `camel-ai[anthropic]`. ↓
fix Install extras: `pip install 'camel-ai[all]'` or targeted extras like `camel-ai[anthropic]`.
gotcha CAMEL uses pydantic v2 for configuration. Mixing pydantic v1 models may cause silent validation failures. ↓
fix Ensure all pydantic models use v2 syntax (`BaseModel` from `pydantic` not `pydantic.v1`).
Install
pip install 'camel-ai[all]' Imports
- ChatAgent wrong
from camel import ChatAgentcorrectfrom camel.agent import ChatAgent - ModelFactory wrong
from camel import ModelFactorycorrectfrom camel.models import ModelFactory - TaskSpecifyAgent wrong
from camel.agents import TaskSpecifyAgentcorrectfrom camel.agent import TaskSpecifyAgent - RolePlaying wrong
from camel import RolePlayingcorrectfrom camel.societies import RolePlaying
Quickstart
import os
from camel.agent import ChatAgent
from camel.message import SystemMessage, UserMessage
# Set your API key
os.environ['OPENAI_API_KEY'] = os.environ.get('OPENAI_API_KEY', 'your-key-here')
agent = ChatAgent(
system_message=SystemMessage(content="You are a helpful assistant."),
model_type="gpt-4o-mini"
)
response = agent.step(UserMessage(content="What is the capital of France?"))
print(response.msgs[0].content)