Task Generation Cookbook
You can also check this cookbook in colab here
⭐ Star us on Github, join our Discord or follow our X
In this tutorial, we will focus on demonstrating how to use the task module in the CAMEL framework. We will guide you through creating, evolving, and decomposing tasks to illustrate how the task module can be utilized for efficient task management in agent-based systems.
Sections included:
- Setting up a ChatAgent with the CAMEL framework
- Creating a Task and evolving it with the agent using TaskManager
- Task decomposition using the CAMEL task module
Let’s go step by step!
Step 1: Import necessary CAMEL modules
First, we need to import the required CAMEL modules for creating the ChatAgent and handling tasks.
Set your OpenAI 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.
Step 2: Set up the Large Language Model (LLM)
Next, we set up the model configuration. We are using a GPT-4O Mini in this case for our assistant agent. The configuration is designed to ensure the agent’s behavior remains deterministic by setting temperature=0.0, meaning no randomness will be introduced in the responses.
Step 3: Initialize the ChatAgent
We now create a ChatAgent using the previously defined model. This agent will interact with tasks in the CAMEL framework, following the role of a personal math tutor and programmer.
Step 4: Evolve and decompose tasks
We now create a Task that represents a math problem for the assistant to solve. In this case, we are asking the assistant to calculate how much Weng earned for babysitting based on her hourly rate and the time she worked.
Evolve the Task
We can evolve the task using the TaskManager, which allows the agent to potentially update or reframe the task based on its internal logic and context.
Decompose the Task
Sometimes, tasks are complex and need to be broken down into smaller subtasks. We use decompose() to allow the agent to split the original task into simpler parts.