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 XDocumentation Index
Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
Use this file to discover all available pages before exploring further.
Dependency Installation
To get started, make sure you havecamel-ai installed.
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.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 calladd_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. Theadditional_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, theidof 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 theTaskdesign and will be fixed later.
Run the Task
Finally, run the task withprocess_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.