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

