agentmesh-sdk 0.1.6__tar.gz
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.
- agentmesh_sdk-0.1.6/LICENSE +65 -0
- agentmesh_sdk-0.1.6/MANIFEST.in +3 -0
- agentmesh_sdk-0.1.6/PKG-INFO +260 -0
- agentmesh_sdk-0.1.6/README.md +221 -0
- agentmesh_sdk-0.1.6/agentmesh/__init__.py +62 -0
- agentmesh_sdk-0.1.6/agentmesh/api/__init__.py +1 -0
- agentmesh_sdk-0.1.6/agentmesh/api/app.py +49 -0
- agentmesh_sdk-0.1.6/agentmesh/api/task_api.py +42 -0
- agentmesh_sdk-0.1.6/agentmesh/api/websocket_api.py +143 -0
- agentmesh_sdk-0.1.6/agentmesh/common/__init__.py +7 -0
- agentmesh_sdk-0.1.6/agentmesh/common/config/config_manager.py +17 -0
- agentmesh_sdk-0.1.6/agentmesh/common/database.py +73 -0
- agentmesh_sdk-0.1.6/agentmesh/common/enums/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/common/enums/model_enums.py +57 -0
- agentmesh_sdk-0.1.6/agentmesh/common/init_data.py +65 -0
- agentmesh_sdk-0.1.6/agentmesh/common/models.py +101 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/__init__.py +7 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/config_util.py +0 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/loading_indicator.py +88 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/log.py +209 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/string_util.py +16 -0
- agentmesh_sdk-0.1.6/agentmesh/common/utils/xml_util.py +346 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/__init__.py +10 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/chunker.py +139 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/config.py +111 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/embedding.py +175 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/manager.py +623 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/storage.py +424 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/summarizer.py +235 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/tools/__init__.py +10 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/tools/memory_get.py +112 -0
- agentmesh_sdk-0.1.6/agentmesh/memory/tools/memory_search.py +100 -0
- agentmesh_sdk-0.1.6/agentmesh/models/__init__.py +6 -0
- agentmesh_sdk-0.1.6/agentmesh/models/llm/__init__.py +6 -0
- agentmesh_sdk-0.1.6/agentmesh/models/llm/base_model.py +230 -0
- agentmesh_sdk-0.1.6/agentmesh/models/llm/claude_model.py +340 -0
- agentmesh_sdk-0.1.6/agentmesh/models/llm/deepseek_model.py +8 -0
- agentmesh_sdk-0.1.6/agentmesh/models/llm/openai_model.py +8 -0
- agentmesh_sdk-0.1.6/agentmesh/models/model_factory.py +75 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/__init__.py +5 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/agent.py +648 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/agent_stream.py +430 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/context.py +27 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/message.py +0 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/result.py +273 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/task.py +95 -0
- agentmesh_sdk-0.1.6/agentmesh/protocol/team.py +519 -0
- agentmesh_sdk-0.1.6/agentmesh/service/__init__.py +1 -0
- agentmesh_sdk-0.1.6/agentmesh/service/agent_executor.py +263 -0
- agentmesh_sdk-0.1.6/agentmesh/service/task_service.py +127 -0
- agentmesh_sdk-0.1.6/agentmesh/service/websocket_service.py +319 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/__init__.py +72 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/base_tool.py +98 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/bash/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/bash/bash.py +184 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/browser/browser_action.py +59 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/browser/browser_tool.py +317 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/browser_tool.py +18 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/calculator/calculator.py +58 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/current_time/current_time.py +75 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/edit/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/edit/edit.py +164 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/file_save/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/file_save/file_save.py +770 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/find/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/find/find.py +177 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/google_search/google_search.py +48 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/grep/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/grep/grep.py +248 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/ls/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/ls/ls.py +125 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/memory/__init__.py +10 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/memory/memory_get.py +112 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/memory/memory_search.py +100 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/read/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/read/read.py +336 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/terminal/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/terminal/terminal.py +100 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/tool_manager.py +209 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/utils/__init__.py +40 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/utils/diff.py +167 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/utils/truncate.py +292 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/write/__init__.py +3 -0
- agentmesh_sdk-0.1.6/agentmesh/tools/write/write.py +91 -0
- agentmesh_sdk-0.1.6/agentmesh_sdk.egg-info/PKG-INFO +260 -0
- agentmesh_sdk-0.1.6/agentmesh_sdk.egg-info/SOURCES.txt +90 -0
- agentmesh_sdk-0.1.6/agentmesh_sdk.egg-info/dependency_links.txt +1 -0
- agentmesh_sdk-0.1.6/agentmesh_sdk.egg-info/requires.txt +11 -0
- agentmesh_sdk-0.1.6/agentmesh_sdk.egg-info/top_level.txt +1 -0
- agentmesh_sdk-0.1.6/requirements.txt +8 -0
- agentmesh_sdk-0.1.6/setup.cfg +4 -0
- agentmesh_sdk-0.1.6/setup.py +36 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
10
|
+
|
|
11
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
12
|
+
|
|
13
|
+
"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.
|
|
14
|
+
|
|
15
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
16
|
+
|
|
17
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
18
|
+
|
|
19
|
+
"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.
|
|
20
|
+
|
|
21
|
+
"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).
|
|
22
|
+
|
|
23
|
+
"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.
|
|
24
|
+
|
|
25
|
+
"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."
|
|
26
|
+
|
|
27
|
+
"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.
|
|
28
|
+
|
|
29
|
+
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.
|
|
30
|
+
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
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:
|
|
34
|
+
|
|
35
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
36
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
37
|
+
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
|
|
38
|
+
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.
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
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.
|
|
42
|
+
|
|
43
|
+
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.
|
|
44
|
+
|
|
45
|
+
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.
|
|
46
|
+
|
|
47
|
+
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.
|
|
48
|
+
|
|
49
|
+
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.
|
|
50
|
+
|
|
51
|
+
END OF TERMS AND CONDITIONS
|
|
52
|
+
|
|
53
|
+
Copyright 2025 Minimal Future
|
|
54
|
+
|
|
55
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
56
|
+
you may not use this file except in compliance with the License.
|
|
57
|
+
You may obtain a copy of the License at
|
|
58
|
+
|
|
59
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
60
|
+
|
|
61
|
+
Unless required by applicable law or agreed to in writing, software
|
|
62
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
63
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
64
|
+
See the License for the specific language governing permissions and
|
|
65
|
+
limitations under the License.
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentmesh-sdk
|
|
3
|
+
Version: 0.1.6
|
|
4
|
+
Summary: An open-source multi-agent framework for building agent teams with LLMs
|
|
5
|
+
Home-page: https://github.com/MinimalFuture/AgentMesh
|
|
6
|
+
Author: Minimal Future
|
|
7
|
+
Author-email: zyj@zhayujie.com
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Requires-Python: >=3.7
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: requests>=2.28.0
|
|
19
|
+
Requires-Dist: urllib3>=1.26.0
|
|
20
|
+
Requires-Dist: pyyaml>=6.0
|
|
21
|
+
Requires-Dist: pydantic
|
|
22
|
+
Requires-Dist: fastapi>=0.100.0
|
|
23
|
+
Requires-Dist: uvicorn[standard]>=0.24.0
|
|
24
|
+
Requires-Dist: websocket-client>=1.4.0
|
|
25
|
+
Requires-Dist: pypdf>=4.0.0
|
|
26
|
+
Provides-Extra: full
|
|
27
|
+
Requires-Dist: browser-use>=0.1.40; extra == "full"
|
|
28
|
+
Dynamic: author
|
|
29
|
+
Dynamic: author-email
|
|
30
|
+
Dynamic: classifier
|
|
31
|
+
Dynamic: description
|
|
32
|
+
Dynamic: description-content-type
|
|
33
|
+
Dynamic: home-page
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
Dynamic: provides-extra
|
|
36
|
+
Dynamic: requires-dist
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
Dynamic: summary
|
|
39
|
+
|
|
40
|
+
<p align="center"><img src= "https://github.com/user-attachments/assets/33d7a875-f64d-422f-8b51-68fb420c81e2" alt="AgentMesh" width="450" /></p>
|
|
41
|
+
|
|
42
|
+
English | <a href="/docs/README-CN.md">中文</a>
|
|
43
|
+
|
|
44
|
+
AgentMesh is a **Multi-Agent platform** for AI agents building, providing a framework for inter-agent communication,
|
|
45
|
+
task planning, and autonomous decision-making. Build your agent team quickly and solve complex tasks through agent
|
|
46
|
+
collaboration.
|
|
47
|
+
|
|
48
|
+
## Overview
|
|
49
|
+
|
|
50
|
+
AgentMesh uses a modular layered design for flexible and extensible multi-agent systems:
|
|
51
|
+
|
|
52
|
+
<img width="700" alt="agentmesh-architecture-diagram" src="https://github.com/user-attachments/assets/81c78d9f-876b-43b8-a94e-117474b9efc5" />
|
|
53
|
+
|
|
54
|
+
- **Agent Collaboration**: Support for role definition, task allocation, and multi-turn autonomous decision-making.
|
|
55
|
+
Communication protocol for remote heterogeneous agents coming soon.
|
|
56
|
+
- **Multi-Modal Models**: Seamless integration with OpenAI, Claude, DeepSeek, and other leading LLMs through a unified
|
|
57
|
+
API.
|
|
58
|
+
- **Extensible Tools**: Built-in search engines, browser automation, file system access, and terminal tools. MCP
|
|
59
|
+
protocol support coming soon for even more tool extensions.
|
|
60
|
+
- **Multi-Platform**: Run via CLI, Docker, or SDK. WebUI and integration with common software coming soon.
|
|
61
|
+
|
|
62
|
+
## Demo
|
|
63
|
+
|
|
64
|
+
https://github.com/user-attachments/assets/a0e565c4-94ef-4ddf-843d-a0c5aab640c6
|
|
65
|
+
|
|
66
|
+
## Quick Start
|
|
67
|
+
|
|
68
|
+
Choose one of these three ways to build and run your agent team:
|
|
69
|
+
|
|
70
|
+
### 1. Terminal
|
|
71
|
+
|
|
72
|
+
Run a multi-agent team from your command line:
|
|
73
|
+
|
|
74
|
+
#### 1.1 Installation
|
|
75
|
+
|
|
76
|
+
**Requirements:** Linux, MacOS, or Windows with Python installed.
|
|
77
|
+
|
|
78
|
+
> Python 3.11+ recommended (especially for browser tools), at least python 3.7+ required.
|
|
79
|
+
> Download from: [Python.org](https://www.python.org/downloads/).
|
|
80
|
+
|
|
81
|
+
Clone the repo and navigate to the project:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
git clone https://github.com/MinimalFuture/AgentMesh
|
|
85
|
+
cd AgentMesh
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Install core dependencies:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
pip install -r requirements.txt
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
For browser tools, install additional dependencies (python3.11+ required):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
pip install browser-use==0.1.40
|
|
98
|
+
playwright install
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### 1.2 Configuration
|
|
102
|
+
|
|
103
|
+
Edit the `config.yaml` file with your model settings and agent configurations:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
cp config-template.yaml config.yaml
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Add your model `api_key` - AgentMesh supports `openai`, `claude`, `deepseek`, `qwen`, and others.
|
|
110
|
+
|
|
111
|
+
> The template includes two examples:
|
|
112
|
+
> - `general_team`: A general-purpose agent for search and research tasks.
|
|
113
|
+
> - `software_team`: A development team with three roles that collaborates on web applications.
|
|
114
|
+
>
|
|
115
|
+
> You can add your own custom teams, and customize models, tools, and system prompts for each agent.
|
|
116
|
+
|
|
117
|
+
#### 1.3 Execution
|
|
118
|
+
|
|
119
|
+
You can run tasks directly using command-line arguments, specifying the team with `-t` and your question with `-q`:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python main.py -t general_team -q "analyze the trends in multi-agent technology"
|
|
123
|
+
python main.py -t software_team -q "develop a simple trial booking page for AgentMesh multi-agent platform"
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Alternatively, enter interactive mode for multi-turn conversations:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python main.py -l # List available agent teams
|
|
130
|
+
python main.py -t software_team # Run the 'software_team'
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 2. Docker
|
|
134
|
+
|
|
135
|
+
Download the docker-compose configuration file:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
curl -O https://raw.githubusercontent.com/MinimalFuture/AgentMesh/main/docker-compose.yml
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Download the configuration template and add your model API keys (see section 1.2 for configuration details):
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
curl -o config.yaml https://raw.githubusercontent.com/MinimalFuture/AgentMesh/main/config-template.yaml
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Run the Docker container:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
docker-compose run --rm agentmesh bash
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Once the container starts, you'll enter the command line. The usage is the same as in section 1.3 - specify a team to
|
|
154
|
+
start the interactive mode:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
python main.py -l # List available agent teams
|
|
158
|
+
python main.py -t general_team # Start multi-turn conversation with the specified team
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 3. SDK
|
|
162
|
+
|
|
163
|
+
Use the AgentMesh SDK to build custom agent teams programmatically:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
pip install agentmesh-sdk
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
#### 3.1 Single Agent
|
|
170
|
+
|
|
171
|
+
Run a single super-agent directly without a team, with multi-turn conversation support:
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
from agentmesh import Agent, LLMModel
|
|
175
|
+
from agentmesh.tools import *
|
|
176
|
+
|
|
177
|
+
# Initialize model
|
|
178
|
+
model = LLMModel(model="gpt-4.1", api_key="YOUR_API_KEY")
|
|
179
|
+
|
|
180
|
+
# Create a single agent with tools
|
|
181
|
+
agent = Agent(
|
|
182
|
+
name="Assistant",
|
|
183
|
+
description="A versatile assistant",
|
|
184
|
+
system_prompt="You are a helpful assistant who answers questions using available tools.",
|
|
185
|
+
model=model,
|
|
186
|
+
tools=[GoogleSearch(), Calculator()]
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
# Single-turn call
|
|
190
|
+
response = agent.run_stream("What are the latest trends in multi-agent AI?")
|
|
191
|
+
|
|
192
|
+
# Multi-turn conversation (history is retained automatically)
|
|
193
|
+
agent.run_stream("My project is named AgentMesh")
|
|
194
|
+
agent.run_stream("Write a brief intro for my project") # Remembers the project name
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### 3.2 Agent Team
|
|
198
|
+
|
|
199
|
+
Build a multi-agent team where agents collaborate on complex tasks (replace `YOUR_API_KEY` with your actual API key):
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from agentmesh import AgentTeam, Agent, LLMModel
|
|
203
|
+
from agentmesh.tools import *
|
|
204
|
+
|
|
205
|
+
# Initialize model
|
|
206
|
+
model = LLMModel(model="gpt-4.1", api_key="YOUR_API_KEY")
|
|
207
|
+
|
|
208
|
+
# Create team and add agents
|
|
209
|
+
team = AgentTeam(name="software_team", description="A software development team", model=model)
|
|
210
|
+
|
|
211
|
+
team.add(Agent(name="PM", description="Handles product requirements",
|
|
212
|
+
system_prompt="You are an experienced PM who creates clear, comprehensive PRDs"))
|
|
213
|
+
|
|
214
|
+
team.add(Agent(name="Developer", description="Implements code based on requirements", model=model,
|
|
215
|
+
system_prompt="You write clean, efficient, maintainable code following requirements precisely",
|
|
216
|
+
tools=[Calculator(), GoogleSearch()]))
|
|
217
|
+
|
|
218
|
+
# Execute task
|
|
219
|
+
result = team.run(task="Write a Snake client game")
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### 4. Web Service
|
|
223
|
+
|
|
224
|
+
Coming soon
|
|
225
|
+
|
|
226
|
+
## Components
|
|
227
|
+
|
|
228
|
+
### Core Concepts
|
|
229
|
+
|
|
230
|
+
- **Agent**: Autonomous decision-making unit with specific roles and capabilities, configurable with models, system
|
|
231
|
+
prompts, tools, and decision logic.
|
|
232
|
+
- **AgentTeam**: Team of agents responsible for task allocation, context management, and collaboration workflow.
|
|
233
|
+
- **Tool**: Functional modules that extend agent capabilities, such as calculators, search engines, and browsers.
|
|
234
|
+
- **Task**: User input problems or requirements, which can include text, images, and other multi-modal content.
|
|
235
|
+
- **Context**: Shared information including team details, task content, and execution history.
|
|
236
|
+
- **LLMModel**: Large language model interface supporting various mainstream LLMs through a unified API.
|
|
237
|
+
|
|
238
|
+
### Supported Models
|
|
239
|
+
|
|
240
|
+
- **OpenAI**: GPT series models, recommended: `gpt-4.1`, `gpt-4o`, `gpt-4.1-mini`
|
|
241
|
+
- **Claude**: Claude series models, recommended: `claude-sonnet-4-0`, `claude-3-7-sonnet-latest`
|
|
242
|
+
- **DeepSeek**: DeepSeek series models, recommended: `deepseek-chat`
|
|
243
|
+
- **Ollama**: Local open-source models (coming soon)
|
|
244
|
+
|
|
245
|
+
### Built-in Tools
|
|
246
|
+
|
|
247
|
+
- **calculator**: Mathematical calculation tool supporting complex expression evaluation
|
|
248
|
+
- **current_time**: Current time retrieval tool solving model time awareness issues
|
|
249
|
+
- **browser**: Web browsing tool based on browser-use, supporting web access, content extraction, and interaction
|
|
250
|
+
- **google_search**: Search engine tool for retrieving up-to-date information
|
|
251
|
+
- **file_save**: Tool for saving agent outputs to the local workspace
|
|
252
|
+
- **terminal**: Command-line tool for executing system commands safely with security restrictions
|
|
253
|
+
- **MCP**: Extended tool capabilities through MCP protocol support (coming soon)
|
|
254
|
+
|
|
255
|
+
## Contribution
|
|
256
|
+
|
|
257
|
+
⭐️ Star this project to receive notifications about updates.
|
|
258
|
+
|
|
259
|
+
Feel free to [submit PRs](https://github.com/MinimalFuture/AgentMesh/pulls) to contribute to this project.
|
|
260
|
+
For issues or ideas, please [open an issue](https://github.com/MinimalFuture/AgentMesh/issues).
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<p align="center"><img src= "https://github.com/user-attachments/assets/33d7a875-f64d-422f-8b51-68fb420c81e2" alt="AgentMesh" width="450" /></p>
|
|
2
|
+
|
|
3
|
+
English | <a href="/docs/README-CN.md">中文</a>
|
|
4
|
+
|
|
5
|
+
AgentMesh is a **Multi-Agent platform** for AI agents building, providing a framework for inter-agent communication,
|
|
6
|
+
task planning, and autonomous decision-making. Build your agent team quickly and solve complex tasks through agent
|
|
7
|
+
collaboration.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
AgentMesh uses a modular layered design for flexible and extensible multi-agent systems:
|
|
12
|
+
|
|
13
|
+
<img width="700" alt="agentmesh-architecture-diagram" src="https://github.com/user-attachments/assets/81c78d9f-876b-43b8-a94e-117474b9efc5" />
|
|
14
|
+
|
|
15
|
+
- **Agent Collaboration**: Support for role definition, task allocation, and multi-turn autonomous decision-making.
|
|
16
|
+
Communication protocol for remote heterogeneous agents coming soon.
|
|
17
|
+
- **Multi-Modal Models**: Seamless integration with OpenAI, Claude, DeepSeek, and other leading LLMs through a unified
|
|
18
|
+
API.
|
|
19
|
+
- **Extensible Tools**: Built-in search engines, browser automation, file system access, and terminal tools. MCP
|
|
20
|
+
protocol support coming soon for even more tool extensions.
|
|
21
|
+
- **Multi-Platform**: Run via CLI, Docker, or SDK. WebUI and integration with common software coming soon.
|
|
22
|
+
|
|
23
|
+
## Demo
|
|
24
|
+
|
|
25
|
+
https://github.com/user-attachments/assets/a0e565c4-94ef-4ddf-843d-a0c5aab640c6
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
Choose one of these three ways to build and run your agent team:
|
|
30
|
+
|
|
31
|
+
### 1. Terminal
|
|
32
|
+
|
|
33
|
+
Run a multi-agent team from your command line:
|
|
34
|
+
|
|
35
|
+
#### 1.1 Installation
|
|
36
|
+
|
|
37
|
+
**Requirements:** Linux, MacOS, or Windows with Python installed.
|
|
38
|
+
|
|
39
|
+
> Python 3.11+ recommended (especially for browser tools), at least python 3.7+ required.
|
|
40
|
+
> Download from: [Python.org](https://www.python.org/downloads/).
|
|
41
|
+
|
|
42
|
+
Clone the repo and navigate to the project:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/MinimalFuture/AgentMesh
|
|
46
|
+
cd AgentMesh
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Install core dependencies:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install -r requirements.txt
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For browser tools, install additional dependencies (python3.11+ required):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install browser-use==0.1.40
|
|
59
|
+
playwright install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
#### 1.2 Configuration
|
|
63
|
+
|
|
64
|
+
Edit the `config.yaml` file with your model settings and agent configurations:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cp config-template.yaml config.yaml
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Add your model `api_key` - AgentMesh supports `openai`, `claude`, `deepseek`, `qwen`, and others.
|
|
71
|
+
|
|
72
|
+
> The template includes two examples:
|
|
73
|
+
> - `general_team`: A general-purpose agent for search and research tasks.
|
|
74
|
+
> - `software_team`: A development team with three roles that collaborates on web applications.
|
|
75
|
+
>
|
|
76
|
+
> You can add your own custom teams, and customize models, tools, and system prompts for each agent.
|
|
77
|
+
|
|
78
|
+
#### 1.3 Execution
|
|
79
|
+
|
|
80
|
+
You can run tasks directly using command-line arguments, specifying the team with `-t` and your question with `-q`:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python main.py -t general_team -q "analyze the trends in multi-agent technology"
|
|
84
|
+
python main.py -t software_team -q "develop a simple trial booking page for AgentMesh multi-agent platform"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Alternatively, enter interactive mode for multi-turn conversations:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python main.py -l # List available agent teams
|
|
91
|
+
python main.py -t software_team # Run the 'software_team'
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 2. Docker
|
|
95
|
+
|
|
96
|
+
Download the docker-compose configuration file:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
curl -O https://raw.githubusercontent.com/MinimalFuture/AgentMesh/main/docker-compose.yml
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Download the configuration template and add your model API keys (see section 1.2 for configuration details):
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
curl -o config.yaml https://raw.githubusercontent.com/MinimalFuture/AgentMesh/main/config-template.yaml
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Run the Docker container:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
docker-compose run --rm agentmesh bash
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Once the container starts, you'll enter the command line. The usage is the same as in section 1.3 - specify a team to
|
|
115
|
+
start the interactive mode:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
python main.py -l # List available agent teams
|
|
119
|
+
python main.py -t general_team # Start multi-turn conversation with the specified team
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 3. SDK
|
|
123
|
+
|
|
124
|
+
Use the AgentMesh SDK to build custom agent teams programmatically:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
pip install agentmesh-sdk
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### 3.1 Single Agent
|
|
131
|
+
|
|
132
|
+
Run a single super-agent directly without a team, with multi-turn conversation support:
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from agentmesh import Agent, LLMModel
|
|
136
|
+
from agentmesh.tools import *
|
|
137
|
+
|
|
138
|
+
# Initialize model
|
|
139
|
+
model = LLMModel(model="gpt-4.1", api_key="YOUR_API_KEY")
|
|
140
|
+
|
|
141
|
+
# Create a single agent with tools
|
|
142
|
+
agent = Agent(
|
|
143
|
+
name="Assistant",
|
|
144
|
+
description="A versatile assistant",
|
|
145
|
+
system_prompt="You are a helpful assistant who answers questions using available tools.",
|
|
146
|
+
model=model,
|
|
147
|
+
tools=[GoogleSearch(), Calculator()]
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
# Single-turn call
|
|
151
|
+
response = agent.run_stream("What are the latest trends in multi-agent AI?")
|
|
152
|
+
|
|
153
|
+
# Multi-turn conversation (history is retained automatically)
|
|
154
|
+
agent.run_stream("My project is named AgentMesh")
|
|
155
|
+
agent.run_stream("Write a brief intro for my project") # Remembers the project name
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### 3.2 Agent Team
|
|
159
|
+
|
|
160
|
+
Build a multi-agent team where agents collaborate on complex tasks (replace `YOUR_API_KEY` with your actual API key):
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from agentmesh import AgentTeam, Agent, LLMModel
|
|
164
|
+
from agentmesh.tools import *
|
|
165
|
+
|
|
166
|
+
# Initialize model
|
|
167
|
+
model = LLMModel(model="gpt-4.1", api_key="YOUR_API_KEY")
|
|
168
|
+
|
|
169
|
+
# Create team and add agents
|
|
170
|
+
team = AgentTeam(name="software_team", description="A software development team", model=model)
|
|
171
|
+
|
|
172
|
+
team.add(Agent(name="PM", description="Handles product requirements",
|
|
173
|
+
system_prompt="You are an experienced PM who creates clear, comprehensive PRDs"))
|
|
174
|
+
|
|
175
|
+
team.add(Agent(name="Developer", description="Implements code based on requirements", model=model,
|
|
176
|
+
system_prompt="You write clean, efficient, maintainable code following requirements precisely",
|
|
177
|
+
tools=[Calculator(), GoogleSearch()]))
|
|
178
|
+
|
|
179
|
+
# Execute task
|
|
180
|
+
result = team.run(task="Write a Snake client game")
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### 4. Web Service
|
|
184
|
+
|
|
185
|
+
Coming soon
|
|
186
|
+
|
|
187
|
+
## Components
|
|
188
|
+
|
|
189
|
+
### Core Concepts
|
|
190
|
+
|
|
191
|
+
- **Agent**: Autonomous decision-making unit with specific roles and capabilities, configurable with models, system
|
|
192
|
+
prompts, tools, and decision logic.
|
|
193
|
+
- **AgentTeam**: Team of agents responsible for task allocation, context management, and collaboration workflow.
|
|
194
|
+
- **Tool**: Functional modules that extend agent capabilities, such as calculators, search engines, and browsers.
|
|
195
|
+
- **Task**: User input problems or requirements, which can include text, images, and other multi-modal content.
|
|
196
|
+
- **Context**: Shared information including team details, task content, and execution history.
|
|
197
|
+
- **LLMModel**: Large language model interface supporting various mainstream LLMs through a unified API.
|
|
198
|
+
|
|
199
|
+
### Supported Models
|
|
200
|
+
|
|
201
|
+
- **OpenAI**: GPT series models, recommended: `gpt-4.1`, `gpt-4o`, `gpt-4.1-mini`
|
|
202
|
+
- **Claude**: Claude series models, recommended: `claude-sonnet-4-0`, `claude-3-7-sonnet-latest`
|
|
203
|
+
- **DeepSeek**: DeepSeek series models, recommended: `deepseek-chat`
|
|
204
|
+
- **Ollama**: Local open-source models (coming soon)
|
|
205
|
+
|
|
206
|
+
### Built-in Tools
|
|
207
|
+
|
|
208
|
+
- **calculator**: Mathematical calculation tool supporting complex expression evaluation
|
|
209
|
+
- **current_time**: Current time retrieval tool solving model time awareness issues
|
|
210
|
+
- **browser**: Web browsing tool based on browser-use, supporting web access, content extraction, and interaction
|
|
211
|
+
- **google_search**: Search engine tool for retrieving up-to-date information
|
|
212
|
+
- **file_save**: Tool for saving agent outputs to the local workspace
|
|
213
|
+
- **terminal**: Command-line tool for executing system commands safely with security restrictions
|
|
214
|
+
- **MCP**: Extended tool capabilities through MCP protocol support (coming soon)
|
|
215
|
+
|
|
216
|
+
## Contribution
|
|
217
|
+
|
|
218
|
+
⭐️ Star this project to receive notifications about updates.
|
|
219
|
+
|
|
220
|
+
Feel free to [submit PRs](https://github.com/MinimalFuture/AgentMesh/pulls) to contribute to this project.
|
|
221
|
+
For issues or ideas, please [open an issue](https://github.com/MinimalFuture/AgentMesh/issues).
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# First, set environment variables before any imports
|
|
2
|
+
import os
|
|
3
|
+
|
|
4
|
+
os.environ["BROWSER_USE_LOGGING_LEVEL"] = "error"
|
|
5
|
+
|
|
6
|
+
# Then import logging and configure it
|
|
7
|
+
import logging
|
|
8
|
+
|
|
9
|
+
logging.getLogger("browser_use").setLevel(logging.ERROR)
|
|
10
|
+
logging.getLogger("root").setLevel(logging.ERROR)
|
|
11
|
+
|
|
12
|
+
# Now import the rest
|
|
13
|
+
from agentmesh.protocol import Agent, AgentTeam
|
|
14
|
+
from agentmesh.protocol.task import Task
|
|
15
|
+
from agentmesh.protocol.result import TeamResult
|
|
16
|
+
from agentmesh.models import LLMModel
|
|
17
|
+
from agentmesh.common.utils.log import setup_logging
|
|
18
|
+
|
|
19
|
+
# Setup logging when the package is imported
|
|
20
|
+
setup_logging()
|
|
21
|
+
|
|
22
|
+
__all__ = ['AgentTeam', 'Agent', 'LLMModel', 'Task', 'TeamResult', 'set_workspace', 'get_workspace']
|
|
23
|
+
|
|
24
|
+
# Global workspace configuration
|
|
25
|
+
_global_workspace_root = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def set_workspace(workspace_root: str):
|
|
29
|
+
"""
|
|
30
|
+
Set global workspace root for all agents
|
|
31
|
+
|
|
32
|
+
This should be called once at the start of your application.
|
|
33
|
+
All agents will use this workspace unless overridden.
|
|
34
|
+
|
|
35
|
+
Args:
|
|
36
|
+
workspace_root: Path to workspace root (e.g., "~/my_agents")
|
|
37
|
+
|
|
38
|
+
Example:
|
|
39
|
+
>>> import agentmesh
|
|
40
|
+
>>> agentmesh.set_workspace("~/my_agents")
|
|
41
|
+
>>> # Now all agents will use ~/my_agents as workspace root
|
|
42
|
+
"""
|
|
43
|
+
global _global_workspace_root
|
|
44
|
+
_global_workspace_root = os.path.expanduser(workspace_root)
|
|
45
|
+
|
|
46
|
+
# Also update memory config
|
|
47
|
+
from agentmesh.memory import MemoryConfig, set_global_memory_config
|
|
48
|
+
config = MemoryConfig(workspace_root=_global_workspace_root)
|
|
49
|
+
set_global_memory_config(config)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def get_workspace() -> str:
|
|
53
|
+
"""
|
|
54
|
+
Get current global workspace root
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
Current workspace root path, or default "~/agentmesh"
|
|
58
|
+
"""
|
|
59
|
+
global _global_workspace_root
|
|
60
|
+
if _global_workspace_root is None:
|
|
61
|
+
return os.path.expanduser("~/agentmesh")
|
|
62
|
+
return _global_workspace_root
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# API package initialization
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from fastapi import FastAPI
|
|
2
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
3
|
+
from fastapi.responses import JSONResponse
|
|
4
|
+
|
|
5
|
+
from .task_api import router as task_router
|
|
6
|
+
from .websocket_api import router as websocket_router
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def create_app() -> FastAPI:
|
|
10
|
+
"""Create and configure FastAPI application"""
|
|
11
|
+
|
|
12
|
+
app = FastAPI(
|
|
13
|
+
title="AgentMesh API",
|
|
14
|
+
description="Multi-agent system API for task management",
|
|
15
|
+
version="1.0.0",
|
|
16
|
+
docs_url="/docs",
|
|
17
|
+
redoc_url="/redoc"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Add CORS middleware
|
|
21
|
+
app.add_middleware(
|
|
22
|
+
CORSMiddleware,
|
|
23
|
+
allow_origins=["*"], # Configure this properly for production
|
|
24
|
+
allow_credentials=True,
|
|
25
|
+
allow_methods=["*"],
|
|
26
|
+
allow_headers=["*"],
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
# Include routers
|
|
30
|
+
app.include_router(task_router)
|
|
31
|
+
app.include_router(websocket_router)
|
|
32
|
+
|
|
33
|
+
# Global exception handler
|
|
34
|
+
@app.exception_handler(Exception)
|
|
35
|
+
async def global_exception_handler(request, exc):
|
|
36
|
+
return JSONResponse(
|
|
37
|
+
status_code=500,
|
|
38
|
+
content={
|
|
39
|
+
"code": 500,
|
|
40
|
+
"message": "Internal server error",
|
|
41
|
+
"data": None
|
|
42
|
+
}
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
return app
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
# Create app instance
|
|
49
|
+
app = create_app()
|