This notebook demonstrates how to set up and leverage CAMELโs ability to use
ChatAgent() class.
In this notebook, youโll explore:
- CAMEL: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.
- ChatAgent(): The class is a cornerstone of CAMEL.
Philosophical Bits
TheChatAgent() class is a cornerstone of CAMEL ๐ซ. We design our agent with the spirit to answer the following question:
Can we design an autonomous communicative agent capable of steering the conversation toward task completion with minimal human supervision?In our current implementation, we consider agents with the following key features:
- Role: along with the goal and content specification, this sets the initial state of an agent, guiding the agent to take actions during the sequential interaction.
- Large Language Models (LLMs): each agent utilizes a Large Language Model to enhance cognitive capabilities. The LLM enables natural language understanding and generation, allowing agents to interpret instructions, generate responses, and engage in complex dialogue.
- Memory: in-context memory and external memory which allows the agent to infer and learn in a more grounded approach.
- Tools: a set of functions that our agents can utilize to interact with the external world; essentially this gives embodiments to our agents.
- Communication: our framework allows flexible and scalable communication between agents. This is fundamental for the critical research question.
- Reasoning: we will equip agents with different planning and reward (critic) learning abilities, allowing them to optimize task completion in a more guided approach.
๐ฆ Installation
๐ Setting Up API Keys
Youโll need to set up your API keys for OpenAI.- Add the API key or token to the Colab Secrets
- Grant the secret access to the current notebook
- Access the secret by uncommenting the following codeblock.

Quick Start
Letโs first play with aChatAgent instance by simply initialize it with a system message and interact with user messages.
๐น Step 1: Define the Role
Create a system message to define agentโs default role and behaviors.๐น Step 2: Set up the Model
UseModelFactory to set up the backend model for agent, for more detailed model settings, please go to our model documentation.
ChatAgent
๐น Step 3: Interact with the Agent with .step()
Advanced Features
๐ง Tool Usage
For more detailed tool settings, please go to our tools cookbook.๐ง Memory
By default our agent is initialized withChatHistoryMemory, allowing agents to do in-context learning, though restricted by the finite window length.
Assume that you have followed the setup in Quick Start. Letโs first check what is inside its brain.
BaseMessage; for example, use one new user message:
Miscs
-
Setting the agent to its initial state.
-
Set the output language for the agent.
-
The
ChatAgentclass offers several useful initialization options, includingmodel_type,model_config,memory,message_window_size,token_limit,output_language,tools, andresponse_terminators.
๐ Highlights
This notebook has guided you through setting up and exploring The CAMELChatAgent() and itโs features.
Key tools utilized in this notebook include:
- CAMEL: A powerful multi-agent framework that enables Retrieval-Augmented Generation and multi-agent role-playing scenarios, allowing for sophisticated AI-driven tasks.
- ChatAgent(): The class is a cornerstone of CAMEL.
- ๐ซ Creating Your First CAMEL Agent free Colab
- Graph RAG Cookbook free Colab
- ๐งโโ๏ธ Create A Hackathon Judge Committee with Workforce free Colab
- ๐ฅ 3 ways to ingest data from websites with Firecrawl & CAMEL free Colab
- ๐ฆฅ Agentic SFT Data Generation with CAMEL and Mistral Models, Fine-Tuned with Unsloth free Colab

