camel-ai 0.2.73a4__py3-none-any.whl → 0.2.73a6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of camel-ai might be problematic. Click here for more details.

camel/__init__.py CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  from camel.logger import disable_logging, enable_logging, set_log_level
16
16
 
17
- __version__ = '0.2.73a4'
17
+ __version__ = '0.2.73a6'
18
18
 
19
19
  __all__ = [
20
20
  '__version__',
@@ -2798,12 +2798,7 @@ class ChatAgent(BaseAgent):
2798
2798
  )
2799
2799
  thread = threading.Thread(
2800
2800
  target=tool_worker,
2801
- args=(
2802
- self._internal_tools[function_name],
2803
- args,
2804
- result_queue,
2805
- tool_call_data,
2806
- ),
2801
+ args=(result_queue, tool_call_data),
2807
2802
  )
2808
2803
  thread.start()
2809
2804
 
camel/toolkits/base.py CHANGED
@@ -48,7 +48,9 @@ class BaseToolkit(metaclass=AgentOpsMeta):
48
48
  super().__init_subclass__(**kwargs)
49
49
  for attr_name, attr_value in cls.__dict__.items():
50
50
  if callable(attr_value) and not attr_name.startswith("__"):
51
- setattr(cls, attr_name, with_timeout(attr_value))
51
+ # Skip methods that have manual timeout management
52
+ if not getattr(attr_value, '_manual_timeout', False):
53
+ setattr(cls, attr_name, with_timeout(attr_value))
52
54
 
53
55
  def get_tools(self) -> List[FunctionTool]:
54
56
  r"""Returns a list of FunctionTool objects representing the
@@ -17,6 +17,7 @@ import os
17
17
  import platform
18
18
  import queue
19
19
  import shutil
20
+ import signal
20
21
  import subprocess
21
22
  import sys
22
23
  import threading
@@ -42,7 +43,7 @@ class TerminalToolkit(BaseToolkit):
42
43
 
43
44
  Args:
44
45
  timeout (Optional[float]): The timeout for terminal operations.
45
- (default: :obj:`None`)
46
+ (default: :obj:`20.0`)
46
47
  shell_sessions (Optional[Dict[str, Any]]): A dictionary to store
47
48
  shell session information. If :obj:`None`, an empty dictionary
48
49
  will be used. (default: :obj:`None`)
@@ -70,7 +71,7 @@ class TerminalToolkit(BaseToolkit):
70
71
 
71
72
  def __init__(
72
73
  self,
73
- timeout: Optional[float] = None,
74
+ timeout: Optional[float] = 20.0,
74
75
  shell_sessions: Optional[Dict[str, Any]] = None,
75
76
  working_directory: Optional[str] = None,
76
77
  need_terminal: bool = True,
@@ -78,6 +79,8 @@ class TerminalToolkit(BaseToolkit):
78
79
  clone_current_env: bool = False,
79
80
  safe_mode: bool = True,
80
81
  ):
82
+ # Store timeout before calling super().__init__
83
+ self._timeout = timeout
81
84
  super().__init__(timeout=timeout)
82
85
  self.shell_sessions = shell_sessions or {}
83
86
  self.os_type = platform.system()
@@ -944,6 +947,11 @@ class TerminalToolkit(BaseToolkit):
944
947
  command = command.replace('pip', pip_path, 1)
945
948
 
946
949
  if not interactive:
950
+ # Use preexec_fn to create a new process group on Unix systems
951
+ preexec_fn = None
952
+ if self.os_type in ['Darwin', 'Linux']:
953
+ preexec_fn = os.setsid
954
+
947
955
  proc = subprocess.Popen(
948
956
  command,
949
957
  shell=True,
@@ -955,17 +963,55 @@ class TerminalToolkit(BaseToolkit):
955
963
  bufsize=1,
956
964
  universal_newlines=True,
957
965
  env=os.environ.copy(),
966
+ preexec_fn=preexec_fn,
958
967
  )
959
968
 
960
969
  self.shell_sessions[id]["process"] = proc
961
970
  self.shell_sessions[id]["running"] = True
962
- stdout, stderr = proc.communicate()
963
- output = stdout or ""
964
- if stderr:
965
- output += f"\nStderr Output:\n{stderr}"
966
- self.shell_sessions[id]["output"] = output
967
- self._update_terminal_output(output + "\n")
968
- return output
971
+ try:
972
+ # Use the instance timeout if available
973
+ stdout, stderr = proc.communicate(timeout=self.timeout)
974
+ output = stdout or ""
975
+ if stderr:
976
+ output += f"\nStderr Output:\n{stderr}"
977
+ self.shell_sessions[id]["output"] = output
978
+ self.shell_sessions[id]["running"] = False
979
+ self._update_terminal_output(output + "\n")
980
+ return output
981
+ except subprocess.TimeoutExpired:
982
+ # Kill the entire process group on Unix systems
983
+ if self.os_type in ['Darwin', 'Linux']:
984
+ try:
985
+ os.killpg(os.getpgid(proc.pid), signal.SIGTERM)
986
+ # Give it a short time to terminate
987
+ stdout, stderr = proc.communicate(timeout=1)
988
+ except subprocess.TimeoutExpired:
989
+ # Force kill the process group
990
+ os.killpg(os.getpgid(proc.pid), signal.SIGKILL)
991
+ stdout, stderr = proc.communicate()
992
+ except ProcessLookupError:
993
+ # Process already dead
994
+ stdout, stderr = proc.communicate()
995
+ else:
996
+ # Windows fallback
997
+ proc.terminate()
998
+ try:
999
+ stdout, stderr = proc.communicate(timeout=1)
1000
+ except subprocess.TimeoutExpired:
1001
+ proc.kill()
1002
+ stdout, stderr = proc.communicate()
1003
+
1004
+ output = stdout or ""
1005
+ if stderr:
1006
+ output += f"\nStderr Output:\n{stderr}"
1007
+ error_msg = (
1008
+ f"\nCommand timed out after {self.timeout} seconds"
1009
+ )
1010
+ output += error_msg
1011
+ self.shell_sessions[id]["output"] = output
1012
+ self.shell_sessions[id]["running"] = False
1013
+ self._update_terminal_output(output + "\n")
1014
+ return output
969
1015
 
970
1016
  # Interactive mode with real-time streaming via PTY
971
1017
  if self.os_type not in ['Darwin', 'Linux']:
@@ -1075,6 +1121,9 @@ class TerminalToolkit(BaseToolkit):
1075
1121
  f"Detailed information: {detailed_error}"
1076
1122
  )
1077
1123
 
1124
+ # Mark shell_exec to skip automatic timeout wrapping
1125
+ shell_exec._manual_timeout = True # type: ignore[attr-defined]
1126
+
1078
1127
  def shell_view(self, id: str) -> str:
1079
1128
  r"""View the full output history of a specified shell session.
1080
1129
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: camel-ai
3
- Version: 0.2.73a4
3
+ Version: 0.2.73a6
4
4
  Summary: Communicative Agents for AI Society Study
5
5
  Project-URL: Homepage, https://www.camel-ai.org/
6
6
  Project-URL: Repository, https://github.com/camel-ai/camel
@@ -82,7 +82,7 @@ Requires-Dist: networkx<4,>=3.4.2; extra == 'all'
82
82
  Requires-Dist: newspaper3k<0.3,>=0.2.8; extra == 'all'
83
83
  Requires-Dist: notion-client<3,>=2.2.1; extra == 'all'
84
84
  Requires-Dist: numpy<=2.2,>=1.2; extra == 'all'
85
- Requires-Dist: onnxruntime<=1.20.1; extra == 'all'
85
+ Requires-Dist: onnxruntime<=1.19.2; extra == 'all'
86
86
  Requires-Dist: openapi-spec-validator<0.8,>=0.7.1; extra == 'all'
87
87
  Requires-Dist: openpyxl>=3.1.5; extra == 'all'
88
88
  Requires-Dist: pandas<2,>=1.5.3; extra == 'all'
@@ -213,7 +213,7 @@ Requires-Dist: docx2txt<0.9,>=0.8; extra == 'document-tools'
213
213
  Requires-Dist: docx>=0.2.4; extra == 'document-tools'
214
214
  Requires-Dist: markitdown>=0.1.1; extra == 'document-tools'
215
215
  Requires-Dist: numpy<=2.2,>=1.2; extra == 'document-tools'
216
- Requires-Dist: onnxruntime<=1.20.1; extra == 'document-tools'
216
+ Requires-Dist: onnxruntime<=1.19.2; extra == 'document-tools'
217
217
  Requires-Dist: openapi-spec-validator<0.8,>=0.7.1; extra == 'document-tools'
218
218
  Requires-Dist: openpyxl>=3.1.5; extra == 'document-tools'
219
219
  Requires-Dist: pandasai<3,>=2.3.0; extra == 'document-tools'
@@ -268,7 +268,7 @@ Requires-Dist: mcp-server-fetch==2025.1.17; extra == 'owl'
268
268
  Requires-Dist: mcp-simple-arxiv==0.2.2; extra == 'owl'
269
269
  Requires-Dist: newspaper3k<0.3,>=0.2.8; extra == 'owl'
270
270
  Requires-Dist: numpy<=2.2,>=1.2; extra == 'owl'
271
- Requires-Dist: onnxruntime<=1.20.1; extra == 'owl'
271
+ Requires-Dist: onnxruntime<=1.19.2; extra == 'owl'
272
272
  Requires-Dist: openapi-spec-validator<0.8,>=0.7.1; extra == 'owl'
273
273
  Requires-Dist: openpyxl>=3.1.5; extra == 'owl'
274
274
  Requires-Dist: pandas<2,>=1.5.3; extra == 'owl'
@@ -1,4 +1,4 @@
1
- camel/__init__.py,sha256=1A_s4813pCXFzfgs6rYH4XAW07sXn8m93RQ8jiUaKvQ,901
1
+ camel/__init__.py,sha256=JP5f2mqGwiHtIMh6SJqVmdqUdZ1ig-Hw_q0RjVeoYbE,901
2
2
  camel/generators.py,sha256=JRqj9_m1PF4qT6UtybzTQ-KBT9MJQt18OAAYvQ_fr2o,13844
3
3
  camel/human.py,sha256=Xg8x1cS5KK4bQ1SDByiHZnzsRpvRP-KZViNvmu38xo4,5475
4
4
  camel/logger.py,sha256=WgEwael_eT6D-lVAKHpKIpwXSTjvLbny5jbV1Ab8lnA,5760
@@ -7,7 +7,7 @@ camel/agents/__init__.py,sha256=64weKqdvmpZcGWyVkO-OKASAmVUdrQjv60JApgPk_SA,1644
7
7
  camel/agents/_types.py,sha256=MeFZzay2kJA6evALQ-MbBTKW-0lu_0wBuKsxzH_4gWI,1552
8
8
  camel/agents/_utils.py,sha256=AR7Qqgbkmn4X2edYUQf1rdksGUyV5hm3iK1z-Dn0Mcg,6266
9
9
  camel/agents/base.py,sha256=c4bJYL3G3Z41SaFdMPMn8ZjLdFiFaVOFO6EQIfuCVR8,1124
10
- camel/agents/chat_agent.py,sha256=4Hn27mtUvUQmwMIFTDTUcTsXWIjyeISvz1FCOdm5HSM,151957
10
+ camel/agents/chat_agent.py,sha256=fxZ8dBVhLwA-ZsBJbOvTxvQc4zHCKi4D3qwLz2URiW0,151815
11
11
  camel/agents/critic_agent.py,sha256=L6cTbYjyZB0DCa51tQ6LZLA6my8kHLC4nktHySH78H4,10433
12
12
  camel/agents/deductive_reasoner_agent.py,sha256=6BZGaq1hR6hKJuQtOfoYQnk_AkZpw_Mr7mUy2MspQgs,13540
13
13
  camel/agents/embodied_agent.py,sha256=XBxBu5ZMmSJ4B2U3Z7SMwvLlgp6yNpaBe8HNQmY9CZA,7536
@@ -323,7 +323,7 @@ camel/toolkits/arxiv_toolkit.py,sha256=mw629nIN_ozaAxNv3nbvhonJKNI2-97ScRCBS3gVq
323
323
  camel/toolkits/ask_news_toolkit.py,sha256=WfWaqwEo1Apbil3-Rb5y65Ws43NU4rAFWZu5VHe4los,23448
324
324
  camel/toolkits/async_browser_toolkit.py,sha256=dHXV8uCDetLKN7no5otyP3hHDnQIRhGY0msJRJrFbIY,50436
325
325
  camel/toolkits/audio_analysis_toolkit.py,sha256=dnDtQJbztVBwBpamSyCfigPw2GBnDAfi3fOPgql4Y50,8941
326
- camel/toolkits/base.py,sha256=RuqpAvs4dM070tv_L-9vSevQn5Q46TpQpyx5k6yKYVI,4374
326
+ camel/toolkits/base.py,sha256=LXV-McBL7zgWNVXWlumN5nDYTFkaSptgQE6faPoYj8o,4515
327
327
  camel/toolkits/bohrium_toolkit.py,sha256=453t-m0h0IGjurG6tCHUejGzfRAN2SAkhIoY8V-WJpw,11396
328
328
  camel/toolkits/browser_toolkit.py,sha256=Ntn_LmCrhqqIBWq9HtiIKw-M0cL5ebn74Ej1GBoZiC8,44400
329
329
  camel/toolkits/browser_toolkit_commons.py,sha256=uuc1V5tN3YJmTSe6NHAVJqwsL4iYD7IiSZWxPLYW67A,22196
@@ -378,7 +378,7 @@ camel/toolkits/slack_toolkit.py,sha256=ZnK_fRdrQiaAUpjkgHSv1iXdv1HKEgXMlKevu3Qiv
378
378
  camel/toolkits/stripe_toolkit.py,sha256=07swo5znGTnorafC1uYLKB4NRcJIOPOx19J7tkpLYWk,10102
379
379
  camel/toolkits/sympy_toolkit.py,sha256=BAQnI8EFJydNUpKQWXBdleQ1Cm-srDBhFlqp9V9pbPQ,33757
380
380
  camel/toolkits/task_planning_toolkit.py,sha256=Ttw9fHae4omGC1SA-6uaeXVHJ1YkwiVloz_hO-fm1gw,4855
381
- camel/toolkits/terminal_toolkit.py,sha256=_A6_cXVUEodaiLnC-1r-PrsNNVtDQk7vl942GrbkHzQ,58847
381
+ camel/toolkits/terminal_toolkit.py,sha256=jRprx7Qlf-_ZgXhuFXObydwNaNLG7vqDSYNA5BTw-l4,61274
382
382
  camel/toolkits/thinking_toolkit.py,sha256=nZYLvKWIx2BM1DYu69I9B5EISAG7aYcLYXKv9663BVk,8000
383
383
  camel/toolkits/twitter_toolkit.py,sha256=Px4N8aUxUzy01LhGSWkdrC2JgwKkrY3cvxgMeJ2XYfU,15939
384
384
  camel/toolkits/video_analysis_toolkit.py,sha256=h6D7b1MAAzaHn222n_YKtwG-EGEGgMt7mBrNNVipYZc,23361
@@ -467,7 +467,7 @@ camel/verifiers/math_verifier.py,sha256=tA1D4S0sm8nsWISevxSN0hvSVtIUpqmJhzqfbuMo
467
467
  camel/verifiers/models.py,sha256=GdxYPr7UxNrR1577yW4kyroRcLGfd-H1GXgv8potDWU,2471
468
468
  camel/verifiers/physics_verifier.py,sha256=c1grrRddcrVN7szkxhv2QirwY9viIRSITWeWFF5HmLs,30187
469
469
  camel/verifiers/python_verifier.py,sha256=ogTz77wODfEcDN4tMVtiSkRQyoiZbHPY2fKybn59lHw,20558
470
- camel_ai-0.2.73a4.dist-info/METADATA,sha256=eiu76i0Cyxv90DdcFdRBgWHY9ZlXP54ule0zp0VSsiA,50434
471
- camel_ai-0.2.73a4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
472
- camel_ai-0.2.73a4.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
473
- camel_ai-0.2.73a4.dist-info/RECORD,,
470
+ camel_ai-0.2.73a6.dist-info/METADATA,sha256=CS0ZgtTR4f4JAwpvej1pHlG7S1LqF2K8k7D42GUSito,50434
471
+ camel_ai-0.2.73a6.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
472
+ camel_ai-0.2.73a6.dist-info/licenses/LICENSE,sha256=id0nB2my5kG0xXeimIu5zZrbHLS6EQvxvkKkzIHaT2k,11343
473
+ camel_ai-0.2.73a6.dist-info/RECORD,,