matrix-for-agents 0.1.5__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.
Files changed (83) hide show
  1. matrix_for_agents-0.1.5/LICENSE +190 -0
  2. matrix_for_agents-0.1.5/MANIFEST.in +68 -0
  3. matrix_for_agents-0.1.5/PKG-INFO +346 -0
  4. matrix_for_agents-0.1.5/pyproject.toml +67 -0
  5. matrix_for_agents-0.1.5/readme.md +301 -0
  6. matrix_for_agents-0.1.5/requirements.txt +17 -0
  7. matrix_for_agents-0.1.5/setup.cfg +4 -0
  8. matrix_for_agents-0.1.5/src/agentmatrix/__init__.py +20 -0
  9. matrix_for_agents-0.1.5/src/agentmatrix/agents/__init__.py +1 -0
  10. matrix_for_agents-0.1.5/src/agentmatrix/agents/base.py +683 -0
  11. matrix_for_agents-0.1.5/src/agentmatrix/agents/claude_coder.py +10 -0
  12. matrix_for_agents-0.1.5/src/agentmatrix/agents/data_crawler.py +14 -0
  13. matrix_for_agents-0.1.5/src/agentmatrix/agents/micro_agent.py +379 -0
  14. matrix_for_agents-0.1.5/src/agentmatrix/agents/post_office.py +240 -0
  15. matrix_for_agents-0.1.5/src/agentmatrix/agents/report_writer.py +14 -0
  16. matrix_for_agents-0.1.5/src/agentmatrix/agents/secretary.py +10 -0
  17. matrix_for_agents-0.1.5/src/agentmatrix/agents/stateful.py +10 -0
  18. matrix_for_agents-0.1.5/src/agentmatrix/agents/user_proxy.py +77 -0
  19. matrix_for_agents-0.1.5/src/agentmatrix/agents/worker.py +30 -0
  20. matrix_for_agents-0.1.5/src/agentmatrix/backends/__init__.py +1 -0
  21. matrix_for_agents-0.1.5/src/agentmatrix/backends/llm_client.py +337 -0
  22. matrix_for_agents-0.1.5/src/agentmatrix/backends/mock_llm.py +35 -0
  23. matrix_for_agents-0.1.5/src/agentmatrix/cli_runner.py +125 -0
  24. matrix_for_agents-0.1.5/src/agentmatrix/core/__init__.py +0 -0
  25. matrix_for_agents-0.1.5/src/agentmatrix/core/action.py +50 -0
  26. matrix_for_agents-0.1.5/src/agentmatrix/core/browser/bing.py +208 -0
  27. matrix_for_agents-0.1.5/src/agentmatrix/core/browser/browser_adapter.py +298 -0
  28. matrix_for_agents-0.1.5/src/agentmatrix/core/browser/browser_common.py +125 -0
  29. matrix_for_agents-0.1.5/src/agentmatrix/core/browser/drission_page_adapter.py +1318 -0
  30. matrix_for_agents-0.1.5/src/agentmatrix/core/browser/google.py +227 -0
  31. matrix_for_agents-0.1.5/src/agentmatrix/core/cerebellum.py +195 -0
  32. matrix_for_agents-0.1.5/src/agentmatrix/core/events.py +22 -0
  33. matrix_for_agents-0.1.5/src/agentmatrix/core/loader.py +187 -0
  34. matrix_for_agents-0.1.5/src/agentmatrix/core/loader_v1.py +146 -0
  35. matrix_for_agents-0.1.5/src/agentmatrix/core/log_util.py +158 -0
  36. matrix_for_agents-0.1.5/src/agentmatrix/core/message.py +32 -0
  37. matrix_for_agents-0.1.5/src/agentmatrix/core/prompt_engine.py +30 -0
  38. matrix_for_agents-0.1.5/src/agentmatrix/core/runtime.py +218 -0
  39. matrix_for_agents-0.1.5/src/agentmatrix/core/session.py +20 -0
  40. matrix_for_agents-0.1.5/src/agentmatrix/db/__init__.py +1 -0
  41. matrix_for_agents-0.1.5/src/agentmatrix/db/database.py +96 -0
  42. matrix_for_agents-0.1.5/src/agentmatrix/db/vector_db.py +213 -0
  43. matrix_for_agents-0.1.5/src/agentmatrix/profiles/claude_coder.yml +40 -0
  44. matrix_for_agents-0.1.5/src/agentmatrix/profiles/mark.yml +26 -0
  45. matrix_for_agents-0.1.5/src/agentmatrix/profiles/planner.yml +21 -0
  46. matrix_for_agents-0.1.5/src/agentmatrix/profiles/prompts/base.txt +81 -0
  47. matrix_for_agents-0.1.5/src/agentmatrix/profiles/prompts/base_v1.txt +101 -0
  48. matrix_for_agents-0.1.5/src/agentmatrix/profiles/prompts/base_v2.txt +94 -0
  49. matrix_for_agents-0.1.5/src/agentmatrix/profiles/tom_the_data_crawler.yml +38 -0
  50. matrix_for_agents-0.1.5/src/agentmatrix/profiles/user_proxy.yml +17 -0
  51. matrix_for_agents-0.1.5/src/agentmatrix/skills/__init__.py +1 -0
  52. matrix_for_agents-0.1.5/src/agentmatrix/skills/crawler_helpers.py +607 -0
  53. matrix_for_agents-0.1.5/src/agentmatrix/skills/data_crawler.py +777 -0
  54. matrix_for_agents-0.1.5/src/agentmatrix/skills/deep_researcher.py +687 -0
  55. matrix_for_agents-0.1.5/src/agentmatrix/skills/deep_researcher_helper.py +636 -0
  56. matrix_for_agents-0.1.5/src/agentmatrix/skills/filesystem.py +211 -0
  57. matrix_for_agents-0.1.5/src/agentmatrix/skills/markdown_editor.py +332 -0
  58. matrix_for_agents-0.1.5/src/agentmatrix/skills/notebook.py +151 -0
  59. matrix_for_agents-0.1.5/src/agentmatrix/skills/parser_utils.py +185 -0
  60. matrix_for_agents-0.1.5/src/agentmatrix/skills/project_management.py +114 -0
  61. matrix_for_agents-0.1.5/src/agentmatrix/skills/report_writer.py +194 -0
  62. matrix_for_agents-0.1.5/src/agentmatrix/skills/report_writer_utils.py +379 -0
  63. matrix_for_agents-0.1.5/src/agentmatrix/skills/search_results_parser.py +579 -0
  64. matrix_for_agents-0.1.5/src/agentmatrix/skills/search_tool.py +383 -0
  65. matrix_for_agents-0.1.5/src/agentmatrix/skills/skill_helpers.py +124 -0
  66. matrix_for_agents-0.1.5/src/agentmatrix/skills/terminal_ctrl.py +122 -0
  67. matrix_for_agents-0.1.5/src/agentmatrix/skills/utils.py +41 -0
  68. matrix_for_agents-0.1.5/src/agentmatrix/skills/web_searcher.py +1855 -0
  69. matrix_for_agents-0.1.5/src/matrix_for_agents.egg-info/PKG-INFO +346 -0
  70. matrix_for_agents-0.1.5/src/matrix_for_agents.egg-info/SOURCES.txt +81 -0
  71. matrix_for_agents-0.1.5/src/matrix_for_agents.egg-info/dependency_links.txt +1 -0
  72. matrix_for_agents-0.1.5/src/matrix_for_agents.egg-info/requires.txt +23 -0
  73. matrix_for_agents-0.1.5/src/matrix_for_agents.egg-info/top_level.txt +1 -0
  74. matrix_for_agents-0.1.5/tests/test2.py +53 -0
  75. matrix_for_agents-0.1.5/tests/test_batch_parsing.py +105 -0
  76. matrix_for_agents-0.1.5/tests/test_dynamic_finish_task.py +263 -0
  77. matrix_for_agents-0.1.5/tests/test_google_preprocess.py +95 -0
  78. matrix_for_agents-0.1.5/tests/test_markdown_link_manager.py +75 -0
  79. matrix_for_agents-0.1.5/tests/test_search_results_parser.py +157 -0
  80. matrix_for_agents-0.1.5/tests/test_trafilatura_format.py +33 -0
  81. matrix_for_agents-0.1.5/tests/test_trafilatura_format2.py +35 -0
  82. matrix_for_agents-0.1.5/tests/test_trafilatura_params.py +114 -0
  83. matrix_for_agents-0.1.5/tests/test_url_state_fix.py +161 -0
@@ -0,0 +1,190 @@
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,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Agent-Matrix Contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,68 @@
1
+ # Include essential files
2
+ include README.md
3
+ include LICENSE
4
+ include requirements.txt
5
+ include pyproject.toml
6
+
7
+ # Include example scripts
8
+ include src/agentmatrix/cli_runner.py
9
+
10
+ # Include Python source files from src
11
+ recursive-include src/agentmatrix/agents *.py
12
+ recursive-include src/agentmatrix/core *.py
13
+ recursive-include src/agentmatrix/skills *.py
14
+ recursive-include src/agentmatrix/backends *.py
15
+ recursive-include src/agentmatrix/db *.py
16
+
17
+ # Include configuration and documentation files
18
+ recursive-include src/agentmatrix/profiles *.yaml *.yml
19
+ exclude src/agentmatrix/profiles/.env
20
+ recursive-include src/agentmatrix/docs *.md *.txt
21
+
22
+ # Exclude test files and directories
23
+ exclude test/*
24
+ exclude Tests/*
25
+ recursive-exclude test *
26
+ recursive-exclude Tests *
27
+
28
+ # Exclude sample and workspace directories
29
+ exclude Samples/*
30
+ exclude TestWorkspace/*
31
+
32
+ # Exclude database files
33
+ exclude *.db
34
+ exclude agents.db
35
+
36
+ # Exclude environment and configuration files
37
+ exclude .env
38
+ exclude .env.local
39
+ exclude .env.*.local
40
+
41
+ # Exclude log and download directories
42
+ exclude logs/*
43
+ exclude downloads/*
44
+
45
+ # Exclude Python cache
46
+ exclude __pycache__
47
+ recursive-exclude __pycache__ *
48
+ exclude *.pyc
49
+ exclude *.pyo
50
+ exclude *.pyd
51
+
52
+ # Exclude development tools and IDE files
53
+ exclude .vscode/*
54
+ exclude .idea/*
55
+ exclude *.swp
56
+ exclude *.swo
57
+
58
+ # Exclude version control
59
+ exclude .git/*
60
+ exclude .gitignore
61
+
62
+ # Exclude project entry scripts (keep cli_runner.py as example)
63
+ exclude main.py
64
+ exclude server.py
65
+
66
+ # Exclude OS files
67
+ exclude .DS_Store
68
+ exclude Thumbs.db
@@ -0,0 +1,346 @@
1
+ Metadata-Version: 2.4
2
+ Name: matrix-for-agents
3
+ Version: 0.1.5
4
+ Summary: An intelligent agent framework with pluggable skills and LLM integrations
5
+ Author: Agent-Matrix Contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/webdkt/agentmatrix
8
+ Project-URL: Documentation, https://github.com/webdkt/agentmatrix/docs
9
+ Project-URL: Repository, https://github.com/webdkt/agentmatrix
10
+ Project-URL: Issues, https://github.com/webdkt/agentmatrix/issues
11
+ Keywords: agents,ai,llm,framework,multi-agent
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: fastapi>=0.100.0
23
+ Requires-Dist: uvicorn>=0.23.0
24
+ Requires-Dist: websockets>=11.0
25
+ Requires-Dist: pyyaml>=6.0
26
+ Requires-Dist: python-dotenv>=1.0.0
27
+ Requires-Dist: requests>=2.31.0
28
+ Requires-Dist: aioconsole>=0.6.0
29
+ Requires-Dist: aiohttp>=3.8.0
30
+ Requires-Dist: Jinja2>=3.1.0
31
+ Requires-Dist: chromadb>=0.4.0
32
+ Requires-Dist: sentence-transformers>=2.2.0
33
+ Requires-Dist: trafilatura>=1.6.0
34
+ Requires-Dist: DrissionPage>=4.0.0
35
+ Requires-Dist: beautifulsoup4>=4.12.0
36
+ Requires-Dist: marker-pdf==1.8.0
37
+ Requires-Dist: PyMuPDF>=1.23.0
38
+ Requires-Dist: libtmux>=0.52.0
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=7.0; extra == "dev"
41
+ Requires-Dist: black>=23.0; extra == "dev"
42
+ Requires-Dist: flake8>=6.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.0; extra == "dev"
44
+ Dynamic: license-file
45
+
46
+ # AgentMatrix
47
+
48
+ An intelligent multi-agent framework that lets LLMs focus on **reasoning**, not format compliance.
49
+
50
+ [**English**](readme.md) | [**δΈ­ζ–‡ζ–‡ζ‘£**](readme_zh.md)
51
+
52
+ ## 🎯 What is AgentMatrix?
53
+
54
+ AgentMatrix is a multi-agent framework where:
55
+
56
+ - **Agents** act as digital employees with specific skills
57
+ - Agents collaborate through **natural language** (like email), not rigid APIs
58
+ - LLMs can reason naturally without wasting "mental energy" on JSON syntax
59
+
60
+ ## 🧠 Why This Matters?
61
+
62
+ ### The Problem
63
+
64
+ Most agent frameworks force powerful LLMs to think inside rigid formats like JSON. This:
65
+
66
+ - ❌ Wastes LLM attention on syntax instead of reasoning
67
+ - ❌ Causes frequent parsing errors and brittle workflows
68
+ - ❌ Reduces the LLM's ability to handle complex tasks
69
+
70
+ **Our theory**: Asking an LLM to perfectly format JSON while doing complex reasoning is like asking a human to solve calculus problems while juggling. You're adding unnecessary cognitive load.
71
+
72
+ ### Our Solution
73
+
74
+ AgentMatrix uses a **Brain + Cerebellum + Body** architecture:
75
+
76
+ ```
77
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
78
+ β”‚ 🧠 Brain (LLM) β”‚
79
+ β”‚ - Reasons in natural language β”‚
80
+ β”‚ - Decides "what to do" β”‚
81
+ β”‚ - No format constraints β†’ better reasoning β”‚
82
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
83
+ ↓
84
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
85
+ β”‚ 🧠 Cerebellum (SLM) β”‚
86
+ β”‚ - Translates intent to structured data β”‚
87
+ β”‚ - Handles parameter negotiation β”‚
88
+ β”‚ - Clarifies unclear requests β”‚
89
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
90
+ ↓
91
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
92
+ β”‚ πŸ’ͺ Body (Python Code) β”‚
93
+ β”‚ - Executes functions β”‚
94
+ β”‚ - Provides feedback β”‚
95
+ β”‚ - Manages resources β”‚
96
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
97
+ ```
98
+
99
+ **Key Insight**: Let the LLM think in natural language, then use a smaller model to translate that intent into machine-executable commands.
100
+
101
+ ## ✨ Key Features
102
+
103
+ ### 1. Dual-Layer Agent Architecture (v0.1.5+)
104
+
105
+ **BaseAgent = Session Layer**
106
+ - Manages conversation state across multiple user interactions
107
+ - Can maintain multiple independent sessions simultaneously
108
+ - Owns skills, actions, and capabilities
109
+
110
+ **MicroAgent = Execution Layer**
111
+ - Temporary executor for single tasks
112
+ - Inherits BaseAgent's capabilities
113
+ - Has isolated execution context
114
+ - Terminates when task completes
115
+
116
+ **Why This Matters**:
117
+ - βœ… Clear separation of concerns
118
+ - βœ… State isolation (session history β‰  execution steps)
119
+ - βœ… Task failure doesn't break conversations
120
+ - βœ… Supports concurrent multi-session management
121
+
122
+ ### 2. Think-With-Retry Pattern
123
+
124
+ **The Challenge**: Extract structured data from LLM outputs without hurting reasoning quality
125
+
126
+ **Our Solution**:
127
+ - Use **loose format requirements** (e.g., `[Section Name]` instead of strict JSON)
128
+ - **Intelligent retry** with specific, actionable feedback
129
+ - **Conversational flow** - retries feel like natural clarification
130
+
131
+ **Example**:
132
+ ```python
133
+ result = await llm_client.think_with_retry(
134
+ initial_messages="Create a project plan with sections: [Plan], [Timeline], [Budget]",
135
+ parser=multi_section_parser,
136
+ section_headers=['[Plan]', '[Timeline]', '[Budget]'],
137
+ max_retries=3
138
+ )
139
+ ```
140
+
141
+ If the LLM forgets the `[Timeline]` section:
142
+ 1. Parser detects missing section
143
+ 2. System automatically requests: *"Your response was helpful, but missing the [Timeline] section. Please add it."*
144
+ 3. LLM corrects output naturally
145
+ 4. No rigid constraints, just conversational feedback
146
+
147
+ ### 3. Natural Language Coordination
148
+
149
+ Agents communicate through **Email** (natural language messages), not API calls:
150
+
151
+ ```python
152
+ email = Email(
153
+ sender="Researcher",
154
+ recipient="Writer",
155
+ subject="Research Report Request",
156
+ body="Please compile a summary based on the research...",
157
+ user_session_id="session_123"
158
+ )
159
+ await post_office.send_email(email)
160
+ ```
161
+
162
+ **Benefits**:
163
+ - πŸ“ More interpretable and debuggable
164
+ - πŸ”„ Threaded conversations via `in_reply_to`
165
+ - 🀝 Agents explain what they're doing, not just return codes
166
+
167
+ ### 4. Dynamic Skill Composition
168
+
169
+ Skills are **mixins** loaded at runtime via YAML configuration:
170
+
171
+ ```yaml
172
+ # profiles/researcher.yml
173
+ name: Researcher
174
+ description: Research and information gathering specialist
175
+
176
+ mixins:
177
+ - agentmatrix.skills.web_searcher.WebSearcherMixin
178
+ - agentmatrix.skills.crawler_helpers.CrawlerHelpersMixin
179
+ - agentmatrix.skills.notebook.NotebookMixin
180
+ ```
181
+
182
+ **Benefits**:
183
+ - πŸ”§ Composable capabilities
184
+ - πŸ“¦ No code changes to add skills
185
+ - 🎯 Skills can be shared across agents
186
+
187
+ ## πŸš€ Quick Start
188
+
189
+ ### Installation
190
+
191
+ ```bash
192
+ pip install matrix-for-agents
193
+ ```
194
+
195
+ ### Basic Usage
196
+
197
+ ```python
198
+ from agentmatrix import AgentMatrix
199
+
200
+ # Initialize the framework
201
+ matrix = AgentMatrix(
202
+ agent_profile_path="path/to/profiles",
203
+ matrix_path="path/to/matrix"
204
+ )
205
+
206
+ # Start the runtime
207
+ await matrix.run()
208
+ ```
209
+
210
+ ### Sending Tasks to Agents
211
+
212
+ ```python
213
+ # Send an email to an agent
214
+ email = Email(
215
+ sender="user@example.com",
216
+ recipient="Researcher",
217
+ subject="Research Task",
218
+ body="Help me research AI safety best practices",
219
+ user_session_id="my-session"
220
+ )
221
+
222
+ await matrix.post_office.send_email(email)
223
+ ```
224
+
225
+ ## πŸ“š Architecture Overview
226
+
227
+ ### Core Components
228
+
229
+ ```
230
+ AgentMatrix Runtime
231
+ β”œβ”€β”€ PostOffice # Message routing and service discovery
232
+ β”œβ”€β”€ VectorDB # Semantic search for emails/notebooks
233
+ β”œβ”€β”€ AgentLoader # Dynamically loads agents from YAML
234
+ └── Agents
235
+ β”œβ”€β”€ BaseAgent # Session layer - manages conversations
236
+ └── MicroAgent # Execution layer - runs tasks
237
+ ```
238
+
239
+ ### Execution Flow
240
+
241
+ ```
242
+ User sends email
243
+ ↓
244
+ BaseAgent receives email
245
+ ↓
246
+ Restore/creates session
247
+ ↓
248
+ Delegates to MicroAgent
249
+ ↓
250
+ MicroAgent executes:
251
+ 1. Think: What should I do next?
252
+ 2. Detect action from LLM output
253
+ 3. Negotiate parameters (via Cerebellum)
254
+ 4. Execute action
255
+ 5. Repeat until finish_task or max_steps
256
+ ↓
257
+ MicroAgent returns result
258
+ ↓
259
+ BaseAgent updates session
260
+ ↓
261
+ BaseAgent sends reply email
262
+ ```
263
+
264
+ ## πŸ“– Documentation
265
+
266
+ Comprehensive bilingual documentation (English & Chinese):
267
+
268
+ ### Core Architecture
269
+ - **[Agent and Micro Agent Design](docs/agent-and-micro-agent-design.md)**
270
+ - Dual-layer architecture philosophy
271
+ - Session vs. execution separation
272
+ - Skill system and communication
273
+
274
+ - **[Matrix World Architecture](docs/matrix-world.md)**
275
+ - Project structure and components
276
+ - Initialization and runtime flow
277
+ - Configuration format
278
+
279
+ ### Key Patterns
280
+ - **[Think-With-Retry Pattern](docs/think-with-retry-pattern.md)**
281
+ - Natural language β†’ structured data
282
+ - Parser design and implementation
283
+ - Custom parser creation guide
284
+
285
+ ## πŸ› οΈ Built-in Skills
286
+
287
+ - **Filesystem** - File operations and directory management
288
+ - **WebSearcher** - Web search with multiple search engines
289
+ - **CrawlerHelpers** - Web scraping and content extraction
290
+ - **Notebook** - Notebook creation and management
291
+ - **ProjectManagement** - Project planning and task breakdown
292
+
293
+ ## πŸ§ͺ Example: Creating a Custom Agent
294
+
295
+ ```yaml
296
+ # profiles/my-agent.yml
297
+ name: MyAgent
298
+ description: A custom agent for my use case
299
+ module: agentmatrix.agents.base
300
+ class_name: BaseAgent
301
+
302
+ # Load required skills
303
+ mixins:
304
+ - agentmatrix.skills.filesystem.FileSkillMixin
305
+ - agentmatrix.skills.web_searcher.WebSearcherMixin
306
+
307
+ # Define the agent's persona
308
+ system_prompt: |
309
+ You are a helpful assistant specializing in
310
+ research and analysis.
311
+
312
+ # Configure backends
313
+ backend_model: gpt-4
314
+ cerebellum_model: gpt-3.5-turbo
315
+ ```
316
+
317
+ ## 🀝 Contributing
318
+
319
+ Contributions welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
320
+
321
+ ## πŸ“ License
322
+
323
+ Apache License 2.0 - see [LICENSE](LICENSE) file for details
324
+
325
+ ## πŸ™ Acknowledgments
326
+
327
+ Built with:
328
+ - [FastAPI](https://fastapi.tiangolo.com/) - API framework
329
+ - [DrissionPage](https://drissionpage.cn/) - Browser automation
330
+ - [ChromaDB](https://www.trychroma.com/) - Vector database
331
+
332
+ ## πŸ“… Roadmap
333
+
334
+ - [ ] Enhanced multi-agent collaboration patterns
335
+ - [ ] More built-in skills
336
+ - [ ] Performance optimizations
337
+ - [ ] Additional backend integrations
338
+ - [ ] Enhanced monitoring and debugging tools
339
+
340
+ ---
341
+
342
+ **Current Version**: v0.1.5
343
+ **Status**: Alpha (APIs may evolve)
344
+ **Documentation**: [docs/](docs/) | [δΈ­ζ–‡ζ–‡ζ‘£](readme_zh.md)
345
+
346
+ For detailed information, visit: https://github.com/webdkt/agentmatrix
@@ -0,0 +1,67 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "matrix-for-agents"
7
+ version = "0.1.5"
8
+ description = "An intelligent agent framework with pluggable skills and LLM integrations"
9
+ readme = "readme.md"
10
+ requires-python = ">=3.12"
11
+ license = {text = "Apache-2.0"}
12
+ authors = [
13
+ {name = "Agent-Matrix Contributors"}
14
+ ]
15
+ keywords = ["agents", "ai", "llm", "framework", "multi-agent"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ ]
25
+
26
+ dependencies = [
27
+ "fastapi>=0.100.0",
28
+ "uvicorn>=0.23.0",
29
+ "websockets>=11.0",
30
+ "pyyaml>=6.0",
31
+ "python-dotenv>=1.0.0",
32
+ "requests>=2.31.0",
33
+ "aioconsole>=0.6.0",
34
+ "aiohttp>=3.8.0",
35
+ "Jinja2>=3.1.0",
36
+ "chromadb>=0.4.0",
37
+ "sentence-transformers>=2.2.0",
38
+ "trafilatura>=1.6.0",
39
+ "DrissionPage>=4.0.0",
40
+ "beautifulsoup4>=4.12.0",
41
+ "marker-pdf==1.8.0",
42
+ "PyMuPDF>=1.23.0",
43
+ "libtmux>=0.52.0",
44
+ ]
45
+
46
+ [project.optional-dependencies]
47
+ dev = [
48
+ "pytest>=7.0",
49
+ "black>=23.0",
50
+ "flake8>=6.0",
51
+ "mypy>=1.0",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/webdkt/agentmatrix"
56
+ Documentation = "https://github.com/webdkt/agentmatrix/docs"
57
+ Repository = "https://github.com/webdkt/agentmatrix"
58
+ Issues = "https://github.com/webdkt/agentmatrix/issues"
59
+
60
+ [tool.setuptools]
61
+ package-dir = {"" = "src"}
62
+
63
+ [tool.setuptools.package-data]
64
+ "*" = ["*.yaml", "*.yml", "*.md", "*.txt"]
65
+
66
+ [tool.setuptools.exclude-package-data]
67
+ "*" = ["*.db", ".env", "*.log"]