Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
[HOTFIX] Fix the bug in pre-commit workflow; Resolve ``execute_shell_command`` test failures on Ubuntu; Add LICENCE file and gitignore (#663)
qbcc5b9cee6044b
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.ymlindex 195a8d8a4..f0a593a25 100644--- a/.github/workflows/pre-commit.yml+++ b/.github/workflows/pre-commit.yml@@ -17,13 +17,13 @@ jobs:- name: Setup Pythonuses: actions/setup-python@masterwith:- python-version: 3.10+ python-version: '3.10'- name: Update setuptoolsrun: |pip install setuptools==68.2.2 wheel==0.41.2- name: Install AgentScoperun: |- pip install -q -e .[full]+ pip install -q -e .[dev]- name: Install pre-commitrun: |pre-commit installdiff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.ymlindex cc756cad7..d7942be5b 100644--- a/.github/workflows/publish-pypi.yml+++ b/.github/workflows/publish-pypi.yml@@ -26,7 +26,7 @@ jobs:- name: Set up Pythonuses: actions/setup-python@v5with:- python-version: 3.10+ python-version: '3.10'- name: Install dependenciesrun: |python -m pip install --upgrade pipdiff --git a/.github/workflows/sphinx_docs.yml b/.github/workflows/sphinx_docs.ymlindex 89fafcc96..95c277afd 100644--- a/.github/workflows/sphinx_docs.yml+++ b/.github/workflows/sphinx_docs.yml@@ -27,7 +27,7 @@ jobs:pip install setuptools==78.1.1 wheel==0.45.1- name: Install Dependenciesrun: |- pip install -q -e .[full]+ pip install -q -e .[dev]- name: Add execute permission to build.shrun: |chmod +x docs/tutorial/en/build.sh@@ -72,7 +72,7 @@ jobs:pip install setuptools==78.1.1 wheel==0.45.1- name: Install Dependenciesrun: |- pip install -q -e .[full]+ pip install -q -e .[dev]- name: Add execute permission to build.shrun: |chmod +x docs/tutorial/zh_CN/build.shdiff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.ymlindex fd1e1ca25..5fea510c3 100644--- a/.github/workflows/unittest.yml+++ b/.github/workflows/unittest.yml@@ -8,7 +8,7 @@ jobs:runs-on: ${{ matrix.os }}strategy:matrix:- os: [ubuntu-latest, macos-13]+ os: [ubuntu-latest, windows-latest, macos-13]python-version: ['3.10', '3.11', '3.12']env:OS: ${{ matrix.os }}@@ -21,12 +21,6 @@ jobs:- name: Update setuptoolsrun: |pip install setuptools==78.1.1 wheel==0.45.1-# - name: Install Minimal Dependencies-# run: |-# pip install -q -e .-# - name: Run minimal import tests-# run: |-# python tests/minimal.py- name: Install Full Dependenciesrun: |pip install -q -e .[full]diff --git a/.gitignore b/.gitignoreindex adee77870..6a0ec243f 100644--- a/.gitignore+++ b/.gitignore@@ -1,2 +1,138 @@+# Byte-compiled / optimized / DLL files__pycache__/-*egg-info/\ No newline at end of file+*.py[cod]+*$py.class++# C extensions+*.so++# Distribution / packaging+.Python+build/+develop-eggs/+dist/+downloads/+eggs/+.eggs/+lib/+lib64/+parts/+sdist/+var/+wheels/+pip-wheel-metadata/+share/python-wheels/+*.egg-info/+.installed.cfg+*.egg+MANIFEST++# PyInstaller+# Usually these files are written by a python script from a template+# before PyInstaller builds the exe, so as to inject date/other infos into it.+*.manifest+*.spec++# Installer logs+pip-log.txt+pip-delete-this-directory.txt++# Unit test / coverage reports+htmlcov/+.tox/+.nox/+.coverage+.coverage.*+.cache+nosetests.xml+coverage.xml+*.cover+*.py,cover+.hypothesis/+.pytest_cache/++# Translations+*.mo+*.pot++# Django stuff:+*.log+local_settings.py+db.sqlite3+db.sqlite3-journal++# Flask stuff:+instance/+.webassets-cache++# Scrapy stuff:+.scrapy++# Sphinx documentation+docs/_build/++# PyBuilder+target/++# Jupyter Notebook+.ipynb_checkpoints++# IPython+profile_default/+ipython_config.py++# pyenv+.python-version++# pipenv+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.+# However, in case of collaboration, if having platform-specific dependencies or dependencies+# having no cross-platform support, pipenv may install dependencies that don't work, or not+# install all needed dependencies.+#Pipfile.lock++# PEP 582; used by e.g. github.com/David-OConnor/pyflow+__pypackages__/++# Celery stuff+celerybeat-schedule+celerybeat.pid++# SageMath parsed files+*.sage.py++# Environments+.env+.venv+env/+venv/+ENV/+env.bak/+venv.bak/++# Spyder project settings+.spyderproject+.spyproject++# Rope project settings+.ropeproject++# mkdocs documentation+/site++# mypy+.mypy_cache/+.dmypy.json+dmypy.json++# Pyre type checker+.pyre/++.idea/++# macOS+.DS_Store++# docs+docs/tutorial/en/build/+docs/tutorial/zh_CN/build/diff --git a/LICENSE b/LICENSEnew file mode 100644index 000000000..2f2f2f25e--- /dev/null+++ b/LICENSE@@ -0,0 +1,391 @@++ Apache License+ Version 2.0, January 2004+ http://www.apache.org/licenses/++ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION++ 1. Definitions.++ "License" shall mean the terms and conditions for use, reproduction,+ and distribution as defined by Sections 1 through 9 of this document.++ "Licensor" shall mean the copyright owner or entity authorized by+ the copyright owner that is granting the License.++ "Legal Entity" shall mean the union of the acting entity and all+ other entities that control, are controlled by, or are under common+ control with that entity. For the purposes of this definition,+ "control" means (i) the power, direct or indirect, to cause the+ direction or management of such entity, whether by contract or+ otherwise, or (ii) ownership of fifty percent (50%) or more of the+ outstanding shares, or (iii) beneficial ownership of such entity.++ "You" (or "Your") shall mean an individual or Legal Entity+ exercising permissions granted by this License.++ "Source" form shall mean the preferred form for making modifications,+ including but not limited to software source code, documentation+ source, and configuration files.++ "Object" form shall mean any form resulting from mechanical+ transformation or translation of a Source form, including but+ not limited to compiled object code, generated documentation,+ and conversions to other media types.++ "Work" shall mean the work of authorship, whether in Source or+ Object form, made available under the License, as indicated by a+ copyright notice that is included in or attached to the work+ (an example is provided in the Appendix below).++ "Derivative Works" shall mean any work, whether in Source or Object+ form, that is based on (or derived from) the Work and for which the+ editorial revisions, annotations, elaborations, or other modifications+ represent, as a whole, an original work of authorship. For the purposes+ of this License, Derivative Works shall not include works that remain+ separable from, or merely link (or bind by name) to the interfaces of,+ the Work and Derivative Works thereof.++ "Contribution" shall mean any work of authorship, including+ the original version of the Work and any modifications or additions+ to that Work or Derivative Works thereof, that is intentionally+ submitted to Licensor for inclusion in the Work by the copyright owner+ or by an individual or Legal Entity authorized to submit on behalf of+ the copyright owner. For the purposes of this definition, "submitted"+ means any form of electronic, verbal, or written communication sent+ to the Licensor or its representatives, including but not limited to+ communication on electronic mailing lists, source code control systems,+ and issue tracking systems that are managed by, or on behalf of, the+ Licensor for the purpose of discussing and improving the Work, but+ excluding communication that is conspicuously marked or otherwise+ designated in writing by the copyright owner as "Not a Contribution."++ "Contributor" shall mean Licensor and any individual or Legal Entity+ on behalf of whom a Contribution has been received by Licensor and+ subsequently incorporated within the Work.++ 2. Grant of Copyright License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ copyright license to reproduce, prepare Derivative Works of,+ publicly display, publicly perform, sublicense, and distribute the+ Work and such Derivative Works in Source or Object form.++ 3. Grant of Patent License. Subject to the terms and conditions of+ this License, each Contributor hereby grants to You a perpetual,+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable+ (except as stated in this section) patent license to make, have made,+ use, offer to sell, sell, import, and otherwise transfer the Work,+ where such license applies only to those patent claims licensable+ by such Contributor that are necessarily infringed by their+ Contribution(s) alone or by combination of their Contribution(s)+ with the Work to which such Contribution(s) was submitted. If You+ institute patent litigation against any entity (including a+ cross-claim or counterclaim in a lawsuit) alleging that the Work+ or a Contribution incorporated within the Work constitutes direct+ or contributory patent infringement, then any patent licenses+ granted to You under this License for that Work shall terminate+ as of the date such litigation is filed.++ 4. Redistribution. You may reproduce and distribute copies of the+ Work or Derivative Works thereof in any medium, with or without+ modifications, and in Source or Object form, provided that You+ meet the following conditions:++ (a) You must give any other recipients of the Work or+ Derivative Works a copy of this License; and++ (b) You must cause any modified files to carry prominent notices+ stating that You changed the files; and++ (c) You must retain, in the Source form of any Derivative Works+ that You distribute, all copyright, patent, trademark, and+ attribution notices from the Source form of the Work,+ excluding those notices that do not pertain to any part of+ the Derivative Works; and++ (d) If the Work includes a "NOTICE" text file as part of its+ distribution, then any Derivative Works that You distribute must+ include a readable copy of the attribution notices contained+ within such NOTICE file, excluding those notices that do not+ pertain to any part of the Derivative Works, in at least one+ of the following places: within a NOTICE text file distributed+ as part of the Derivative Works; within the Source form or+ documentation, if provided along with the Derivative Works; or,+ within a display generated by the Derivative Works, if and+ wherever such third-party notices normally appear. The contents+ of the NOTICE file are for informational purposes only and+ do not modify the License. You may add Your own attribution+ notices within Derivative Works that You distribute, alongside+ or as an addendum to the NOTICE text from the Work, provided+ that such additional attribution notices cannot be construed+ as modifying the License.++ You may add Your own copyright statement to Your modifications and+ may provide additional or different license terms and conditions+ for use, reproduction, or distribution of Your modifications, or+ for any such Derivative Works as a whole, provided Your use,+ reproduction, and distribution of the Work otherwise complies with+ the conditions stated in this License.++ 5. Submission of Contributions. Unless You explicitly state otherwise,+ any Contribution intentionally submitted for inclusion in the Work+ by You to the Licensor shall be under the terms and conditions of+ this License, without any additional terms or conditions.+ Notwithstanding the above, nothing herein shall supersede or modify+ the terms of any separate license agreement you may have executed+ with Licensor regarding such Contributions.++ 6. Trademarks. This License does not grant permission to use the trade+ names, trademarks, service marks, or product names of the Licensor,+ except as required for reasonable and customary use in describing the+ origin of the Work and reproducing the content of the NOTICE file.++ 7. Disclaimer of Warranty. Unless required by applicable law or+ agreed to in writing, Licensor provides the Work (and each+ Contributor provides its Contributions) on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or+ implied, including, without limitation, any warranties or conditions+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A+ PARTICULAR PURPOSE. You are solely responsible for determining the+ appropriateness of using or redistributing the Work and assume any+ risks associated with Your exercise of permissions under this License.++ 8. Limitation of Liability. In no event and under no legal theory,+ whether in tort (including negligence), contract, or otherwise,+ unless required by applicable law (such as deliberate and grossly+ negligent acts) or agreed to in writing, shall any Contributor be+ liable to You for damages, including any direct, indirect, special,+ incidental, or consequential damages of any character arising as a+ result of this License or out of the use or inability to use the+ Work (including but not limited to damages for loss of goodwill,+ work stoppage, computer failure or malfunction, or any and all+ other commercial damages or losses), even if such Contributor+ has been advised of the possibility of such damages.++ 9. Accepting Warranty or Additional Liability. While redistributing+ the Work or Derivative Works thereof, You may choose to offer,+ and charge a fee for, acceptance of support, warranty, indemnity,+ or other liability obligations and/or rights consistent with this+ License. However, in accepting such obligations, You may act only+ on Your own behalf and on Your sole responsibility, not on behalf+ of any other Contributor, and only if You agree to indemnify,+ defend, and hold each Contributor harmless for any liability+ incurred by, or claims asserted against, such Contributor by reason+ of your accepting any such warranty or additional liability.++ END OF TERMS AND CONDITIONS++ APPENDIX: How to apply the Apache License to your work.++ To apply the Apache License to your work, attach the following+ boilerplate notice, with the fields enclosed by brackets "[]"+ replaced with your own identifying information. (Don't include+ the brackets!) The text should be enclosed in the appropriate+ comment syntax for the file format. We also recommend that a+ file or class name and description of purpose be included on the+ same "printed page" as the copyright notice for easier+ identification within third-party archives.++ Copyright 2024 Alibaba++ Licensed under the Apache License, Version 2.0 (the "License");+ you may not use this file except in compliance with the License.+ You may obtain a copy of the License at++ http://www.apache.org/licenses/LICENSE-2.0++ Unless required by applicable law or agreed to in writing, software+ distributed under the License is distributed on an "AS IS" BASIS,+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ See the License for the specific language governing permissions and+ limitations under the License.++++--------------------------------------------------------------------------------+++Some codes of tests/run.py is modified from+https://github.com/alibaba/FederatedScope/blob/master/tests/run.py, which is+also licensed under the terms of the Apache 2.0.+++--------------------------------------------------------------------------------++Code in src/agentscope/web/static/js/socket.io.js is adapted from+https://cdnjs.cloudflare.com/ajax/libs/socket.io/3.1.3/socket.io.js (MIT License)++Copyright (c) 2014-2021 Guillermo Rauch++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++--------------------------------------------------------------------------------++Code in src/agentscope/web/static/js/jquery-3.3.1.min.js is adapted from+https://code.jquery.com/jquery-3.3.1.min.js (MIT License)++Copyright (c) JS Foundation and other contributors++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++--------------------------------------------------------------------------------++Code in src/agentscope/web/static/js/bootstrap.bundle.min.js is adapted from+https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js+ (MIT License)++Copyright (c) 2011-2019 The Bootstrap Authors (https://github+.com/twbs/bootstrap/graphs/contributors)++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++--------------------------------------------------------------------------------++Code in src/agentscope/web/static/js/bootstrap-table.min.js is adapted from+https://unpkg.com/[email protected]/dist/bootstrap-table.min.js (MIT+License)++Copyright (c) wenzhixin <[email protected]> (http://wenzhixin.net.cn/)++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.++--------------------------------------------------------------------------------++Code in src/agentscope/web/static/css/bootstrap.min.css is adapted from+https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css (MIT+License)++Copyright 2011-2019 The Bootstrap Authors+Copyright 2011-2019 Twitter, Inc.++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.+++--------------------------------------------------------------------------------++Fonts in src/agentscope/web/static/fonts/KRYPTON.ttf is adapted from+https://github.com/githubnext/monaspace (SIL Open Font License 1.1). These+fonts are distributed with their original license. See https://github+.com/githubnext/monaspace/blob/main/LICENSE for the full text of the license.+The following font families are included:++- Monaspace (with subfamilies: Krypton)++Copyright (c) 2023, GitHub https://github.com/githubnext/monaspace+with Reserved Font Name "Monaspace", including subfamilies: "Argon", "Neon",+"Xenon", "Radon", and "Krypton"++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.++--------------------------------------------------------------------------------++Fonts in src/agentscope/web/static/fonts/OSWALD.ttf is adapted from+https://fonts.google.com/specimen/Oswald (SIL Open Font License 1.1). These+fonts are distributed with their original license. See https://github+.com/googlefonts/OswaldFont/blob/main/OFL.txt for the full text of the license.++Copyright 2016 The Oswald Project Authors (https://github+.com/googlefonts/OswaldFont)++DISCLAIMER+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM+OTHER DEALINGS IN THE FONT SOFTWARE.++--------------------------------------------------------------------------------\ No newline at end of filediff --git a/tests/mcp_sse_client_test.py b/tests/mcp_sse_client_test.pyindex 11e2bcbd3..13219cd32 100644--- a/tests/mcp_sse_client_test.py+++ b/tests/mcp_sse_client_test.py@@ -26,7 +26,7 @@ async def tool_1(arg1: str, arg2: list[int]) -> str:def setup_server() -> None:"""Set up the streamable HTTP MCP server."""- sse_server = FastMCP("SSE", port=8001)+ sse_server = FastMCP("SSE", port=8003)sse_server.tool(description="A test tool function.")(tool_1)sse_server.run(transport="sse")@@ -40,14 +40,14 @@ class SseMCPClientTest(IsolatedAsyncioTestCase):while self.process.is_alive():self.process.terminate()- await asyncio.sleep(1)+ await asyncio.sleep(5)async def asyncSetUp(self) -> None:"""Set up the test environment."""- self.port = 8001+ self.port = 8003self.process = Process(target=setup_server)self.process.start()- await asyncio.sleep(2)+ await asyncio.sleep(10)self.toolkit = Toolkit()self.schemas_wo_arg1 = [diff --git a/tests/mcp_streamable_http_client_test.py b/tests/mcp_streamable_http_client_test.pyindex cc5bf97dd..a88c5d436 100644--- a/tests/mcp_streamable_http_client_test.py+++ b/tests/mcp_streamable_http_client_test.py@@ -38,14 +38,14 @@ class StreamableHttpMCPClientTest(IsolatedAsyncioTestCase):"""Tear down the test environment."""while self.process.is_alive():self.process.terminate()- await asyncio.sleep(1)+ await asyncio.sleep(5)async def asyncSetUp(self) -> None:"""Set up the test environment."""self.port = 8002self.process = Process(target=setup_server)self.process.start()- await asyncio.sleep(2)+ await asyncio.sleep(10)async def test_streamable_http_stateless_client(self) -> None:"""Test the MCP server connection functionality."""diff --git a/tests/tool_test.py b/tests/tool_test.pyindex 4d44ead83..7a2142b6a 100644--- a/tests/tool_test.py+++ b/tests/tool_test.py@@ -2,6 +2,8 @@"""The tool module unit tests"""import os+import platform+import sysimport tempfilefrom unittest import IsolatedAsyncioTestCase@@ -39,24 +41,28 @@ class ToolTest(IsolatedAsyncioTestCase):# with outputres = await execute_python_code(code="print('Hello, World!')")++ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>0</returncode>""<stdout>Hello, World!\n</stdout>""<stderr></stderr>",- res.content[0]["text"],+ actual,)# with exceptionres = await execute_python_code(code="raise Exception('Test error')")+ actual = res.content[0]["text"].replace("\r\n", "\n")+self.assertTrue(- res.content[0]["text"].startswith(+ actual.startswith("<returncode>1</returncode>""<stdout></stdout>""<stderr>Traceback (most recent call last):\n File ",),)self.assertTrue(- res.content[0]["text"].endswith(+ actual.endswith('.py", line 1, in <module>\n'" raise Exception('Test error')\n""Exception: Test error\n"@@ -71,64 +77,79 @@ time.sleep(5)print("456")"""res = await execute_python_code(code)+ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>0</returncode>""<stdout>123\n456\n</stdout>""<stderr></stderr>",- res.content[0]["text"],+ actual,)res = await execute_python_code(code, timeout=2)+ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>-1</returncode>""<stdout>123\n</stdout>""<stderr>TimeoutError: The code execution exceeded the ""timeout of 2 seconds.</stderr>",- res.content[0]["text"],+ actual,)async def test_execute_shell_command(self) -> None:"""Test executing shell command."""# empty output- res = await execute_shell_command(command="echo 'Hello, World!'")+ python_echo_cmd = f"{sys.executable} -c \"print('Hello, World!')\""+ res = await execute_shell_command(command=python_echo_cmd)+ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>0</returncode>""<stdout>Hello, World!\n</stdout>""<stderr></stderr>",- res.content[0]["text"],+ actual,)# with exceptionres = await execute_shell_command(command="non_existent_command")- self.assertEqual(- "<returncode>127</returncode>"- "<stdout></stdout>"- "<stderr>/bin/sh: non_existent_command: command not found\n"- "</stderr>",- res.content[0]["text"],+ assert any(+ keyword in res.content[0]["text"].lower()+ for keyword in ["not found", "is not recognized"]+ )++ # without timeout+ normal_cmd = (+ f"{sys.executable} -c \"" # fmt: skip+ f"import time; print('123'); "+ f"time.sleep(0.1); print('456')\"")- # with timeoutres = await execute_shell_command(- command='echo "123"; sleep 5; echo "456"',+ command=normal_cmd,)+ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>0</returncode>""<stdout>123\n456\n</stdout>""<stderr></stderr>",- res.content[0]["text"],+ actual,)+ # with timeout+ if platform.system() == "Windows":+ return+ else:+ timeout_cmd = 'echo "123"; sleep 5; echo "456"'+res = await execute_shell_command(- command='echo "123"; sleep 5; echo "456"',+ command=timeout_cmd,timeout=2,)+ actual = res.content[0]["text"].replace("\r\n", "\n")self.assertEqual("<returncode>-1</returncode>""<stdout>123\n</stdout>""<stderr>TimeoutError: The command execution exceeded ""the timeout of 2 seconds.</stderr>",- res.content[0]["text"],+ actual,)async def test_view_text_file(self) -> None: