Skip to main content
Workforce is a system where multiple agents collaborate to solve a given task. In this notebook, we will walk through it with a demo of a hackathon judge committee, where judges with different personas collaborate together to give scores to hackathon projects. You can also check this cookbook in colab here Star us on Github, join our Discord or follow our X

Dependency Installation

To get started, make sure you have camel-ai installed.
Workforce employs an asynchronous design with coroutines. However, since coroutines cannot directly run in notebooks, we need to do specific handlings in this demo. Note that, under most normal cases (not inside notebook environment), we don’t need to do this.

Key Configuration

In this demo, we will use tools related to web searching. Therefore, we need to configure the OpenAI API key, along with the Google API keys beforehand.
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.

Define a Function for Making Judge Agent

In this demo, we will create multiple judge agents with different personas and scoring criteria. For reusability, we first create a function to make judge agents.

Make a Mocked Hackathon Project

Then we will create a mocked hackathon project description, which will be later sent to the judges for scoring.

Create Agents

Then we will create five unique agents that will later collaborate together. Among these five agents, one of them is the helper that will help collect information and summarize the final result. We add search functions to this agent so that it can obtain information from online searches. The other four agents, on the other hand, are judges with different personas and criteria. They will give scores to the project according to the description, along with the information collected by the helper.

Create Workforce

Then we will do the most important part of the demo: create a workforce. Despite its importance, this is actually easy. First, we can simply instantiate a workforce by passing a description to it. Then, we just call add_single_agent_workder() to add agents into it, along with their descriptions. Note that, the description is very important in workforce, because it helps the coordinator agent in the workforce to do the task designation. Therefore, it’s recommended to clearly mark the responsibility and capability of an agent when adding it to the workforce.

Create a Task

A task is what a workforce accepts and processes. We can initialize a task by passing the content into it. It’s recommended that the content of task is as detailed as possible, which will facilitate the later task decomposition and handling. The additional_info here is an optional field. It will come in handy when the task has important additional information, and you want it to be preserved during the whole process. Workforce will keep additional_info unchanged no matter how the task is decomposed and processed. It’s perfect for keeping the project description under this scenario.
Also note that, the id of a task is not something important and you can fill in whatever value you like (we suggest "0" though). This is due to some legacy problems in the Task design and will be fixed later.

Run the Task

Finally, run the task with process_task() function. You can see the whole process being shown in the console, and at last the final result of the task will be printed.

🌟 Highlights

The power of multi-agent system lies in the diversity. This notebook has guided you through setting up and running a CAMEL Workforce for a hackathon judge committee, showcasing how multiple agents can collaborate to solve complex tasks. You can easily extend this example to other scenarios requiring diverse perspectives and expertise, e.g. agents with different tool selections, etc.

⭐ Star the Repo!

If you find CAMEL useful or interesting, please consider giving it a star on GitHub! Your stars help others find this project and motivate us to continue improving it.