🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org
Python agentai-societiesartificial-intelligencecommunicative-aicooperative-aideep-learninglarge-language-modelsmulti-agent-systemsnatural-language-processing
fix: Workforce previous task content not passed (#2862)
Wendong-Fan71ef110ad402
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 3385f48eb..8a50f469c 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.71a11+ placeholder: E.g., 0.2.71a12validations:required: truediff --git a/camel/__init__.py b/camel/__init__.pyindex 12bc67864..a5bc0170a 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.71a11'+__version__ = '0.2.71a12'__all__ = ['__version__',diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.pyindex 1d2696f14..37d5fbd05 100644--- a/camel/agents/chat_agent.py+++ b/camel/agents/chat_agent.py@@ -1236,7 +1236,7 @@ class ChatAgent(BaseAgent):if not message.parsed:logger.warning(f"Failed to parse JSON from response: "- f"{content[:100]}..."+ f"{content}")except Exception as e:diff --git a/camel/societies/workforce/prompts.py b/camel/societies/workforce/prompts.pyindex 87b855a81..cf299b260 100644--- a/camel/societies/workforce/prompts.py+++ b/camel/societies/workforce/prompts.py@@ -147,7 +147,7 @@ Here is the content of the parent task for you to refer to:Here are results of some prerequisite tasks that you can refer to:==============================-{dependency_task_info}+{dependency_tasks_info}==============================Here are some additional information about the task:diff --git a/camel/societies/workforce/role_playing_worker.py b/camel/societies/workforce/role_playing_worker.pyindex 832d54ed2..f1d52c0ca 100644--- a/camel/societies/workforce/role_playing_worker.py+++ b/camel/societies/workforce/role_playing_worker.py@@ -122,7 +122,7 @@ class RolePlayingWorker(Worker):prompt = ROLEPLAY_PROCESS_TASK_PROMPT.format(content=task.content,parent_task_content=task.parent.content if task.parent else "",- dependency_task_info=dependency_tasks_info,+ dependency_tasks_info=dependency_tasks_info,additional_info=task.additional_info,)role_play_session = RolePlaying(diff --git a/camel/societies/workforce/worker.py b/camel/societies/workforce/worker.pyindex 1fa6e2744..0d51c7b67 100644--- a/camel/societies/workforce/worker.py+++ b/camel/societies/workforce/worker.py@@ -89,7 +89,7 @@ class Worker(BaseNode, ABC):)# Process the task- task_state = await self._process_task(task, [])+ task_state = await self._process_task(task, task.dependencies)# Update the result and status of the tasktask.set_state(task_state)diff --git a/camel/societies/workforce/workforce.py b/camel/societies/workforce/workforce.pyindex 73e1d0ba1..e5c082b11 100644--- a/camel/societies/workforce/workforce.py+++ b/camel/societies/workforce/workforce.py@@ -1008,7 +1008,7 @@ class Workforce(BaseNode):if not validate_task_content(new_content, task_id):logger.warning(f"Task {task_id} content modification rejected: "- f"Invalid content. Content preview: '{new_content[:50]}...'"+ f"Invalid content. Content preview: '{new_content}'")return False@@ -1194,7 +1194,7 @@ class Workforce(BaseNode):task.result = "Task failed: Invalid or empty content provided"logger.warning(f"Task {task.id} rejected: Invalid or empty content. "- f"Content preview: '{task.content[:50]}...'"+ f"Content preview: '{task.content}'")return task@@ -1327,7 +1327,7 @@ class Workforce(BaseNode):task.result = "Task failed: Invalid or empty content provided"logger.warning(f"Task {task.id} rejected: Invalid or empty content. "- f"Content preview: '{task.content[:50]}...'"+ f"Content preview: '{task.content}'")return task@@ -1853,7 +1853,7 @@ class Workforce(BaseNode):logger.error(f"JSON parsing error in task assignment: Invalid response "f"format - {e}. Response content: "- f"{response.msg.content[:50]}..."+ f"{response.msg.content}")return TaskAssignResult(assignments=[])@@ -1985,6 +1985,37 @@ class Workforce(BaseNode):return final_assignments+ def _update_task_dependencies_from_assignments(+ self, assignments: List[TaskAssignment], tasks: List[Task]+ ) -> None:+ r"""Update Task.dependencies with actual Task objects based on+ assignments.++ Args:+ assignments (List[TaskAssignment]): The task assignments+ containing dependency IDs.+ tasks (List[Task]): The tasks that were assigned.+ """+ # Create a lookup map for all available tasks+ all_tasks = {}+ for task_list in [self._completed_tasks, self._pending_tasks, tasks]:+ for task in task_list:+ all_tasks[task.id] = task++ # Update dependencies for each assigned task+ for assignment in assignments:+ if not assignment.dependencies:+ continue++ matching_tasks = [t for t in tasks if t.id == assignment.task_id]+ if matching_tasks:+ task = matching_tasks[0]+ task.dependencies = [+ all_tasks[dep_id]+ for dep_id in assignment.dependencies+ if dep_id in all_tasks+ ]+async def _find_assignee(self,tasks: List[Task],@@ -2021,19 +2052,24 @@ class Workforce(BaseNode):# if all assignments are valid and all tasks are assigned, return earlyif not invalid_assignments and not unassigned_tasks:+ self._update_task_dependencies_from_assignments(+ valid_assignments, tasks+ )return TaskAssignResult(assignments=valid_assignments)- # handle retry and fallback for- # invalid assignments and unassigned tasks- all_problem_assignments = invalid_assignments+ # handle retry and fallback for invalid assignments and unassigned+ # tasksretry_and_fallback_assignments = (await self._handle_assignment_retry_and_fallback(- all_problem_assignments, tasks, valid_worker_ids+ invalid_assignments, tasks, valid_worker_ids))- valid_assignments.extend(retry_and_fallback_assignments)+ all_assignments = valid_assignments + retry_and_fallback_assignments++ # Update Task.dependencies for all final assignments+ self._update_task_dependencies_from_assignments(all_assignments, tasks)- return TaskAssignResult(assignments=valid_assignments)+ return TaskAssignResult(assignments=all_assignments)async def _post_task(self, task: Task, assignee_id: str) -> None:# Record the start time when a task is posted@@ -2107,7 +2143,7 @@ class Workforce(BaseNode):)new_node_conf = WorkerConf(description=f"Fallback worker for task: "- f"{task.content[:50]}...",+ f"{task.content}",role="General Assistant",sys_msg="You are a general assistant that can help ""with various tasks.",@@ -2117,8 +2153,7 @@ class Workforce(BaseNode):response.msg.content,schema=WorkerConf,fallback_values={- "description": f"Worker for task: "- f"{task.content[:50]}...",+ "description": f"Worker for task: " f"{task.content}","role": "Task Specialist","sys_msg": f"You are a specialist for: {task.content}",},@@ -2130,7 +2165,7 @@ class Workforce(BaseNode):new_node_conf = WorkerConf(**result)else:new_node_conf = WorkerConf(- description=f"Worker for task: {task.content[:50]}...",+ description=f"Worker for task: {task.content}",role="Task Specialist",sys_msg=f"You are a specialist for: {task.content}",)@@ -2147,7 +2182,7 @@ class Workforce(BaseNode):# Create a fallback worker configurationnew_node_conf = WorkerConf(description=f"Fallback worker for "- f"task: {task.content[:50]}...",+ f"task: {task.content}",role="General Assistant",sys_msg="You are a general assistant that can help ""with various tasks.",@@ -2160,7 +2195,7 @@ class Workforce(BaseNode):logger.error(f"JSON parsing error in worker creation: Invalid "f"response format - {e}. Response content: "- f"{response.msg.content[:100]}..."+ f"{response.msg.content}")raise RuntimeError(f"Failed to create worker for task {task.id}: "@@ -2364,7 +2399,7 @@ class Workforce(BaseNode):f"Task {task.id} has exceeded maximum retry attempts "f"({MAX_TASK_RETRIES}). Final failure "f"reason: {detailed_error}. "- f"Task content: '{task.content[:100]}...'"+ f"Task content: '{task.content}'")self._cleanup_task_tracking(task.id)# Mark task as completed for dependency tracking before halting@@ -2793,7 +2828,7 @@ class Workforce(BaseNode):# useful resultsif is_task_result_insufficient(returned_task):result_preview = (- returned_task.result[:100] + "..."+ returned_task.resultif returned_task.resultelse "No result")diff --git a/camel/tasks/task.py b/camel/tasks/task.pyindex af89d5b67..6ca71b1a6 100644--- a/camel/tasks/task.py+++ b/camel/tasks/task.py@@ -99,7 +99,7 @@ def validate_task_content(logger.warning(f"Task {task_id}: Content too short ({len(stripped_content)} "f"chars < {min_length} minimum). Content preview: "- f"'{stripped_content[:50]}...'"+ f"'{stripped_content}'")return False@@ -124,7 +124,7 @@ def validate_task_content(if any(indicator in content_lower for indicator in failure_indicators):logger.warning(f"Task {task_id}: Failure indicator detected in result. "- f"Content preview: '{stripped_content[:100]}...'"+ f"Content preview: '{stripped_content}'")return False@@ -132,7 +132,7 @@ def validate_task_content(if content_lower.startswith(("error", "failed", "cannot", "unable")):logger.warning(f"Task {task_id}: Error/refusal pattern detected at start. "- f"Content preview: '{stripped_content[:100]}...'"+ f"Content preview: '{stripped_content}'")return False@@ -195,7 +195,7 @@ def parse_response(logger.warning(f"Skipping invalid subtask {task_id}.{i} "f"during decomposition: "- f"Content '{stripped_content[:50]}...' failed validation"+ f"Content '{stripped_content}' failed validation")return tasks@@ -233,6 +233,8 @@ class Task(BaseModel):(default: :obj:`0`)assigned_worker_id (Optional[str]): The ID of the worker assigned tothis task. (default: :obj:`None`)+ dependencies (List[Task]): The dependencies for the task.+ (default: :obj:`[]`)additional_info (Optional[Dict[str, Any]]): Additional information forthe task. (default: :obj:`None`)image_list (Optional[List[Image.Image]]): Optional list of PIL Image@@ -265,6 +267,8 @@ class Task(BaseModel):assigned_worker_id: Optional[str] = None+ dependencies: List["Task"] = []+additional_info: Optional[Dict[str, Any]] = Noneimage_list: Optional[List[Image.Image]] = None@@ -530,7 +534,7 @@ class Task(BaseModel):logger.warning(f"Skipping invalid subtask {task_id}.{i} "f"during streaming decomposition: "- f"Content '{stripped_content[:50]}...' failed validation"+ f"Content '{stripped_content}' failed validation")return tasksdiff --git a/camel/toolkits/search_toolkit.py b/camel/toolkits/search_toolkit.pyindex af1f71c5f..96e259cb7 100644--- a/camel/toolkits/search_toolkit.py+++ b/camel/toolkits/search_toolkit.py@@ -32,6 +32,23 @@ class SearchToolkit(BaseToolkit):search engines like Google, DuckDuckGo, Wikipedia and Wolfram Alpha, Brave."""+ def __init__(+ self,+ timeout: Optional[float] = None,+ number_of_result_pages: int = 10,+ ):+ r"""Initializes the RedditToolkit with the specified number of retries+ and delay.++ Args:+ timeout (float): Timeout for API requests in seconds.+ (default: :obj:`None`)+ number_of_result_pages (int): The number of result pages to+ retrieve. (default: :obj:`10`)+ """+ super().__init__(timeout=timeout)+ self.number_of_result_pages = number_of_result_pages+@dependencies_required("wikipedia")def search_wiki(self, entity: str) -> str:r"""Search the entity in WikiPedia and return the summary of the@@ -144,7 +161,7 @@ class SearchToolkit(BaseToolkit):@dependencies_required("duckduckgo_search")def search_duckduckgo(- self, query: str, source: str = "text", max_results: int = 5+ self, query: str, source: str = "text") -> List[Dict[str, Any]]:r"""Use DuckDuckGo search engine to search information forthe given query.@@ -157,7 +174,6 @@ class SearchToolkit(BaseToolkit):query (str): The query to be searched.source (str): The type of information to query (e.g., "text","images", "videos"). Defaults to "text".- max_results (int): Max number of results, defaults to `5`.Returns:List[Dict[str, Any]]: A list of dictionaries where each dictionary@@ -171,7 +187,9 @@ class SearchToolkit(BaseToolkit):if source == "text":try:- results = ddgs.text(keywords=query, max_results=max_results)+ results = ddgs.text(+ keywords=query, max_results=self.number_of_result_pages+ )except RequestException as e:# Handle specific exceptions or general request exceptionsresponses.append({"error": f"duckduckgo search failed.{e}"})@@ -189,7 +207,9 @@ class SearchToolkit(BaseToolkit):elif source == "images":try:- results = ddgs.images(keywords=query, max_results=max_results)+ results = ddgs.images(+ keywords=query, max_results=self.number_of_result_pages+ )except RequestException as e:# Handle specific exceptions or general request exceptionsresponses.append({"error": f"duckduckgo search failed.{e}"})@@ -208,7 +228,9 @@ class SearchToolkit(BaseToolkit):elif source == "videos":try:- results = ddgs.videos(keywords=query, max_results=max_results)+ results = ddgs.videos(+ keywords=query, max_results=self.number_of_result_pages+ )except RequestException as e:# Handle specific exceptions or general request exceptionsresponses.append({"error": f"duckduckgo search failed.{e}"})@@ -241,7 +263,6 @@ class SearchToolkit(BaseToolkit):country: str = "US",search_lang: str = "en",ui_lang: str = "en-US",- count: int = 20,offset: int = 0,safesearch: str = "moderate",freshness: Optional[str] = None,@@ -277,10 +298,6 @@ class SearchToolkit(BaseToolkit):Format: '<language_code>-<country_code>'. Common examples:'en-US', 'en-GB', 'jp-JP', 'zh-hans-CN', 'zh-hant-TW','de-DE', 'fr-FR', 'es-ES', 'pt-BR', 'ru-RU', 'ko-KR'.- count (int): The number of search results returned in response.- The maximum is 20. The actual number delivered may be less than- requested. Combine this parameter with offset to paginate- search results.offset (int): The zero based offset that indicates number of searchresults per page (count) to skip before returning the result.The maximum is 9. The actual number delivered may be less than@@ -368,7 +385,7 @@ class SearchToolkit(BaseToolkit):"country": country,"search_lang": search_lang,"ui_lang": ui_lang,- "count": count,+ "count": self.number_of_result_pages,"offset": offset,"safesearch": safesearch,"freshness": freshness,@@ -417,14 +434,11 @@ class SearchToolkit(BaseToolkit):(None, 'SEARCH_ENGINE_ID'),])- def search_google(- self, query: str, num_result_pages: int = 5- ) -> List[Dict[str, Any]]:+ def search_google(self, query: str) -> List[Dict[str, Any]]:r"""Use Google search engine to search information for the given query.Args:query (str): The query to be searched.- num_result_pages (int): The number of result pages to retrieve.Returns:List[Dict[str, Any]]: A list of dictionaries where each dictionary@@ -461,14 +475,12 @@ class SearchToolkit(BaseToolkit):start_page_idx = 1# Different language may get different resultsearch_language = "en"- # How many pages to return- num_result_pages = num_result_pages# Constructing the URL# Doc: https://developers.google.com/custom-search/v1/using_resturl = (f"https://www.googleapis.com/customsearch/v1?"f"key={GOOGLE_API_KEY}&cx={SEARCH_ENGINE_ID}&q={query}&start="- f"{start_page_idx}&lr={search_language}&num={num_result_pages}"+ f"{start_page_idx}&lr={search_language}&num={self.number_of_result_pages}")responses = []@@ -529,15 +541,11 @@ class SearchToolkit(BaseToolkit):responses.append({"error": f"google search failed: {e!s}"})return responses- def tavily_search(- self, query: str, num_results: int = 5, **kwargs- ) -> List[Dict[str, Any]]:+ def tavily_search(self, query: str, **kwargs) -> List[Dict[str, Any]]:r"""Use Tavily Search API to search information for the given query.Args:query (str): The query to be searched.- num_results (int): The number of search results to retrieve- (default is `5`).**kwargs: Additional optional parameters supported by Tavily's API:- search_depth (str): "basic" or "advanced" search depth.- topic (str): The search category, e.g., "general" or "news."@@ -573,7 +581,9 @@ class SearchToolkit(BaseToolkit):client = TavilyClient(Tavily_API_KEY)try:- results = client.search(query, max_results=num_results, **kwargs)+ results = client.search(+ query, max_results=self.number_of_result_pages, **kwargs+ )return resultsexcept Exception as e:return [{"error": f"An unexpected error occurred: {e!s}"}]@@ -584,7 +594,6 @@ class SearchToolkit(BaseToolkit):query: str,freshness: str = "noLimit",summary: bool = False,- count: int = 10,page: int = 1,) -> Dict[str, Any]:r"""Query the Bocha AI search API and return search results.@@ -600,7 +609,6 @@ class SearchToolkit(BaseToolkit):- 'oneYear': past year.summary (bool): Whether to include text summaries in results.Default is False.- count (int): Number of results to return (1-50). Default is 10.page (int): Page number of results. Default is 1.Returns:@@ -623,7 +631,7 @@ class SearchToolkit(BaseToolkit):"query": query,"freshness": freshness,"summary": summary,- "count": count,+ "count": self.number_of_result_pages,"page": page,},ensure_ascii=False,@@ -641,15 +649,13 @@ class SearchToolkit(BaseToolkit):except requests.exceptions.RequestException as e:return {"error": f"Bocha AI search failed: {e!s}"}- def search_baidu(self, query: str, max_results: int = 5) -> Dict[str, Any]:+ def search_baidu(self, query: str) -> Dict[str, Any]:r"""Search Baidu using web scraping to retrieve relevant searchresults. This method queries Baidu's search engine and extracts searchresults including titles, descriptions, and URLs.Args:query (str): Search query string to submit to Baidu.- max_results (int): Maximum number of results to return.- (default: :obj:`5`)Returns:Dict[str, Any]: A dictionary containing search results or error@@ -667,7 +673,7 @@ class SearchToolkit(BaseToolkit):),"Referer": "https://www.baidu.com",}- params = {"wd": query, "rn": str(max_results)}+ params = {"wd": query, "rn": str(self.number_of_result_pages)}response = requests.get(url, headers=headers, params=params)response.encoding = "utf-8"@@ -696,7 +702,7 @@ class SearchToolkit(BaseToolkit):"url": link,})- if len(results) >= max_results:+ if len(results) >= self.number_of_result_pages:breakif not results:@@ -710,7 +716,7 @@ class SearchToolkit(BaseToolkit):except Exception as e:return {"error": f"Baidu scraping error: {e!s}"}- def search_bing(self, query: str, max_results: int = 5) -> Dict[str, Any]:+ def search_bing(self, query: str) -> Dict[str, Any]:r"""Use Bing search engine to search information for the given query.This function queries the Chinese version of Bing search engine (cn.@@ -722,8 +728,6 @@ class SearchToolkit(BaseToolkit):Args:query (str): The search query string to submit to Bing. Works bestwith Chinese queries or when Chinese results are preferred.- max_results (int): Maximum number of results to return.- (default: :obj:`5`)Returns:Dict ([str, Any]): A dictionary containing either:@@ -773,7 +777,9 @@ class SearchToolkit(BaseToolkit):result_items = b_results_tag.find_all("li")results: List[Dict[str, Any]] = []- for i in range(min(len(result_items), max_results)):+ for i in range(+ min(len(result_items), self.number_of_result_pages)+ ):row = result_items[i]if not isinstance(row, Tag):continue@@ -838,7 +844,6 @@ class SearchToolkit(BaseToolkit):"financial report",]] = None,- num_results: int = 10,include_text: Optional[List[str]] = None,exclude_text: Optional[List[str]] = None,use_autoprompt: bool = True,@@ -854,8 +859,6 @@ class SearchToolkit(BaseToolkit):and neural search. (default: :obj:`"auto"`)category (Optional[Literal]): Category to focus the search on, suchas "research paper" or "news". (default: :obj:`None`)- num_results (int): Number of results to return (max 100).- (default: :obj:`10`)include_text (Optional[List[str]]): Strings that must be present inwebpage text. Limited to 1 string of up to 5 words.(default: :obj:`None`)@@ -884,7 +887,10 @@ class SearchToolkit(BaseToolkit):try:exa = Exa(EXA_API_KEY)- if num_results is not None and not 0 < num_results <= 100:+ if (+ self.number_of_result_pages is not None+ and not 0 < self.number_of_result_pages <= 100+ ):raise ValueError("num_results must be between 1 and 100")if include_text is not None:@@ -911,7 +917,7 @@ class SearchToolkit(BaseToolkit):query=query,type=search_type,category=category,- num_results=num_results,+ num_results=self.number_of_result_pages,include_text=include_text,exclude_text=exclude_text,use_autoprompt=use_autoprompt,@@ -925,7 +931,7 @@ class SearchToolkit(BaseToolkit):query=query,type=search_type,category=category,- num_results=num_results,+ num_results=self.number_of_result_pages,include_text=include_text,exclude_text=exclude_text,use_autoprompt=use_autoprompt,@@ -955,7 +961,6 @@ class SearchToolkit(BaseToolkit):"news_center",]] = None,- page: int = 1,return_main_text: bool = False,return_markdown_text: bool = True,enable_rerank: bool = True,@@ -980,8 +985,6 @@ class SearchToolkit(BaseToolkit):results from sites in the specified industries. Multipleindustries can be comma-separated.(default: :obj:`None`)- page (int): Page number for results pagination.- (default: :obj:`1`)return_main_text (bool): Whether to include the main text of thewebpage in results. (default: :obj:`True`)return_markdown_text (bool): Whether to include markdown formatted@@ -1014,7 +1017,7 @@ class SearchToolkit(BaseToolkit):params: Dict[str, Union[str, int]] = {"query": query,"timeRange": time_range,- "page": page,+ "page": self.number_of_result_pages,"returnMainText": str(return_main_text).lower(),"returnMarkdownText": str(return_markdown_text).lower(),"enableRerank": str(enable_rerank).lower(),diff --git a/camel/utils/tool_result.py b/camel/utils/tool_result.pyindex 48e87269d..0a94a09ca 100644--- a/camel/utils/tool_result.py+++ b/camel/utils/tool_result.py@@ -41,4 +41,4 @@ class ToolResult:def __repr__(self) -> str:r"""Return a detailed representation of the result."""img_count = len(self.images) if self.images else 0- return f"ToolResult(text='{self.text[:50]}...', images={img_count})"+ return f"ToolResult(text='{self.text}', images={img_count})"diff --git a/docs/conf.py b/docs/conf.pyindex 175213be7..e52da3d35 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.71a11'+release = '0.2.71a12'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/examples/workforce/eigent.py b/examples/workforce/eigent.pyindex 0de75bc67..08b213737 100644--- a/examples/workforce/eigent.py+++ b/examples/workforce/eigent.py@@ -91,7 +91,7 @@ def developer_agent_factory(*TerminalToolkit(clone_current_env=True).get_tools(),]- system_message = """You are a skilled coding assistant. You can write and+ system_message = f"""You are a skilled coding assistant. You can write andexecute code by using the available terminal tools. You MUST use the`send_message_to_user` tool to inform the user of every decision andaction you take. Your message must include a short title and a@@ -186,10 +186,14 @@ def search_agent_factory(SearchToolkit().search_bing,]- system_message = """You are a helpful assistant that can search the web,+ system_message = f"""You are a helpful assistant that can search the web,extract webpage content, simulate browser actions, and provide relevantinformation to solve the given task.+ **CRITICAL**: You MUST NOT answer from your own knowledge. All information+ MUST be sourced from the web using the available tools. If you don't know+ something, find it out using your tools.+You are now working in `{WORKING_DIRECTORY}`. All your workrelated to local operations should be done in that directory.@@ -276,10 +280,10 @@ def document_agent_factory(*TerminalToolkit().get_tools(),]- system_message = """You are a Document Processing Assistant specialized in- creating, modifying, and managing various document formats. 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+ system_message = f"""You are a Document Processing Assistant specialized+ in creating, modifying, and managing various document formats. 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 aone-sentence description. This is a mandatory part of your workflow.You are now working in `{WORKING_DIRECTORY}`. All your work@@ -375,11 +379,11 @@ def multi_modal_agent_factory(model: BaseModelBackend, task_id: str):*TerminalToolkit().get_tools(),]- system_message = """You are a Multi-Modal Processing Assistant specialized- in analyzing and generating various types of media content. 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.+ system_message = f"""You are a Multi-Modal Processing Assistant+ specialized in analyzing and generating various types of media content.+ 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.You are now working in `{WORKING_DIRECTORY}`. All your workrelated to local operations should be done in that directory.@@ -440,7 +444,7 @@ def social_medium_agent_factory(model: BaseModelBackend, task_id: str):return ChatAgent(BaseMessage.make_assistant_message(role_name="Social Medium Agent",- content="""+ content=f"""You are a Social Media Management Assistant with comprehensive capabilitiesacross multiple platforms. You MUST use the `send_message_to_user` tool toinform the user of every decision and action you take. Your message must@@ -670,9 +674,13 @@ async def main():human_task = Task(content=("""- go to amazon and find a popular product,- check the comments and reviews,- and then write a report about the product.+Identify the pharmaceutical company that had the most FDA-approved new+molecular entities (NMEs) between 2020 and 2024, where at least one of these+drugs achieved blockbuster status (over $1 billion in annual sales) within 24+months of approval. List the company name, total number of NMEs approved, the+name and indication of the fastest blockbuster drug, its peak annual sales+figure, and the name and specialization of the lead scientist credited with+its discovery."""),id='0',diff --git a/pyproject.toml b/pyproject.tomlindex 521812c3c..415c9fc20 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "camel-ai"-version = "0.2.71a11"+version = "0.2.71a12"description = "Communicative Agents for AI Society Study"authors = [{ name = "CAMEL-AI.org" }]requires-python = ">=3.10,<3.13"diff --git a/test/toolkits/test_search_functions.py b/test/toolkits/test_search_functions.pyindex ea32d1666..1be2e2e90 100644--- a/test/toolkits/test_search_functions.py+++ b/test/toolkits/test_search_functions.py@@ -112,9 +112,7 @@ def test_search_duckduckgo_text():]# Call the function with the mocked DDGS- result = search_duckduckgo(- query="test query", source="text", max_results=2- )+ result = search_duckduckgo(query="test query", source="text")# Check if the result is as expectedassert result == [@@ -133,7 +131,7 @@ def test_search_duckduckgo_text():]mock_ddgs_instance.text.assert_called_once_with(- keywords="test query", max_results=2+ keywords="test query", max_results=10)@@ -157,9 +155,7 @@ def test_search_duckduckgo_images():]# Call the function with the mocked DDGS for images- result = search_duckduckgo(- query="test query", source="images", max_results=2- )+ result = search_duckduckgo(query="test query", source="images")# Check if the result matches the expected outputassert result == [@@ -180,7 +176,7 @@ def test_search_duckduckgo_images():]mock_ddgs_instance.images.assert_called_once_with(- keywords="test query", max_results=2+ keywords="test query", max_results=10)@@ -212,7 +208,7 @@ def test_search_baidu(mock_get, search_toolkit):mock_get.return_value = mock_response# Call the function under test- result = search_toolkit.search_baidu(query="test query", max_results=5)+ result = search_toolkit.search_baidu(query="test query")# Expected outputexpected_output = {@@ -244,7 +240,7 @@ def test_search_baidu(mock_get, search_toolkit):),"Referer": "https://www.baidu.com",},- params={"wd": "test query", "rn": "5"},+ params={"wd": "test query", "rn": "10"},)@@ -274,7 +270,7 @@ def test_search_bing(mock_get, search_toolkit):mock_get.return_value = mock_response# Call the function under test- result = search_toolkit.search_bing(query="test query", max_results=5)+ result = search_toolkit.search_bing(query="test query")# Expected outputexpected_output = {@@ -482,7 +478,7 @@ def test_search_alibaba_tongxiao(mock_get, search_toolkit):params={"query": "test query","timeRange": "NoLimit",- "page": 1,+ "page": 10,"returnMainText": "false","returnMarkdownText": "true","enableRerank": "true",diff --git a/uv.lock b/uv.lockindex 706e67fd9..ad21517bc 100644--- a/uv.lock+++ b/uv.lock@@ -647,7 +647,7 @@ wheels = [[[package]]name = "camel-ai"-version = "0.2.71a11"+version = "0.2.71a12"source = { editable = "." }dependencies = [{ name = "colorama" },@@ -2342,16 +2342,16 @@ wheels = [[[package]]name = "fastapi"-version = "0.116.0"+version = "0.116.1"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "pydantic" },{ name = "starlette" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/20/38/e1da78736143fd885c36213a3ccc493c384ae8fea6a0f0bc272ef42ebea8/fastapi-0.116.0.tar.gz", hash = "sha256:80dc0794627af0390353a6d1171618276616310d37d24faba6648398e57d687a", size = 296518, upload-time = "2025-07-07T15:09:27.82Z" }+sdist = { url = "https://files.pythonhosted.org/packages/78/d7/6c8b3bfe33eeffa208183ec037fee0cce9f7f024089ab1c5d12ef04bd27c/fastapi-0.116.1.tar.gz", hash = "sha256:ed52cbf946abfd70c5a0dccb24673f0670deeb517a88b3544d03c2a6bf283143", size = 296485, upload-time = "2025-07-11T16:22:32.057Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/2f/68/d80347fe2360445b5f58cf290e588a4729746e7501080947e6cdae114b1f/fastapi-0.116.0-py3-none-any.whl", hash = "sha256:fdcc9ed272eaef038952923bef2b735c02372402d1203ee1210af4eea7a78d2b", size = 95625, upload-time = "2025-07-07T15:09:26.348Z" },+ { url = "https://files.pythonhosted.org/packages/e5/47/d63c60f59a59467fda0f93f46335c9d18526d7071f025cb5b89d5353ea42/fastapi-0.116.1-py3-none-any.whl", hash = "sha256:c46ac7c312df840f0c9e220f7964bada936781bc4e2e6eb71f1c4d7553786565", size = 95631, upload-time = "2025-07-11T16:22:30.485Z" },][[package]]@@ -3162,7 +3162,7 @@ wheels = [[[package]]name = "huggingface-hub"-version = "0.33.2"+version = "0.33.4"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "filelock" },@@ -3174,9 +3174,9 @@ dependencies = [{ name = "tqdm" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/fa/42/8a95c5632080ae312c0498744b2b852195e10b05a20b1be11c5141092f4c/huggingface_hub-0.33.2.tar.gz", hash = "sha256:84221defaec8fa09c090390cd68c78b88e3c4c2b7befba68d3dc5aacbc3c2c5f", size = 426637, upload-time = "2025-07-02T06:26:05.156Z" }+sdist = { url = "https://files.pythonhosted.org/packages/4b/9e/9366b7349fc125dd68b9d384a0fea84d67b7497753fe92c71b67e13f47c4/huggingface_hub-0.33.4.tar.gz", hash = "sha256:6af13478deae120e765bfd92adad0ae1aec1ad8c439b46f23058ad5956cbca0a", size = 426674, upload-time = "2025-07-11T12:32:48.694Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/44/f4/5f3f22e762ad1965f01122b42dae5bf0e009286e2dba601ce1d0dba72424/huggingface_hub-0.33.2-py3-none-any.whl", hash = "sha256:3749498bfa91e8cde2ddc2c1db92c79981f40e66434c20133b39e5928ac9bcc5", size = 515373, upload-time = "2025-07-02T06:26:03.072Z" },+ { url = "https://files.pythonhosted.org/packages/46/7b/98daa50a2db034cab6cd23a3de04fa2358cb691593d28e9130203eb7a805/huggingface_hub-0.33.4-py3-none-any.whl", hash = "sha256:09f9f4e7ca62547c70f8b82767eefadd2667f4e116acba2e3e62a5a81815a7bb", size = 515339, upload-time = "2025-07-11T12:32:46.346Z" },][[package]]@@ -4715,7 +4715,7 @@ wheels = [[[package]]name = "openai"-version = "1.95.0"+version = "1.95.1"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "anyio" },@@ -4727,9 +4727,9 @@ dependencies = [{ name = "tqdm" },{ name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/ef/2f/0c6f509a1585545962bfa6e201d7fb658eb2a6f52fb8c26765632d91706c/openai-1.95.0.tar.gz", hash = "sha256:54bc42df9f7142312647dd485d34cca5df20af825fa64a30ca55164be2cf4cc9", size = 488144, upload-time = "2025-07-10T18:35:49.946Z" }+sdist = { url = "https://files.pythonhosted.org/packages/a1/a3/70cd57c7d71086c532ce90de5fdef4165dc6ae9dbf346da6737ff9ebafaa/openai-1.95.1.tar.gz", hash = "sha256:f089b605282e2a2b6776090b4b46563ac1da77f56402a222597d591e2dcc1086", size = 488271, upload-time = "2025-07-11T20:47:24.437Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/19/a5/57d0bb58b938a3e3f352ff26e645da1660436402a6ad1b29780d261cc5a5/openai-1.95.0-py3-none-any.whl", hash = "sha256:a7afc9dca7e7d616371842af8ea6dbfbcb739a85d183f5f664ab1cc311b9ef18", size = 755572, upload-time = "2025-07-10T18:35:47.507Z" },+ { url = "https://files.pythonhosted.org/packages/02/1d/0432ea635097f4dbb34641a3650803d8a4aa29d06bafc66583bf1adcceb4/openai-1.95.1-py3-none-any.whl", hash = "sha256:8bbdfeceef231b1ddfabbc232b179d79f8b849aab5a7da131178f8d10e0f162f", size = 755613, upload-time = "2025-07-11T20:47:22.629Z" },][[package]]@@ -7085,7 +7085,7 @@ wheels = [[[package]]name = "scrapegraph-py"-version = "1.14.1"+version = "1.14.2"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "aiohttp" },@@ -7094,9 +7094,9 @@ dependencies = [{ name = "python-dotenv" },{ name = "requests" },]-sdist = { url = "https://files.pythonhosted.org/packages/44/69/c4b971bfe32a48fcc2dd9363fdc07c87481fb7d4147c5d6ded1b915baaf0/scrapegraph_py-1.14.1.tar.gz", hash = "sha256:0b8b5b2877648fbdde27387dece06401375cf3c2c88552ad170efd39bf9355dc", size = 148957, upload-time = "2025-07-08T14:48:00.98Z" }+sdist = { url = "https://files.pythonhosted.org/packages/63/32/fbb88336cdd84a85fc397424cac46df35a89508f205a12c36e0d10ed6f34/scrapegraph_py-1.14.2.tar.gz", hash = "sha256:68b6369896d878881a033f33976e19339a45aef241e3ba798512e255bf605c44", size = 150256, upload-time = "2025-07-12T17:38:55.641Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/9d/93/6f0713d285c0bb61f03fbb27b226846aa469ff4ff32528fcb983846b254a/scrapegraph_py-1.14.1-py3-none-any.whl", hash = "sha256:04d4799a756c840d89ed8ca4e627b2c9d7c1b07a90d1b9120361eb74a96c0abf", size = 18059, upload-time = "2025-07-08T14:48:00.042Z" },+ { url = "https://files.pythonhosted.org/packages/84/5c/9039320c08cb902b2534f1f648faafc2281082e1a653442ce4020618d7c7/scrapegraph_py-1.14.2-py3-none-any.whl", hash = "sha256:ecf10ac0dab715786cef817e32e4872960f251689dddf2f970463a1fac668739", size = 18474, upload-time = "2025-07-12T17:38:54.421Z" },][[package]]@@ -7520,14 +7520,15 @@ wheels = [[[package]]name = "starlette"-version = "0.46.2"+version = "0.47.1"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "anyio" },+ { name = "typing-extensions" },]-sdist = { url = "https://files.pythonhosted.org/packages/ce/20/08dfcd9c983f6a6f4a1000d934b9e6d626cff8d2eeb77a89a68eef20a2b7/starlette-0.46.2.tar.gz", hash = "sha256:7f7361f34eed179294600af672f565727419830b54b7b084efe44bb82d2fccd5", size = 2580846, upload-time = "2025-04-13T13:56:17.942Z" }+sdist = { url = "https://files.pythonhosted.org/packages/0a/69/662169fdb92fb96ec3eaee218cf540a629d629c86d7993d9651226a6789b/starlette-0.47.1.tar.gz", hash = "sha256:aef012dd2b6be325ffa16698f9dc533614fb1cebd593a906b90dc1025529a79b", size = 2583072, upload-time = "2025-06-21T04:03:17.337Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/8b/0c/9d30a4ebeb6db2b25a841afbb80f6ef9a854fc3b41be131d249a977b4959/starlette-0.46.2-py3-none-any.whl", hash = "sha256:595633ce89f8ffa71a015caed34a5b2dc1c0cdb3f0f1fbd1e69339cf2abeec35", size = 72037, upload-time = "2025-04-13T13:56:16.21Z" },+ { url = "https://files.pythonhosted.org/packages/82/95/38ef0cd7fa11eaba6a99b3c4f5ac948d8bc6ff199aabd327a29cc000840c/starlette-0.47.1-py3-none-any.whl", hash = "sha256:5e11c9f5c7c3f24959edbf2dffdc01bba860228acf657129467d8a7468591527", size = 72747, upload-time = "2025-06-21T04:03:15.705Z" },][[package]]@@ -7847,7 +7848,7 @@ wheels = [[[package]]name = "transformers"-version = "4.53.1"+version = "4.53.2"source = { registry = "https://pypi.org/simple" }dependencies = [{ name = "filelock" },@@ -7861,9 +7862,9 @@ dependencies = [{ name = "tokenizers" },{ name = "tqdm" },]-sdist = { url = "https://files.pythonhosted.org/packages/9f/2c/68a0024c311db41bb92d4ec17d22e90b7406a4d28aa18d87662f2bbebcd9/transformers-4.53.1.tar.gz", hash = "sha256:da5a9f66ad480bc2a7f75bc32eaf735fd20ac56af4325ca4ce994021ceb37710", size = 9192189, upload-time = "2025-07-04T08:28:40.571Z" }+sdist = { url = "https://files.pythonhosted.org/packages/4c/67/80f51466ec447028fd84469b208eb742533ce06cc8fad2e3181380199e5c/transformers-4.53.2.tar.gz", hash = "sha256:6c3ed95edfb1cba71c4245758f1b4878c93bf8cde77d076307dacb2cbbd72be2", size = 9201233, upload-time = "2025-07-11T12:39:08.742Z" }wheels = [- { url = "https://files.pythonhosted.org/packages/8d/10/8cef2288810a3210659eb3a20711e8387cc35a881a7762ae387806e2d651/transformers-4.53.1-py3-none-any.whl", hash = "sha256:c84f3c3e41c71fdf2c60c8a893e1cd31191b0cb463385f4c276302d2052d837b", size = 10825681, upload-time = "2025-07-04T08:28:37.318Z" },+ { url = "https://files.pythonhosted.org/packages/96/88/beb33a79a382fcd2aed0be5222bdc47f41e4bfe7aaa90ae1374f1d8ea2af/transformers-4.53.2-py3-none-any.whl", hash = "sha256:db8f4819bb34f000029c73c3c557e7d06fc1b8e612ec142eecdae3947a9c78bf", size = 10826609, upload-time = "2025-07-11T12:39:05.461Z" },][[package]]