CAMEL AI Example
Using CAMEL AI for Multi-Agent Simulation
View Notebook on Github
CAMEL AI Multi Agent Example
In this example, we will use CamelAI to simulate tools! In this case, we will best determine how many shots it takes to beat an enemy with a blue shield in Apex Legeneds using melee only. The character “Pathfinder” from Apex Legends will answer.
First let’s install the required packages for this example.
Next we import the necessary libraries
Next, we’ll set our API keys. There are several ways to do this, the code below is just the most foolproof way for the purposes of this notebook. It accounts for both users who use environment variables and those who just want to set the API Key here in this notebook.
-
Create an environment variable in a .env file or other method. By default, the AgentOps
init()
function will look for an environment variable namedAGENTOPS_API_KEY
. Or… -
Replace
<your_agentops_key>
below and pass in the optionalapi_key
parameter to the AgentOpsinit(api_key=...)
function. Remember not to commit your API key to a public repo!
Now we will initialize our AgentOps client.
Let’s start with setting our task prompt and setting our tools.
You can look at the link below to see all available tools: https://docs.camel-ai.org/key_modules/tools.html
We will now create our Camel AI session which is of RolePlaying
type. Here we will set the assistant and user role names, as well as the model and tools for each agent.
Let’s print out the Assistant System Message and User Task Prompt.
Now we will initiate our Camel AI session and begin the chat loop. You can see that we have set the number of messages to 50. This is to prevent the session from running indefinitely.
Awesome! We’ve successfully completed our session.
Now we will end the session with a success message. We can also end the session with a failure or indeterminate status. By default, the session will be marked as indeterminate.
Check your session
Finally, check your run on AgentOps
Now if we look in the AgentOps dashboard, you will see a session recorded with the LLM calls and tool usage.