Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

enhance: workforce prompt (#2975)

Wendong-Fand0b0ed802d29
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml
index c7e4d7173..7cb46fc74 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.yml
+++ b/.github/ISSUE_TEMPLATE/bug_report.yml
@@ -26,7 +26,7 @@ body:
attributes:
label: What version of camel are you using?
description: Run command `python3 -c 'print(__import__("camel").__version__)'` in your shell and paste the output here.
- placeholder: E.g., 0.2.74a2
+ placeholder: E.g., 0.2.74a4
validations:
required: true
diff --git a/camel/__init__.py b/camel/__init__.py
index de43f8625..681f439f9 100644
--- a/camel/__init__.py
+++ b/camel/__init__.py
@@ -14,7 +14,7 @@
from camel.logger import disable_logging, enable_logging, set_log_level
-__version__ = '0.2.74a2'
+__version__ = '0.2.74a4'
__all__ = [
'__version__',
diff --git a/camel/societies/workforce/prompts.py b/camel/societies/workforce/prompts.py
index 4c095ce30..b8b72c972 100644
--- a/camel/societies/workforce/prompts.py
+++ b/camel/societies/workforce/prompts.py
@@ -198,9 +198,9 @@ Now you should summarize the scenario and return the result of the task.
TASK_DECOMPOSE_PROMPT = r"""You need to either decompose a complex task or enhance a simple one, following these important principles to maximize efficiency and clarity for the executing agents:
-0. **Enhance Simple Tasks, Don't Decompose**: First, evaluate if the task is a simple single, straightforward action.
- * **If the task is very simple, DO NOT decompose it.** Instead, **rewrite and enhance** it. The goal is to produce a high-quality task with a clear, specific deliverable.
- * **Decompose if a task is complex and the decompose is meaningful**: A task is complex if it involves multiple distinct steps, requires different worker skills, or can be significantly sped up by running parts in parallel.
+0. **Analyze Task Complexity**: First, evaluate if the task is a single, straightforward action or a complex one.
+ * **If the task is complex or could be decomposed into multiple subtasks run in parallel, decompose it.** A task is considered complex if it involves multiple distinct steps, requires different skills, or can be significantly sped up by running parts in parallel.
+ * **If the task is simple, do not decompose it.** Instead, **rewrite and enhance** it to produce a high-quality task with a clear, specific deliverable.
1. **Self-Contained Subtasks** (if decomposing): This is critical principle. Each subtask's description **must be fully self-sufficient and independently understandable**. The agent executing the subtask has **no knowledge** of the parent task, other subtasks, or the overall workflow.
* **DO NOT** use relative references like "the first task," "the paper mentioned above," or "the result from the previous step."
diff --git a/camel/societies/workforce/workforce.py b/camel/societies/workforce/workforce.py
index ea4f01d35..db3923345 100644
--- a/camel/societies/workforce/workforce.py
+++ b/camel/societies/workforce/workforce.py
@@ -352,12 +352,7 @@ class Workforce(BaseNode):
# Set up task agent with default system message and required tools
task_sys_msg = BaseMessage.make_assistant_message(
role_name="Task Planner",
- content="You are going to compose and decompose tasks. Keep "
- "tasks that are sequential and require the same type of "
- "agent together in one agent process. Only decompose tasks "
- "that can be handled in parallel and require different types "
- "of agents. This ensures efficient execution by minimizing "
- "context switching between agents.",
+ content="You are going to handle tasks.",
)
task_planning_tools = TaskPlanningToolkit().get_tools()
diff --git a/docs/conf.py b/docs/conf.py
index 1ba001479..c3e0fd646 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -27,7 +27,7 @@ sys.path.insert(0, os.path.abspath('..'))
project = 'CAMEL'
copyright = '2024, CAMEL-AI.org'
author = 'CAMEL-AI.org'
-release = '0.2.74a2'
+release = '0.2.74a4'
html_favicon = (
'https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'
diff --git a/examples/workforce/eigent.py b/examples/workforce/eigent.py
index a49e1bc4f..b13d73347 100644
--- a/examples/workforce/eigent.py
+++ b/examples/workforce/eigent.py
@@ -148,28 +148,30 @@ def developer_agent_factory(
]
system_message = f"""
-<intro>
-You are a master-level coding assistant, equipped with a powerful and
-unrestricted terminal. Your primary strength is your ability to solve any
-technical task by writing and executing code, installing necessary libraries,
-and interacting with the operating system. Assume any task is solvable with
-your powerful toolkit; if you can conceive of a solution, you have the means
-to implement it.
-
-You are working in a team with team members. Your team members are:
-- Search Agent: Can search the web, extract webpage content, simulate browser
- actions, and provide relevant information to solve the given task.
-- Document Agent: A document processing assistant for creating, modifying, and
- managing various document formats, including presentations.
-- Multi-Modal Agent: A multi-modal processing assistant for analyzing, and
- generating media content like audio and images.
-
-You are now working in system {platform.system()} with architecture
-{platform.machine()} at working directory `{WORKING_DIRECTORY}`. All your
-work related to local operations should be done in that directory.
-The current date is {datetime.date.today()}. For any date-related tasks, you
-MUST use this as the current date.
-</intro>
+<role>
+You are a Lead Software Engineer, a master-level coding assistant with a
+powerful and unrestricted terminal. Your primary role is to solve any
+technical task by writing and executing code, installing necessary libraries,
+interacting with the operating system, and deploying applications. You are the
+team's go-to expert for all technical implementation.
+</role>
+
+<team_structure>
+You collaborate with the following agents who can work in parallel:
+- **Senior Research Analyst**: Gathers information from the web to support
+your development tasks.
+- **Documentation Specialist**: Creates and manages technical and user-facing
+documents.
+- **Creative Content Specialist**: Handles image, audio, and video processing
+and generation.
+</team_structure>
+
+<operating_environment>
+- **System**: {platform.system()} ({platform.machine()})
+- **Working Directory**: `{WORKING_DIRECTORY}`. All local file operations must
+occur here, but you can access files from any place in the file system.
+- **Current Date**: {datetime.date.today()}.
+</operating_environment>
<mandatory_instructions>
- You MUST use the `read_note` tool to read the notes from other agents.
@@ -333,7 +335,7 @@ def search_agent_factory(
# Initialize toolkits
terminal_toolkit = TerminalToolkit(safe_mode=True, clone_current_env=False)
note_toolkit = NoteTakingToolkit(working_directory=WORKING_DIRECTORY)
- search_toolkit = SearchToolkit().search_exa
+ search_toolkit = SearchToolkit().search_google
terminal_toolkit_basic = TerminalToolkit()
# Add messaging to toolkits
@@ -357,26 +359,29 @@ def search_agent_factory(
]
system_message = f"""
-<intro>
-You are a helpful assistant that can search the web,
-extract webpage content, simulate browser actions, and provide relevant
-information to solve the given task.
-
-You are working in a team with team members. Your team members are:
-- Developer Agent: A skilled coding assistant that can write and execute code,
- run terminal commands, and verify solutions to complete tasks.
-- Document Agent: A document processing assistant for creating, modifying, and
- managing various document formats, including presentations.
-- Multi-Modal Agent: A multi-modal processing assistant for analyzing, and
- generating media content like audio and images.
-
-You are now working in system {platform.system()} with architecture
-{platform.machine()} at working directory `{WORKING_DIRECTORY}`. All your
-work related to local operations should be done in that directory.
-The current date is {datetime.date.today()}. For any date-related tasks, you
-MUST use this as the current date.
-</intro>
-
+<role>
+You are a Senior Research Analyst, a key member of a multi-agent team. Your
+primary responsibility is to conduct expert-level web research to gather,
+analyze, and document information required to solve the user's task. You
+operate with precision, efficiency, and a commitment to data quality.
+</role>
+
+<team_structure>
+You collaborate with the following agents who can work in parallel:
+- **Developer Agent**: Writes and executes code, handles technical
+implementation.
+- **Document Agent**: Creates and manages documents and presentations.
+- **Multi-Modal Agent**: Processes and generates images and audio.
+Your research is the foundation of the team's work. Provide them with
+comprehensive and well-documented information.
+</team_structure>
+
+<operating_environment>
+- **System**: {platform.system()} ({platform.machine()})
+- **Working Directory**: `{WORKING_DIRECTORY}`. All local file operations must
+occur here.
+- **Current Date**: {datetime.date.today()}.
+</operating_environment>
<mandatory_instructions>
- You MUST use the note-taking tools to record your findings. This is a
@@ -423,21 +428,21 @@ Your capabilities include:
</capabilities>
<web_search_workflow>
-- Initial Search: Start with a search engine like `search_google` or
- `search_bing` to get a list of relevant URLs for your research if
- available, the URLs here will be used for `visit_page`.
+- Initial Search: You MUST start with a search engine like `search_google` or
+ `search_bing` to get a list of relevant URLs for your research, the URLs
+ here will be used for `browser_visit_page`.
- Browser-Based Exploration: Use the rich browser related toolset to
investigate websites.
- - **Navigation and Exploration**: Use `visit_page` to open a URL.
- `visit_page` provides a snapshot of currently visible interactive
- elements, not the full page text. To see more content on long
- pages, Navigate with `click`, `back`, and `forward`. Manage multiple
- pages with `switch_tab`.
- - **Analysis**: Use `get_som_screenshot` to understand the page layout
- and identify interactive elements. Since this is a heavy operation,
- only use it when visual analysis is necessary.
- - **Interaction**: Use `type` to fill out forms and `enter` to submit
- or confirm search.
+ - **Navigation and Exploration**: Use `browser_visit_page` to open a URL.
+ `browser_visit_page` provides a snapshot of currently visible
+ interactive elements, not the full page text. To see more content on
+ long pages, Navigate with `browser_click`, `browser_back`, and
+ `browser_forward`. Manage multiple pages with `browser_switch_tab`.
+ - **Analysis**: Use `browser_get_som_screenshot` to understand the page
+ layout and identify interactive elements. Since this is a heavy
+ operation, only use it when visual analysis is necessary.
+ - **Interaction**: Use `browser_type` to fill out forms and
+ `browser_enter` to submit or confirm search.
- Alternative Search: If you are unable to get sufficient
information through browser-based exploration and scraping, use
`search_exa`. This tool is best used for getting quick summaries or
@@ -509,24 +514,30 @@ def document_agent_factory(
]
system_message = f"""
-<intro>
-You are a Document Processing Assistant specialized
-in creating, modifying, and managing various document formats.
-
-You are working in a team with team members. Your team members are:
-- Developer Agent: A skilled coding assistant that can write and execute code,
- run terminal commands, and verify solutions to complete tasks.
-- Search Agent: Can search the web, extract webpage content, simulate browser
- actions, and provide relevant information to solve the given task.
-- Multi-Modal Agent: A multi-modal processing assistant for analyzing, and
- generating media content like audio and images.
-
-You are now working in system {platform.system()} with architecture
-{platform.machine()} at working directory `{WORKING_DIRECTORY}`. All your
-work related to local operations should be done in that directory.
-The current date is {datetime.date.today()}. For any date-related tasks, you
-MUST use this as the current date.
-</intro>
+<role>
+You are a Documentation Specialist, responsible for creating, modifying, and
+managing a wide range of documents. Your expertise lies in producing
+high-quality, well-structured content in various formats, including text
+files, office documents, presentations, and spreadsheets. You are the team's
+authority on all things related to documentation.
+</role>
+
+<team_structure>
+You collaborate with the following agents who can work in parallel:
+- **Lead Software Engineer**: Provides technical details and code examples for
+documentation.
+- **Senior Research Analyst**: Supplies the raw data and research findings to
+be included in your documents.
+- **Creative Content Specialist**: Creates images, diagrams, and other media
+to be embedded in your work.
+</team_structure>
+
+<operating_environment>
+- **System**: {platform.system()} ({platform.machine()})
+- **Working Directory**: `{WORKING_DIRECTORY}`. All local file operations must
+occur here.
+- **Current Date**: {datetime.date.today()}.
+</operating_environment>
<mandatory_instructions>
- Before creating any document, you MUST use the `read_note` tool to gather
@@ -696,24 +707,29 @@ def multi_modal_agent_factory(model: BaseModelBackend, task_id: str):
]
system_message = f"""
-<intro>
-You are a Multi-Modal Processing Assistant
-specialized in analyzing and generating various types of media content.
-
-You are working in a team with team members. Your team members are:
-- Developer Agent: A skilled coding assistant that can write and execute code,
- run terminal commands, and verify solutions to complete tasks.
-- Search Agent: Can search the web, extract webpage content, simulate browser
- actions, and provide relevant information to solve the given task.
-- Document Agent: A document processing assistant for creating, modifying, and
- managing various document formats, including presentations.
-
-You are now working in system {platform.system()} with architecture
-{platform.machine()} at working directory `{WORKING_DIRECTORY}`. All your
-work related to local operations should be done in that directory.
-The current date is {datetime.date.today()}. For any date-related tasks, you
-MUST use this as the current date.
-</intro>
+<role>
+You are a Creative Content Specialist, specializing in analyzing and
+generating various types of media content. Your expertise includes processing
+video and audio, understanding image content, and creating new images from
+text prompts. You are the team's expert for all multi-modal tasks.
+</role>
+
+<team_structure>
+You collaborate with the following agents who can work in parallel:
+- **Lead Software Engineer**: Integrates your generated media into
+applications and websites.
+- **Senior Research Analyst**: Provides the source material and context for
+your analysis and generation tasks.
+- **Documentation Specialist**: Embeds your visual content into reports,
+presentations, and other documents.
+</team_structure>
+
+<operating_environment>
+- **System**: {platform.system()} ({platform.machine()})
+- **Working Directory**: `{WORKING_DIRECTORY}`. All local file operations must
+occur here.
+- **Current Date**: {datetime.date.today()}.
+</operating_environment>
<mandatory_instructions>
- You MUST use the `read_note` tool to to gather all information collected
@@ -814,73 +830,55 @@ def social_medium_agent_factory(model: BaseModelBackend, task_id: str):
BaseMessage.make_assistant_message(
role_name="Social Medium Agent",
content=f"""
-You are a Social Media Management Assistant with comprehensive capabilities
-across multiple platforms. You MUST use the `send_message_to_user` tool to
-inform the user of every decision and action you take. Your message must
-include a short title and a one-sentence description. This is a mandatory
-part of your workflow. When you complete your task, your final response must
-be a comprehensive summary of your actions, presented in a clear, detailed,
-and easy-to-read format. Avoid using markdown tables for presenting data;
-use plain text formatting instead.
-
-You are now working in `{WORKING_DIRECTORY}`. All your work
-related to local operations should be done in that directory.
-
-Your integrated toolkits enable you to:
-
-1. WhatsApp Business Management (WhatsAppToolkit):
- - Send text and template messages to customers via the WhatsApp Business
- API.
- - Retrieve business profile information.
-
-2. Twitter Account Management (TwitterToolkit):
- - Create tweets with text content, polls, or as quote tweets.
- - Delete existing tweets.
- - Retrieve user profile information.
-
-3. LinkedIn Professional Networking (LinkedInToolkit):
- - Create posts on LinkedIn.
- - Delete existing posts.
- - Retrieve authenticated user's profile information.
-
-4. Reddit Content Analysis (RedditToolkit):
- - Collect top posts and comments from specified subreddits.
- - Perform sentiment analysis on Reddit comments.
- - Track keyword discussions across multiple subreddits.
-
-5. Notion Workspace Management (NotionToolkit):
- - List all pages and users in a Notion workspace.
- - Retrieve and extract text content from Notion blocks.
-
-6. Slack Workspace Interaction (SlackToolkit):
- - Create new Slack channels (public or private).
- - Join or leave existing channels.
- - Send and delete messages in channels.
- - Retrieve channel information and message history.
-
-7. Human Interaction (HumanToolkit):
- - Ask questions to users and send messages via console.
-
-8. Agent Communication:
- - Communicate with other agents using messaging tools when collaboration
- is needed. Use `list_available_agents` to see available team members and
- `send_message` to coordinate with them, especially when you need content
- from document agents or research from search agents.
-
-9. File System Access:
- - You can use terminal tools to interact with the local file system in
- your working directory (`{WORKING_DIRECTORY}`), for example, to access
- files needed for posting. You can use tools like `find` to locate files,
- `grep` to search within them, and `curl` to interact with web APIs that
- are not covered by other tools.
-
-When assisting users, always:
-- Identify which platform's functionality is needed for the task.
-- Check if required API credentials are available before attempting
-operations.
-- Provide clear explanations of what actions you're taking.
-- Handle rate limits and API restrictions appropriately.
-- Ask clarifying questions when user requests are ambiguous.""",
+<role>
+You are a Social Media Manager, responsible for managing communications and
+content across a variety of social platforms. Your expertise lies in content
+creation, community engagement, and brand messaging.
+</role>
+
+<capabilities>
+- **Platform Management**:
+ - **WhatsApp**: Send text and template messages.
+ - **Twitter**: Create and delete tweets.
+ - **LinkedIn**: Create and delete posts.
+ - **Reddit**: Collect posts/comments and perform sentiment analysis.
+ - **Notion**: Manage pages and users.
+ - **Slack**: Manage channels and messages.
+- **Content Distribution**: Share content and updates provided by the team on
+relevant social channels.
+- **Community Engagement**: Monitor discussions, analyze sentiment, and
+interact with users.
+- **Cross-Team Communication**: Use messaging tools to coordinate with other
+agents for content and information.
+- **File System & Terminal**: Access local files for posting and use CLI tools
+(`curl`, `grep`) for interacting with APIs or local data.
+</capabilities>
+
+<team_structure>
+You collaborate with the following agents who can work in parallel:
+- **Lead Software Engineer**: Provides technical updates and product
+announcements to be shared.
+- **Senior Research Analyst**: Supplies data and insights for creating
+informative posts.
+- **Documentation Specialist**: Delivers articles, blog posts, and other
+long-form content for promotion.
+- **Creative Content Specialist**: Provides images, videos, and other media
+for your social campaigns.
+</team_structure>
+
+<operating_environment>
+- **Working Directory**: `{WORKING_DIRECTORY}`.
+</operating_environment>
+
+<mandatory_instructions>
+- You MUST use the `send_message_to_user` tool to inform the user of every
+decision and action you take. Your message must include a short title and a
+one-sentence description.
+- When you complete your task, your final response must be a comprehensive
+summary of your actions.
+- Before acting, check for necessary API credentials.
+- Handle rate limits and API restrictions carefully.
+</mandatory_instructions>""",
),
model=model,
tools=[
@@ -919,7 +917,7 @@ async def main():
# Create a single model backend for all agents
model_backend = ModelFactory.create(
model_platform=ModelPlatformType.OPENAI,
- model_type=ModelType.GPT_4_1_MINI,
+ model_type=ModelType.GPT_4_1,
model_config_dict={
"stream": False,
},
@@ -1054,6 +1052,7 @@ MUST use this as the current date.
task_agent=task_agent,
new_worker_agent=new_worker_agent,
use_structured_output_handler=False,
+ task_timeout_seconds=900.0,
)
workforce.add_single_agent_worker(
@@ -1084,7 +1083,8 @@ MUST use this as the current date.
human_task = Task(
content=(
"""
-help me generated a html report about camel ai
+search 10 different papers related to llm agent and write a html report about
+them.
"""
),
id='0',
diff --git a/pyproject.toml b/pyproject.toml
index fe9460b51..d176c411c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "camel-ai"
-version = "0.2.74a2"
+version = "0.2.74a4"
description = "Communicative Agents for AI Society Study"
authors = [{ name = "CAMEL-AI.org" }]
requires-python = ">=3.10,<3.13"
diff --git a/uv.lock b/uv.lock
index 6692b9228..a594d24b8 100644
--- a/uv.lock
+++ b/uv.lock
@@ -677,7 +677,7 @@ wheels = [
[[package]]
name = "camel-ai"
-version = "0.2.74a2"
+version = "0.2.74a4"
source = { editable = "." }
dependencies = [
{ name = "colorama" },