commamatrix 0.1.0__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 (127) hide show
  1. commamatrix-0.1.0/.gitignore +172 -0
  2. commamatrix-0.1.0/LICENSE +21 -0
  3. commamatrix-0.1.0/PKG-INFO +321 -0
  4. commamatrix-0.1.0/README.md +255 -0
  5. commamatrix-0.1.0/pyproject.toml +110 -0
  6. commamatrix-0.1.0/src/commamatrix/__init__.py +16 -0
  7. commamatrix-0.1.0/src/commamatrix/builtin/__init__.py +42 -0
  8. commamatrix-0.1.0/src/commamatrix/builtin/apply_patch.py +614 -0
  9. commamatrix-0.1.0/src/commamatrix/builtin/codeact/__init__.py +37 -0
  10. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/__init__.py +13 -0
  11. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/backend.py +73 -0
  12. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/docker.py +32 -0
  13. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/subproc.py +242 -0
  14. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/systemd.py +36 -0
  15. commamatrix-0.1.0/src/commamatrix/builtin/codeact/executor/worker.py +425 -0
  16. commamatrix-0.1.0/src/commamatrix/builtin/codeact/hooks.py +35 -0
  17. commamatrix-0.1.0/src/commamatrix/builtin/codeact/info.md +430 -0
  18. commamatrix-0.1.0/src/commamatrix/builtin/codeact/instructions.py +69 -0
  19. commamatrix-0.1.0/src/commamatrix/builtin/codeact/rpc/__init__.py +17 -0
  20. commamatrix-0.1.0/src/commamatrix/builtin/codeact/rpc/protocol.py +48 -0
  21. commamatrix-0.1.0/src/commamatrix/builtin/codeact/rpc/server.py +124 -0
  22. commamatrix-0.1.0/src/commamatrix/builtin/codeact/rpc/tcp.py +150 -0
  23. commamatrix-0.1.0/src/commamatrix/builtin/codeact/rpc/transport.py +23 -0
  24. commamatrix-0.1.0/src/commamatrix/builtin/codeact/search/__init__.py +8 -0
  25. commamatrix-0.1.0/src/commamatrix/builtin/codeact/search/api.py +51 -0
  26. commamatrix-0.1.0/src/commamatrix/builtin/codeact/search/bm25.py +78 -0
  27. commamatrix-0.1.0/src/commamatrix/builtin/codeact/service.py +140 -0
  28. commamatrix-0.1.0/src/commamatrix/builtin/codeact/tools.py +77 -0
  29. commamatrix-0.1.0/src/commamatrix/builtin/data_tools.py +318 -0
  30. commamatrix-0.1.0/src/commamatrix/builtin/filesystem.py +39 -0
  31. commamatrix-0.1.0/src/commamatrix/builtin/http_connector/__init__.py +41 -0
  32. commamatrix-0.1.0/src/commamatrix/builtin/http_connector/auth.py +326 -0
  33. commamatrix-0.1.0/src/commamatrix/builtin/http_connector/connector.py +1091 -0
  34. commamatrix-0.1.0/src/commamatrix/builtin/http_connector/ui/index.html +149 -0
  35. commamatrix-0.1.0/src/commamatrix/builtin/http_connector/ui/logo.svg +1 -0
  36. commamatrix-0.1.0/src/commamatrix/builtin/instructions/__init__.py +25 -0
  37. commamatrix-0.1.0/src/commamatrix/builtin/instructions/automation.py +23 -0
  38. commamatrix-0.1.0/src/commamatrix/builtin/instructions/coding.py +23 -0
  39. commamatrix-0.1.0/src/commamatrix/builtin/instructions/data_analysis.py +23 -0
  40. commamatrix-0.1.0/src/commamatrix/builtin/instructions/deep_research.py +22 -0
  41. commamatrix-0.1.0/src/commamatrix/builtin/instructions/default_instruction.py +16 -0
  42. commamatrix-0.1.0/src/commamatrix/builtin/instructions/roleplay.py +21 -0
  43. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/__init__.py +30 -0
  44. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/adapter.py +267 -0
  45. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/anthropic_messages.py +343 -0
  46. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/chat_completions.py +408 -0
  47. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/codec.py +280 -0
  48. commamatrix-0.1.0/src/commamatrix/builtin/llm_http_adapter/responses.py +392 -0
  49. commamatrix-0.1.0/src/commamatrix/builtin/mcp/__init__.py +43 -0
  50. commamatrix-0.1.0/src/commamatrix/builtin/mcp/config.py +155 -0
  51. commamatrix-0.1.0/src/commamatrix/builtin/mcp/hooks.py +21 -0
  52. commamatrix-0.1.0/src/commamatrix/builtin/mcp/instructions.py +28 -0
  53. commamatrix-0.1.0/src/commamatrix/builtin/mcp/loader.py +90 -0
  54. commamatrix-0.1.0/src/commamatrix/builtin/mcp/manager.py +164 -0
  55. commamatrix-0.1.0/src/commamatrix/builtin/mcp/result.py +53 -0
  56. commamatrix-0.1.0/src/commamatrix/builtin/mcp/runtime.py +222 -0
  57. commamatrix-0.1.0/src/commamatrix/builtin/mcp/server.py +126 -0
  58. commamatrix-0.1.0/src/commamatrix/builtin/mcp/source.py +110 -0
  59. commamatrix-0.1.0/src/commamatrix/builtin/multi_dialog.py +254 -0
  60. commamatrix-0.1.0/src/commamatrix/builtin/multi_user.py +153 -0
  61. commamatrix-0.1.0/src/commamatrix/builtin/planner/__init__.py +49 -0
  62. commamatrix-0.1.0/src/commamatrix/builtin/planner/decorators.py +57 -0
  63. commamatrix-0.1.0/src/commamatrix/builtin/planner/service.py +236 -0
  64. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/__init__.py +12 -0
  65. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/codeact.md +63 -0
  66. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/configuration.md +62 -0
  67. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/connectors.md +92 -0
  68. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/dialog.md +63 -0
  69. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/hooks.md +107 -0
  70. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/http.md +63 -0
  71. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/instructions.md +46 -0
  72. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/lifecycle.md +62 -0
  73. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/main.md +196 -0
  74. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/mcp.md +128 -0
  75. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/planner.md +48 -0
  76. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/providers.md +59 -0
  77. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/runtime.md +86 -0
  78. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/security.md +54 -0
  79. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/services.md +78 -0
  80. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/tables.md +71 -0
  81. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/guides/tools.md +119 -0
  82. commamatrix-0.1.0/src/commamatrix/builtin/self_extension/tools.py +102 -0
  83. commamatrix-0.1.0/src/commamatrix/builtin/simple_fs.py +72 -0
  84. commamatrix-0.1.0/src/commamatrix/builtin/sql/__init__.py +22 -0
  85. commamatrix-0.1.0/src/commamatrix/builtin/sql/postgres_storage.py +105 -0
  86. commamatrix-0.1.0/src/commamatrix/builtin/sql/sql_storage.py +473 -0
  87. commamatrix-0.1.0/src/commamatrix/builtin/sql/sqlite_storage.py +78 -0
  88. commamatrix-0.1.0/src/commamatrix/builtin/storage_utils.py +48 -0
  89. commamatrix-0.1.0/src/commamatrix/builtin/subagent/__init__.py +17 -0
  90. commamatrix-0.1.0/src/commamatrix/builtin/subagent/connector.py +107 -0
  91. commamatrix-0.1.0/src/commamatrix/builtin/subagent/hooks.py +71 -0
  92. commamatrix-0.1.0/src/commamatrix/builtin/subagent/policy.py +42 -0
  93. commamatrix-0.1.0/src/commamatrix/builtin/subagent/service.py +42 -0
  94. commamatrix-0.1.0/src/commamatrix/builtin/subagent/submit.py +139 -0
  95. commamatrix-0.1.0/src/commamatrix/builtin/subagent/tools.py +43 -0
  96. commamatrix-0.1.0/src/commamatrix/builtin/web_utils/__init__.py +22 -0
  97. commamatrix-0.1.0/src/commamatrix/builtin/web_utils/instructions.py +18 -0
  98. commamatrix-0.1.0/src/commamatrix/builtin/web_utils/security.py +50 -0
  99. commamatrix-0.1.0/src/commamatrix/builtin/web_utils/tools.py +134 -0
  100. commamatrix-0.1.0/src/commamatrix/components/__init__.py +272 -0
  101. commamatrix-0.1.0/src/commamatrix/components/config.py +128 -0
  102. commamatrix-0.1.0/src/commamatrix/components/connector.py +170 -0
  103. commamatrix-0.1.0/src/commamatrix/components/dialog.py +127 -0
  104. commamatrix-0.1.0/src/commamatrix/components/file_storage.py +287 -0
  105. commamatrix-0.1.0/src/commamatrix/components/hook.py +478 -0
  106. commamatrix-0.1.0/src/commamatrix/components/http_client.py +71 -0
  107. commamatrix-0.1.0/src/commamatrix/components/instruction.py +237 -0
  108. commamatrix-0.1.0/src/commamatrix/components/llm_adapter.py +327 -0
  109. commamatrix-0.1.0/src/commamatrix/components/server.py +234 -0
  110. commamatrix-0.1.0/src/commamatrix/components/storage.py +94 -0
  111. commamatrix-0.1.0/src/commamatrix/components/table.py +214 -0
  112. commamatrix-0.1.0/src/commamatrix/components/tool.py +559 -0
  113. commamatrix-0.1.0/src/commamatrix/core/__init__.py +63 -0
  114. commamatrix-0.1.0/src/commamatrix/core/agent/__init__.py +17 -0
  115. commamatrix-0.1.0/src/commamatrix/core/agent/agent.py +822 -0
  116. commamatrix-0.1.0/src/commamatrix/core/agent/lifecycle.py +291 -0
  117. commamatrix-0.1.0/src/commamatrix/core/agent/runner.py +65 -0
  118. commamatrix-0.1.0/src/commamatrix/core/classes/__init__.py +57 -0
  119. commamatrix-0.1.0/src/commamatrix/core/classes/descriptor.py +34 -0
  120. commamatrix-0.1.0/src/commamatrix/core/classes/lifecycle_registry.py +78 -0
  121. commamatrix-0.1.0/src/commamatrix/core/classes/manager.py +457 -0
  122. commamatrix-0.1.0/src/commamatrix/core/classes/ordering.py +160 -0
  123. commamatrix-0.1.0/src/commamatrix/core/classes/service.py +70 -0
  124. commamatrix-0.1.0/src/commamatrix/core/classes/source.py +142 -0
  125. commamatrix-0.1.0/src/commamatrix/core/extensions.py +265 -0
  126. commamatrix-0.1.0/src/commamatrix/presets.py +82 -0
  127. commamatrix-0.1.0/src/commamatrix/utils.py +261 -0
@@ -0,0 +1,172 @@
1
+ ### Python template
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # poetry
99
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103
+ #poetry.lock
104
+
105
+ # pdm
106
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107
+ #pdm.lock
108
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109
+ # in version control.
110
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
111
+ .pdm.toml
112
+ .pdm-python
113
+ .pdm-build/
114
+
115
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116
+ __pypackages__/
117
+
118
+ # Celery stuff
119
+ celerybeat-schedule
120
+ celerybeat.pid
121
+
122
+ # SageMath parsed files
123
+ *.sage.py
124
+
125
+ # Environments
126
+ .env
127
+ .venv
128
+ env/
129
+ venv/
130
+ ENV/
131
+ env.bak/
132
+ venv.bak/
133
+
134
+ # Spyder project settings
135
+ .spyderproject
136
+ .spyproject
137
+
138
+ # Rope project settings
139
+ .ropeproject
140
+
141
+ # mkdocs documentation
142
+ /site
143
+
144
+ # mypy
145
+ .mypy_cache/
146
+ .dmypy.json
147
+ dmypy.json
148
+
149
+ # Pyre type checker
150
+ .pyre/
151
+
152
+ # pytype static type analyzer
153
+ .pytype/
154
+
155
+ # Cython debug symbols
156
+ cython_debug/
157
+
158
+ # PyCharm
159
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
160
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
161
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
162
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
163
+ .idea/
164
+
165
+ /uv.lock
166
+ /opencode.json
167
+ /.commamatrix/*.db
168
+ /.commamatrix/*.sqlite
169
+ /.commamatrix/files/
170
+ /.commamatrix/mcp.json
171
+ /.codex/
172
+ /.commamatrix/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 matrixd0t
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,321 @@
1
+ Metadata-Version: 2.4
2
+ Name: commamatrix
3
+ Version: 0.1.0
4
+ Summary: AI Agent Orchestration Framework
5
+ Project-URL: Homepage, https://github.com/matrixd0t/commamatrix
6
+ Project-URL: Repository, https://github.com/matrixd0t/commamatrix
7
+ Project-URL: Issues, https://github.com/matrixd0t/commamatrix/issues
8
+ License-File: LICENSE
9
+ Requires-Python: >=3.13
10
+ Requires-Dist: httpx2<3,>=2.9.1
11
+ Requires-Dist: matrix-fn-schema>=0.1.9
12
+ Requires-Dist: pydantic
13
+ Provides-Extra: all
14
+ Requires-Dist: aiosqlite; extra == 'all'
15
+ Requires-Dist: asyncpg; extra == 'all'
16
+ Requires-Dist: bcrypt; extra == 'all'
17
+ Requires-Dist: bm25s; extra == 'all'
18
+ Requires-Dist: ddgs>=9.14.4; extra == 'all'
19
+ Requires-Dist: matrix-planner>=0.2.1; extra == 'all'
20
+ Requires-Dist: mcp>=2.0.0; extra == 'all'
21
+ Requires-Dist: pyjwt; extra == 'all'
22
+ Requires-Dist: python-dotenv; extra == 'all'
23
+ Requires-Dist: python-multipart; extra == 'all'
24
+ Requires-Dist: sse-starlette<4,>=3.3; extra == 'all'
25
+ Requires-Dist: starlette; extra == 'all'
26
+ Requires-Dist: trafilatura>=2.1.0; extra == 'all'
27
+ Requires-Dist: uvicorn; extra == 'all'
28
+ Provides-Extra: codeact
29
+ Requires-Dist: bm25s; extra == 'codeact'
30
+ Provides-Extra: dotenv
31
+ Requires-Dist: python-dotenv; extra == 'dotenv'
32
+ Provides-Extra: http
33
+ Requires-Dist: bcrypt; extra == 'http'
34
+ Requires-Dist: pyjwt; extra == 'http'
35
+ Requires-Dist: python-multipart; extra == 'http'
36
+ Requires-Dist: sse-starlette<4,>=3.3; extra == 'http'
37
+ Requires-Dist: starlette; extra == 'http'
38
+ Requires-Dist: uvicorn; extra == 'http'
39
+ Provides-Extra: mcp
40
+ Requires-Dist: mcp>=2.0.0; extra == 'mcp'
41
+ Provides-Extra: planner
42
+ Requires-Dist: matrix-planner>=0.2.1; extra == 'planner'
43
+ Provides-Extra: postgres
44
+ Requires-Dist: asyncpg; extra == 'postgres'
45
+ Provides-Extra: sqlite
46
+ Requires-Dist: aiosqlite; extra == 'sqlite'
47
+ Provides-Extra: test
48
+ Requires-Dist: aiosqlite; extra == 'test'
49
+ Requires-Dist: bcrypt; extra == 'test'
50
+ Requires-Dist: bm25s; extra == 'test'
51
+ Requires-Dist: ddgs>=9.14.4; extra == 'test'
52
+ Requires-Dist: matrix-planner>=0.2.1; extra == 'test'
53
+ Requires-Dist: pyjwt; extra == 'test'
54
+ Requires-Dist: pytest; extra == 'test'
55
+ Requires-Dist: pytest-asyncio; extra == 'test'
56
+ Requires-Dist: python-dotenv; extra == 'test'
57
+ Requires-Dist: python-multipart; extra == 'test'
58
+ Requires-Dist: sse-starlette<4,>=3.3; extra == 'test'
59
+ Requires-Dist: starlette; extra == 'test'
60
+ Requires-Dist: trafilatura>=2.1.0; extra == 'test'
61
+ Requires-Dist: uvicorn; extra == 'test'
62
+ Provides-Extra: web
63
+ Requires-Dist: ddgs>=9.14.4; extra == 'web'
64
+ Requires-Dist: trafilatura>=2.1.0; extra == 'web'
65
+ Description-Content-Type: text/markdown
66
+
67
+ <img src="logo.svg" alt="CommaMatrix logo" width="256">
68
+
69
+ # CommaMatrix
70
+
71
+ CommaMatrix is an async-native Python framework for building conversational
72
+ agents. It separates transport connectors, LLM adapters, persistence, tools,
73
+ hooks, instructions, and agent-owned services into explicit extensions that
74
+ can be composed per agent.
75
+
76
+ The package targets Python 3.13 and later.
77
+
78
+ ## Features
79
+
80
+ - Async agent lifecycle with transactional startup, refresh, and shutdown.
81
+ - HTTP connector with a web UI, authentication, streaming, and file uploads.
82
+ - OpenAI-compatible, OpenAI Responses, and Anthropic Messages HTTP protocols.
83
+ - Persistent conversation history with SQLite, PostgreSQL, or a custom storage.
84
+ - Discoverable tools, hooks, instructions, services, tables, and connectors.
85
+ - Optional web search, CodeAct execution, planner, subagents, and MCP support.
86
+ - Per-agent extension scopes instead of a process-wide plugin registry.
87
+
88
+ ## Installation
89
+
90
+ The commands below use [uv](https://docs.astral.sh/uv/), which manages the
91
+ virtual environment, dependencies, and command execution. Install uv first if
92
+ it is not available on your system.
93
+
94
+ Create a virtual environment with Python 3.13 or newer:
95
+
96
+ ```bash
97
+ uv venv --python 3.13
98
+ ```
99
+
100
+ ### Recommended installation
101
+
102
+ Install the complete built-in integration set. This is the recommended
103
+ installation for trying CommaMatrix or building a first agent:
104
+
105
+ ```bash
106
+ uv pip install "commamatrix[all]"
107
+ ```
108
+
109
+ The `[all]` extra installs optional dependencies. It does not automatically
110
+ enable every integration in every agent. Extensions are still activated
111
+ explicitly in application code, which keeps each agent's runtime scope
112
+ predictable.
113
+
114
+ ### Feature-specific installation
115
+
116
+ The core package can be installed without optional integrations:
117
+
118
+ ```bash
119
+ uv add commamatrix
120
+ ```
121
+
122
+ Core runtime dependencies are `pydantic`, `httpx2>=2.9.1,<3`, and
123
+ `matrix-fn-schema>=0.1.9`. Optional integrations are kept in extras so an
124
+ application can choose its dependency footprint.
125
+
126
+ Install only the extras used by an application when the complete set is not
127
+ needed:
128
+
129
+ | Extra | Provides |
130
+ | --- | --- |
131
+ | `dotenv` | Loading configuration from `.env` files |
132
+ | `sqlite` | Built-in async SQLite storage |
133
+ | `http` | HTTP connector, web UI, authentication, and ASGI server |
134
+ | `web` | Web search and page extraction tools |
135
+ | `codeact` | CodeAct execution support |
136
+ | `planner` | Scheduled tasks and planner integration |
137
+ | `postgres` | PostgreSQL storage support |
138
+ | `mcp` | Model Context Protocol client support |
139
+ | `all` | All built-in integration dependencies |
140
+ | `test` | Test runner plus most integration dependencies |
141
+
142
+ The declared dependency groups are:
143
+
144
+ | Group | Packages |
145
+ | --- | --- |
146
+ | Core | `pydantic`, `httpx2>=2.9.1,<3`, `matrix-fn-schema>=0.1.9` |
147
+ | `dotenv` | `python-dotenv` |
148
+ | `sqlite` | `aiosqlite` |
149
+ | `http` | `sse-starlette>=3.3,<4`, `starlette`, `uvicorn`, `bcrypt`, `PyJWT`, `python-multipart` |
150
+ | `web` | `ddgs>=9.14.4`, `trafilatura>=2.1.0` |
151
+ | `codeact` | `bm25s` |
152
+ | `planner` | `matrix-planner>=0.2.1` |
153
+ | `postgres` | `asyncpg` |
154
+ | `mcp` | `mcp>=2.0.0` |
155
+
156
+ For example:
157
+
158
+ ```bash
159
+ uv pip install "commamatrix[http,sqlite]"
160
+ ```
161
+
162
+ ## Quickstart
163
+
164
+ The following example starts an authenticated HTTP agent backed by an
165
+ OpenAI-compatible API. The same adapter can be configured for other supported
166
+ providers by changing `LLM_API_BASE`, `LLM_API_PROTOCOL`, and the API key
167
+ field.
168
+
169
+ Set the provider configuration in the environment. CommaMatrix also loads a
170
+ `.env` file when `python-dotenv` is installed:
171
+
172
+ ```bash
173
+ export OPENAI_API_KEY="your-api-key"
174
+ export LLM_API_BASE="https://api.openai.com"
175
+ ```
176
+
177
+ On Windows PowerShell:
178
+
179
+ ```powershell
180
+ $env:OPENAI_API_KEY = "your-api-key"
181
+ $env:LLM_API_BASE = "https://api.openai.com"
182
+ ```
183
+
184
+ Create `quickstart.py`:
185
+
186
+ ```python
187
+ import asyncio
188
+ import os
189
+
190
+ from commamatrix import *
191
+
192
+
193
+ async def main() -> None:
194
+ agent = Agent(name="my_lovely_assistant")
195
+ await agent.add_extensions(presets.minimal)
196
+
197
+ # See every ConfigField declared by the two active extensions.
198
+ print(agent.config_fields_info())
199
+
200
+ agent.config.set(agentic_model, "deepseek-v4-flash")
201
+ agent.config.set(api_base, os.environ["LLM_API_BASE"])
202
+ agent.config.set(openai_api_key, os.environ["OPENAI_API_KEY"])
203
+
204
+ # __aenter__ starts the agent; __aexit__ stops it reliably on exit.
205
+ async with agent:
206
+ print(f"CommaMatrix is running at {agent.http_server.base_url}")
207
+ await asyncio.Event().wait()
208
+
209
+
210
+ if __name__ == "__main__":
211
+ asyncio.run(main())
212
+ ```
213
+
214
+ `async with agent` starts the agent and always stops it when the block exits,
215
+ including cancellation from `Ctrl+C`. If the application has no work to do
216
+ between startup and shutdown, the same lifecycle can be shortened to:
217
+
218
+ ```python
219
+ await agent.run_forever()
220
+ ```
221
+
222
+ Start it with uv:
223
+
224
+ ```bash
225
+ uv run quickstart.py
226
+ ```
227
+
228
+ Open `http://127.0.0.1:8338/commamatrix` in a browser. On the first start, the HTTP connector creates an administrator account and prints its generated password once. Save that password. The default SQLite database and uploaded files are stored at `.commamatrix/`.
229
+
230
+ The health endpoint does not require authentication:
231
+
232
+ ```bash
233
+ curl http://127.0.0.1:8338/commamatrix/health
234
+ ```
235
+
236
+ For a non-interactive request, log in first and use the returned bearer token:
237
+
238
+ ```bash
239
+ curl -X POST http://127.0.0.1:8338/commamatrix/api/login \
240
+ -H "Content-Type: application/json" \
241
+ -d '{"username":"admin","password":"YOUR_ADMIN_PASSWORD"}'
242
+ ```
243
+
244
+ Then send a message with the token returned as `access_token`:
245
+
246
+ ```bash
247
+ curl -X POST http://127.0.0.1:8338/commamatrix/api/messages \
248
+ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
249
+ -H "Content-Type: application/json" \
250
+ -d '{"content":"Explain what CommaMatrix does in one sentence."}'
251
+ ```
252
+
253
+ The response contains the new dialog items, including the assistant output. For streaming, add `?stream=1` to the messages endpoint and consume events from `/commamatrix/api/events`.
254
+
255
+ `agent.config_fields_markdown()` returns Markdown sections for the currently active extension modules. Each field is rendered as `## name: type (default: value)`, followed by its declaring module and description; the parenthesized default is omitted when no default is declared. Defaults created by a callable are shown as `computed`; configuration values are never included in the output. Call the helper after `add_extensions()` and before `start()` when you want to inspect only the extensions selected by the application. Core fields such as `agentic_model`, `http_host`, and `http_port` are not extension fields and can be imported and configured separately as shown above.
256
+
257
+ ## Configuration
258
+
259
+ The LLM HTTP adapter reads these environment variables by default:
260
+
261
+ | Variable | Purpose |
262
+ | --- | --- |
263
+ | `OPENAI_API_KEY` | Key for OpenAI-compatible and OpenAI Responses APIs |
264
+ | `ANTHROPIC_API_KEY` | Key for the Anthropic Messages API |
265
+ | `LLM_API_BASE` | Provider base URL |
266
+ | `LLM_API_PROTOCOL` | `chat_completions`, `responses`, or `anthropic_messages` |
267
+
268
+ The provider must expose a compatible models endpoint. The adapter discovers available models during startup, and `agentic_model` filters the discovered models by substring. The quickstart selects `deepseek-v4-flash`; replace that value with a model available from your provider.
269
+
270
+ Configuration fields are ordinary Python objects and can be passed as keys in an agent's `config` dictionary on init:
271
+
272
+ ```python
273
+ from commamatrix import *
274
+
275
+ agent = Agent(
276
+ "my-agent",
277
+ config={
278
+ agentic_model: "my-model",
279
+ api_base: "https://llm.example.com",
280
+ },
281
+ )
282
+ ```
283
+
284
+ ## Extensions
285
+
286
+ Extensions are imported and then added to an agent's scope. The recommended preset lists containig built-in features are available in `commamatrix.presets`:
287
+
288
+ ```python
289
+ from commamatrix import Agent
290
+ from commamatrix.presets import assistant
291
+
292
+
293
+ async def create_agent() -> Agent:
294
+ agent = Agent("my_lovely_assistant")
295
+ await agent.add_extensions(assistant)
296
+ return agent
297
+ ```
298
+
299
+ Individual extensions can be selected when an agent needs a narrower scope:
300
+
301
+ ```python
302
+ from commamatrix.builtin import data_tools, web_utils
303
+
304
+ await agent.add_extensions(data_tools, web_utils)
305
+ ```
306
+
307
+ Custom or external extensions can expose normal Python declarations and be activated by import name:
308
+
309
+ ```python
310
+ await agent.add_extensions("my_project.my_extension")
311
+ ```
312
+
313
+ Common declarations include `@tool`, `@instruction`, lifecycle hooks, service subclasses, provider implementations, and `BaseTable` subclasses. See the [extension authoring guide](https://github.com/matrixd0t/commamatrix/blob/master/src/commamatrix/builtin/self_extension/guides) for the complete extension API.
314
+
315
+ ## Security Notes
316
+
317
+ - Keep `http_host` set to `127.0.0.1` for local development. `0.0.0.0` exposes your HTTP connector to the Internet.
318
+ - HTTP connector passwords are hashed; generated administrator credentials are printed only during initial account creation.
319
+ - CodeAct executes arbitrary Python code with access to the standard library, installed dependencies, and the system terminal. Default subprocess backend is intentionally NOT a security sandbox and must NOT be exposed to untrusted users without an external isolation layer. To enforce configurable limits on the agent’s execution privileges, prefer systemd or Docker-backed implementations.
320
+ - Validate the reverse proxy, TLS, CORS, and network policy before exposing the HTTP connector to the Internet.
321
+