Skip to content
BotServBotServ
Camel AIMulti-AgentAI AgentRolesLocal AI

Camel AI

Install Camel AI and set up your first role-based multi-agent conversations.

S

schutzgeist

2 min read
Camel AI

Camel AI

What this article covers

  • What Camel AI is and what it’s used for
  • How to install Camel AI
  • How to build a simple role-based conversation
  • How to integrate local models via Ollama
  • Who Camel AI is a good fit for

Introduction

Camel AI is a framework for role-based multi-agent conversations. You define two or more agents with distinct roles and let them interact with each other. The classic examples include a buyer negotiating with a seller, a teacher working with a student, or specialists collaborating within a team. Camel AI shines when you want to observe how agents conduct negotiations or exchange knowledge in a given scenario.

Camel AI at a glance

Camel AI operates around roles, tasks, and chat sessions. Each agent receives a system prompt that defines its role. A task sets the topic. The agents converse with each other until a defined endpoint is reached.

Installation

pip install camel-ai

To use it with OpenAI, you’ll need an API key:

export OPENAI_API_KEY="your-key"

For Ollama or other OpenAI-compatible APIs, also set:

export OPENAI_BASE_URL="http://localhost:11434/v1"

Getting started: buyer and seller

from camel.agents import ChatAgent
from camel.messages import BaseMessage

buyer = ChatAgent(
    system_message=BaseMessage.make_assistant_message(
        role_name="Buyer",
        content="You want to buy a laptop as cheaply as possible."
    )
)

seller = ChatAgent(
    system_message=BaseMessage.make_assistant_message(
        role_name="Seller",
        content="You want to sell a laptop as expensively as possible."
    )
)

message = BaseMessage.make_user_message(
    role_name="Buyer",
    content="What's the price of the laptop?"
)

response = seller.step(message)
print(response.msg.content)

This example starts a conversation between a buyer and seller. You can adapt the roles and topics to suit your needs.

When should you use Camel AI?

Use caseBenefits
Role-playingSimulate sales, negotiations, coaching
Knowledge transferHave agents from different specialties exchange information
Data generationGenerate conversations for training or testing
ResearchStudy agent behavior in specific scenarios

Common pitfalls

  • Roles need to be clear - The more precise your system prompts, the better the conversation flows.
  • Local models can struggle - Extended negotiations require a capable model.
  • API costs - Many rounds with multiple agents rack up tokens quickly.

Further reading

FAQ - Common questions

Is Camel AI free?

Yes, the open-source framework is free. Costs only apply when you use model APIs.

Can I run Camel AI locally?

Yes, with Ollama or another OpenAI-compatible endpoint. The API key can be a placeholder.

Sources

Back to Blog
Share:

Nächster Artikel in AI Agents

Weiterlesen
Codebase Memory

Related Posts