reset to get our initial observation.
Let’s install the CAMEL package with all its dependencies:
Loong
Tic Tac Toe
You can also open this on Google Colab
In this cookbook, I want to show how Multi-Step environments work in CAMEL. Our RL modules were built to mimic OpenAI Gym, so if you’re familiar with Gym’s interface, you’ll feel right at home.
We will use the Tic-Tac-Toe environment as an example to show the lifecycle of an environment.
The Tic-Tac-Toe environment can be used to evaluate agents, generate synthetic data for distillation, or train an agent to play the game.
First, we need to initialize our environment and set it up. Then we can call
We will use GPT-4o-mini, so let’s enter our API key.
Alternatively, if running on Colab, you could save your API keys and tokens as Colab Secrets, and use them across notebooks.
To do so, comment out the above manual API key prompt code block(s), and uncomment the following codeblock.
⚠️ Don’t forget granting access to the API key you would be using to the current notebook.
Let’s next define the model-backend and the agent.
You can also add a system prompt or equip your agent with tools, but for the sake of simplicity we just create a bare agent with GPT-4o-mini.
Next, we will simulate one episode.
As you can see, GPT-4o-mini is quite bad!
Finally, we close the environment.