🐫 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
Aysnc fix (#3472)
Wendong-Fand8734949b705
diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.ymlindex 3149779d2..6b7e9f465 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.80+ placeholder: E.g., 0.2.81a0validations:required: truediff --git a/camel/__init__.py b/camel/__init__.pyindex c9a2cf8b0..187f61767 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.80'+__version__ = '0.2.81a0'__all__ = ['__version__',diff --git a/camel/agents/chat_agent.py b/camel/agents/chat_agent.pyindex ad54a9f47..f101679cf 100644--- a/camel/agents/chat_agent.py+++ b/camel/agents/chat_agent.py@@ -17,6 +17,7 @@ import asyncioimport atexitimport base64import concurrent.futures+import functoolsimport hashlibimport inspectimport json@@ -3914,8 +3915,11 @@ class ChatAgent(BaseAgent):else:# Fallback: synchronous call+ # Use functools.partial to properly capture argsloop = asyncio.get_running_loop()- result = await loop.run_in_executor(None, lambda: tool(**args))+ result = await loop.run_in_executor(+ None, functools.partial(tool, **args)+ )except Exception as e:# Capture the error message to prevent framework crash@@ -4742,9 +4746,10 @@ class ChatAgent(BaseAgent):else:# Fallback: synchronous call+ # Use functools.partial to properly capture argsloop = asyncio.get_running_loop()result = await loop.run_in_executor(- None, lambda: tool(**args)+ None, functools.partial(tool, **args))# Create the tool response messagediff --git a/camel/toolkits/function_tool.py b/camel/toolkits/function_tool.pyindex b6a3571d7..c79b9170c 100644--- a/camel/toolkits/function_tool.py+++ b/camel/toolkits/function_tool.py@@ -13,6 +13,7 @@# ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========import astimport asyncio+import functoolsimport inspectimport loggingimport textwrap@@ -506,9 +507,11 @@ class FunctionTool:return await self.func(*args, **kwargs)else:# Run sync function in executor to avoid blocking event loop+ # Use functools.partial to properly capture args/kwargsloop = asyncio.get_running_loop()return await loop.run_in_executor(- _SYNC_TOOL_EXECUTOR, lambda: self.func(*args, **kwargs)+ _SYNC_TOOL_EXECUTOR,+ functools.partial(self.func, *args, **kwargs),)@propertydiff --git a/docs/conf.py b/docs/conf.pyindex 287a215b9..c1657645c 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.80'+release = '0.2.81a0'html_favicon = ('https://raw.githubusercontent.com/camel-ai/camel/master/misc/favicon.png'diff --git a/pyproject.toml b/pyproject.tomlindex 9b5ba1776..db0384fcd 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -4,7 +4,7 @@ build-backend = "hatchling.build"[project]name = "camel-ai"-version = "0.2.80"+version = "0.2.81a0"description = "Communicative Agents for AI Society Study"authors = [{ name = "CAMEL-AI.org" }]requires-python = ">=3.10,<3.15"diff --git a/uv.lock b/uv.lockindex 2c8368784..25f728db2 100644--- a/uv.lock+++ b/uv.lock@@ -790,7 +790,7 @@ wheels = [[[package]]name = "camel-ai"-version = "0.2.80"+version = "0.2.81a0"source = { editable = "." }dependencies = [{ name = "astor" },