matimo-core 0.1.0a14.post1__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 (80) hide show
  1. matimo_core-0.1.0a14.post1/.gitignore +63 -0
  2. matimo_core-0.1.0a14.post1/PKG-INFO +324 -0
  3. matimo_core-0.1.0a14.post1/README.md +265 -0
  4. matimo_core-0.1.0a14.post1/pyproject.toml +116 -0
  5. matimo_core-0.1.0a14.post1/src/matimo/__init__.py +318 -0
  6. matimo_core-0.1.0a14.post1/src/matimo/approval/__init__.py +0 -0
  7. matimo_core-0.1.0a14.post1/src/matimo/approval/handler.py +152 -0
  8. matimo_core-0.1.0a14.post1/src/matimo/auth/__init__.py +27 -0
  9. matimo_core-0.1.0a14.post1/src/matimo/auth/injection.py +141 -0
  10. matimo_core-0.1.0a14.post1/src/matimo/auth/oauth2_config.py +76 -0
  11. matimo_core-0.1.0a14.post1/src/matimo/auth/oauth2_handler.py +291 -0
  12. matimo_core-0.1.0a14.post1/src/matimo/auth/oauth2_provider_loader.py +103 -0
  13. matimo_core-0.1.0a14.post1/src/matimo/core/__init__.py +0 -0
  14. matimo_core-0.1.0a14.post1/src/matimo/core/loader.py +215 -0
  15. matimo_core-0.1.0a14.post1/src/matimo/core/models.py +510 -0
  16. matimo_core-0.1.0a14.post1/src/matimo/core/registry.py +162 -0
  17. matimo_core-0.1.0a14.post1/src/matimo/core/skill_content_parser.py +242 -0
  18. matimo_core-0.1.0a14.post1/src/matimo/core/skill_loader.py +338 -0
  19. matimo_core-0.1.0a14.post1/src/matimo/core/skill_registry.py +308 -0
  20. matimo_core-0.1.0a14.post1/src/matimo/core/tfidf_embedding.py +155 -0
  21. matimo_core-0.1.0a14.post1/src/matimo/decorators/__init__.py +133 -0
  22. matimo_core-0.1.0a14.post1/src/matimo/encodings/__init__.py +0 -0
  23. matimo_core-0.1.0a14.post1/src/matimo/encodings/parameter_encoding.py +160 -0
  24. matimo_core-0.1.0a14.post1/src/matimo/errors.py +96 -0
  25. matimo_core-0.1.0a14.post1/src/matimo/executors/__init__.py +0 -0
  26. matimo_core-0.1.0a14.post1/src/matimo/executors/command_executor.py +154 -0
  27. matimo_core-0.1.0a14.post1/src/matimo/executors/function_executor.py +193 -0
  28. matimo_core-0.1.0a14.post1/src/matimo/executors/http_executor.py +292 -0
  29. matimo_core-0.1.0a14.post1/src/matimo/instance.py +560 -0
  30. matimo_core-0.1.0a14.post1/src/matimo/integrations/__init__.py +0 -0
  31. matimo_core-0.1.0a14.post1/src/matimo/integrations/_pydantic_utils.py +79 -0
  32. matimo_core-0.1.0a14.post1/src/matimo/integrations/crewai.py +137 -0
  33. matimo_core-0.1.0a14.post1/src/matimo/integrations/langchain.py +190 -0
  34. matimo_core-0.1.0a14.post1/src/matimo/logging/__init__.py +194 -0
  35. matimo_core-0.1.0a14.post1/src/matimo/mcp/__init__.py +0 -0
  36. matimo_core-0.1.0a14.post1/src/matimo/mcp/secrets/__init__.py +263 -0
  37. matimo_core-0.1.0a14.post1/src/matimo/mcp/secrets/types.py +23 -0
  38. matimo_core-0.1.0a14.post1/src/matimo/mcp/server.py +232 -0
  39. matimo_core-0.1.0a14.post1/src/matimo/mcp/tool_converter.py +60 -0
  40. matimo_core-0.1.0a14.post1/src/matimo/policy/__init__.py +0 -0
  41. matimo_core-0.1.0a14.post1/src/matimo/policy/approval_manifest.py +188 -0
  42. matimo_core-0.1.0a14.post1/src/matimo/policy/content_validator.py +212 -0
  43. matimo_core-0.1.0a14.post1/src/matimo/policy/default_policy.py +325 -0
  44. matimo_core-0.1.0a14.post1/src/matimo/policy/integrity_tracker.py +92 -0
  45. matimo_core-0.1.0a14.post1/src/matimo/policy/policy_loader.py +106 -0
  46. matimo_core-0.1.0a14.post1/src/matimo/policy/risk_classifier.py +42 -0
  47. matimo_core-0.1.0a14.post1/src/matimo/policy/types.py +191 -0
  48. matimo_core-0.1.0a14.post1/src/matimo/sync.py +122 -0
  49. matimo_core-0.1.0a14.post1/src/matimo/tools/calculator/calculator.py +36 -0
  50. matimo_core-0.1.0a14.post1/src/matimo/tools/calculator/definition.yaml +70 -0
  51. matimo_core-0.1.0a14.post1/src/matimo/tools/edit/definition.yaml +108 -0
  52. matimo_core-0.1.0a14.post1/src/matimo/tools/edit/edit.py +79 -0
  53. matimo_core-0.1.0a14.post1/src/matimo/tools/execute/definition.yaml +90 -0
  54. matimo_core-0.1.0a14.post1/src/matimo/tools/execute/execute.py +74 -0
  55. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_approve_tool/definition.yaml +36 -0
  56. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_approve_tool/matimo_approve_tool.py +61 -0
  57. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_create_skill/definition.yaml +46 -0
  58. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_create_skill/matimo_create_skill.py +64 -0
  59. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_create_tool/definition.yaml +48 -0
  60. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_create_tool/matimo_create_tool.py +101 -0
  61. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_get_skill/definition.yaml +60 -0
  62. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_get_skill/matimo_get_skill.py +119 -0
  63. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_get_tool_status/definition.yaml +42 -0
  64. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_get_tool_status/matimo_get_tool_status.py +65 -0
  65. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_list_skills/definition.yaml +50 -0
  66. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_list_skills/matimo_list_skills.py +79 -0
  67. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_list_user_tools/definition.yaml +32 -0
  68. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_list_user_tools/matimo_list_user_tools.py +51 -0
  69. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_reload_tools/definition.yaml +35 -0
  70. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_reload_tools/matimo_reload_tools.py +40 -0
  71. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_validate_skill/definition.yaml +43 -0
  72. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_validate_skill/matimo_validate_skill.py +134 -0
  73. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_validate_tool/definition.yaml +34 -0
  74. matimo_core-0.1.0a14.post1/src/matimo/tools/matimo_validate_tool/matimo_validate_tool.py +73 -0
  75. matimo_core-0.1.0a14.post1/src/matimo/tools/read/definition.yaml +101 -0
  76. matimo_core-0.1.0a14.post1/src/matimo/tools/read/read.py +53 -0
  77. matimo_core-0.1.0a14.post1/src/matimo/tools/search/definition.yaml +132 -0
  78. matimo_core-0.1.0a14.post1/src/matimo/tools/search/search.py +106 -0
  79. matimo_core-0.1.0a14.post1/src/matimo/tools/web/definition.yaml +124 -0
  80. matimo_core-0.1.0a14.post1/src/matimo/tools/web/web.py +82 -0
@@ -0,0 +1,63 @@
1
+ # Dependencies
2
+ **/node_modules/
3
+ package-lock.json
4
+ yarn.lock
5
+
6
+ # Build output
7
+ **/dist/
8
+ *.tsbuildinfo
9
+
10
+ # Python compiled / build
11
+ **/__pycache__/
12
+ *.py[cod]
13
+ *$py.class
14
+ *.egg-info/
15
+ *.egg
16
+ **/build/
17
+ **/.eggs/
18
+ **/.venv/
19
+ **/.mypy_cache/
20
+ **/.ruff_cache/
21
+ **/.pytest_cache/
22
+
23
+ # Test coverage
24
+ **/coverage/
25
+ **/.nyc_output/
26
+
27
+ # IDE
28
+ .vscode/
29
+ .idea/
30
+ *.swp
31
+ *.swo
32
+ *~
33
+ .DS_Store
34
+
35
+ # Environment
36
+ .env
37
+ .env.local
38
+ .env.*.local
39
+
40
+ # Logs
41
+ *.log
42
+ npm-debug.log*
43
+ yarn-debug.log*
44
+ yarn-error.log*
45
+
46
+ # OS
47
+ .DS_Store
48
+ Thumbs.db
49
+
50
+ # Temporary files
51
+ tmp/
52
+ temp/
53
+ *.tmp
54
+ typescript/examples/mcp/matimo-tools/.matimo-approvals.json
55
+ typescript/examples/mcp/matimo-tools/fetch-weather/definition.yaml
56
+ typescript/examples/mcp/matimo-tools/npm_downloads/definition.yaml
57
+ typescript/examples/mcp/matimo-tools/skills/ecosystem-health/SKILL.md
58
+ typescript/examples/mcp/matimo-tools/skills/matimo-health-check/SKILL.md
59
+ typescript/examples/mcp/matimo-tools/skills/moltbook-identity/SKILL.md
60
+ typescript/packages/cli/.matimo/certs/server.crt
61
+ typescript/packages/cli/.matimo/certs/server.key
62
+ typescript/examples/mcp/.matimo/certs/server.crt
63
+ typescript/examples/mcp/.matimo/certs/server.key
@@ -0,0 +1,324 @@
1
+ Metadata-Version: 2.4
2
+ Name: matimo-core
3
+ Version: 0.1.0a14.post1
4
+ Summary: Matimo core — framework-agnostic SDK: pre-built providers, skills layer, MCP, and a policy engine you control
5
+ Project-URL: Homepage, https://matimo.dev
6
+ Project-URL: Documentation, https://matimo.dev/docs
7
+ Project-URL: Repository, https://github.com/tallclub/matimo
8
+ Project-URL: Issues, https://github.com/tallclub/matimo/issues
9
+ License: MIT
10
+ Keywords: agents,ai,crewai,langchain,matimo,mcp,tools
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: anyio>=4.0
22
+ Requires-Dist: httpx>=0.27
23
+ Requires-Dist: pydantic>=2.0
24
+ Requires-Dist: pyyaml>=6.0
25
+ Requires-Dist: typing-extensions>=4.9
26
+ Provides-Extra: all
27
+ Requires-Dist: crewai>=0.80; extra == 'all'
28
+ Requires-Dist: hvac>=2.0; extra == 'all'
29
+ Requires-Dist: langchain-core>=0.3; extra == 'all'
30
+ Requires-Dist: mcp>=1.0; extra == 'all'
31
+ Requires-Dist: python-dotenv>=1.0; extra == 'all'
32
+ Provides-Extra: aws
33
+ Requires-Dist: boto3>=1.34; extra == 'aws'
34
+ Provides-Extra: crewai
35
+ Requires-Dist: crewai>=0.80; extra == 'crewai'
36
+ Provides-Extra: dev
37
+ Requires-Dist: boto3>=1.34; extra == 'dev'
38
+ Requires-Dist: crewai>=0.80; extra == 'dev'
39
+ Requires-Dist: hvac>=2.0; extra == 'dev'
40
+ Requires-Dist: langchain-core>=0.3; extra == 'dev'
41
+ Requires-Dist: mcp>=1.0; extra == 'dev'
42
+ Requires-Dist: mypy>=1.10; extra == 'dev'
43
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
44
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
45
+ Requires-Dist: pytest>=8.0; extra == 'dev'
46
+ Requires-Dist: python-dotenv>=1.0; extra == 'dev'
47
+ Requires-Dist: respx>=0.21; extra == 'dev'
48
+ Requires-Dist: ruff>=0.4; extra == 'dev'
49
+ Requires-Dist: types-pyyaml>=6.0; extra == 'dev'
50
+ Provides-Extra: dotenv
51
+ Requires-Dist: python-dotenv>=1.0; extra == 'dotenv'
52
+ Provides-Extra: langchain
53
+ Requires-Dist: langchain-core>=0.3; extra == 'langchain'
54
+ Provides-Extra: mcp
55
+ Requires-Dist: mcp>=1.0; extra == 'mcp'
56
+ Provides-Extra: vault
57
+ Requires-Dist: hvac>=2.0; extra == 'vault'
58
+ Description-Content-Type: text/markdown
59
+
60
+ # matimo-core
61
+
62
+ > Configuration-driven AI tools SDK — core module.
63
+
64
+ [![PyPI](https://img.shields.io/pypi/v/matimo-core)](https://pypi.org/project/matimo-core/)
65
+ [![Python](https://img.shields.io/pypi/pyversions/matimo-core)](https://pypi.org/project/matimo-core/)
66
+ [![Docs](https://img.shields.io/badge/docs-matimo.dev-blue)](https://matimo.dev/docs)
67
+ [![Tests](https://img.shields.io/badge/tests-658%20passing-brightgreen)](https://github.com/tallclub/matimo)
68
+ [![Coverage](https://img.shields.io/badge/coverage-97%25-brightgreen)](https://github.com/tallclub/matimo)
69
+
70
+ Write tools once in YAML, use them everywhere — with LangChain, CrewAI, MCP, and more.
71
+
72
+ > **Note:** Most users should install [`matimo`](https://pypi.org/project/matimo/) (the convenience wrapper) instead of `matimo-core` directly.
73
+
74
+ ---
75
+
76
+ ## Installation
77
+
78
+ ```bash
79
+ pip install matimo-core
80
+ # with framework extras
81
+ pip install "matimo-core[langchain]"
82
+ pip install "matimo-core[crewai]"
83
+ pip install "matimo-core[mcp]"
84
+ pip install "matimo-core[langchain,crewai,mcp]"
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Quick Start
90
+
91
+ ### Factory pattern
92
+
93
+ ```python
94
+ import asyncio
95
+ from matimo import Matimo
96
+
97
+ async def main():
98
+ # Load tools from a directory
99
+ matimo = await Matimo.init('./tools')
100
+ result = await matimo.execute('my_tool', {'param': 'value'})
101
+ print(result)
102
+
103
+ asyncio.run(main())
104
+ ```
105
+
106
+ ### Auto-discover installed providers
107
+
108
+ ```python
109
+ from matimo import Matimo
110
+
111
+ matimo = await Matimo.init(auto_discover=True)
112
+ tools = matimo.list_tools()
113
+ print(f"{len(tools)} tools loaded")
114
+ ```
115
+
116
+ ### Decorator pattern
117
+
118
+ ```python
119
+ from matimo import Matimo, tool, set_global_matimo_instance
120
+
121
+ matimo = await Matimo.init('./tools')
122
+ set_global_matimo_instance(matimo)
123
+
124
+ class MyAgent:
125
+ @tool('slack_send_channel_message')
126
+ async def send_message(self, channel: str, text: str): ...
127
+ # Decorator handles execution automatically
128
+ ```
129
+
130
+ ### LangChain
131
+
132
+ ```python
133
+ from matimo import Matimo
134
+ from matimo.integrations.langchain import convert_tools_to_langchain
135
+ from langchain_openai import ChatOpenAI
136
+ from langchain.agents import AgentExecutor, create_tool_calling_agent
137
+ from langchain_core.prompts import ChatPromptTemplate
138
+
139
+ matimo = await Matimo.init(auto_discover=True)
140
+ lc_tools = convert_tools_to_langchain(
141
+ matimo.list_tools(),
142
+ matimo,
143
+ credentials={'SLACK_BOT_TOKEN': 'xoxb-...'},
144
+ )
145
+ llm = ChatOpenAI(model='gpt-4o-mini')
146
+ prompt = ChatPromptTemplate.from_messages([
147
+ ('system', 'You are a helpful assistant.'),
148
+ ('human', '{input}'),
149
+ ('placeholder', '{agent_scratchpad}'),
150
+ ])
151
+ agent = create_tool_calling_agent(llm, lc_tools, prompt)
152
+ executor = AgentExecutor(agent=agent, tools=lc_tools)
153
+ result = await executor.ainvoke({'input': 'List all Slack channels'})
154
+ ```
155
+
156
+ ### CrewAI
157
+
158
+ ```python
159
+ from matimo import Matimo
160
+ from matimo.integrations.crewai import convert_tools_to_crewai
161
+
162
+ matimo = await Matimo.init(auto_discover=True)
163
+ tools = convert_tools_to_crewai(matimo.list_tools(), matimo)
164
+ ```
165
+
166
+ ### MCP server
167
+
168
+ ```python
169
+ from matimo import Matimo, create_mcp_server, MCPServerOptions
170
+
171
+ matimo = await Matimo.init(auto_discover=True)
172
+ server = await create_mcp_server(matimo, MCPServerOptions(name='my-agent', version='1.0.0'))
173
+ await server.start()
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Core API
179
+
180
+ ### `Matimo.init()`
181
+
182
+ ```python
183
+ from matimo import Matimo, InitOptions
184
+
185
+ matimo = await Matimo.init(
186
+ tool_paths=['./tools', './agent-tools'], # or a single string
187
+ auto_discover=False, # discover installed matimo-* packages
188
+ include_core=True, # include built-in meta-tools
189
+ policy_file='./policy.yaml',
190
+ untrusted_paths=['./agent-tools'],
191
+ skill_paths=['./skills'],
192
+ log_level='info', # silent | error | warn | info | debug
193
+ log_format='json', # json | simple
194
+ on_event=my_event_handler,
195
+ on_hitl=my_approval_callback,
196
+ )
197
+ ```
198
+
199
+ ### Key methods
200
+
201
+ | Method | Description |
202
+ |--------|-------------|
203
+ | `await matimo.execute(name, params)` | Execute a tool by name |
204
+ | `matimo.list_tools()` | Return all loaded `ToolDefinition` objects |
205
+ | `matimo.get_tool(name)` | Get a single `ToolDefinition` (or `None`) |
206
+ | `matimo.search_tools(query)` | Text search over tool names + descriptions |
207
+ | `await matimo.reload()` | Hot-reload tools from disk |
208
+ | `matimo.list_skills()` | Return all loaded skill definitions |
209
+ | `await matimo.semantic_search_skills(query)` | TF-IDF search over skills |
210
+ | `matimo.has_policy()` | Whether a policy engine is active |
211
+
212
+ ---
213
+
214
+ ## Tool YAML Format
215
+
216
+ ```yaml
217
+ name: my_api_tool
218
+ version: '1.0.0'
219
+ description: Fetch data from an API
220
+ parameters:
221
+ query:
222
+ type: string
223
+ required: true
224
+ description: Search query
225
+ execution:
226
+ type: http
227
+ method: GET
228
+ url: 'https://api.example.com/search?q={query}'
229
+ headers:
230
+ Authorization: 'Bearer {API_KEY}'
231
+ ```
232
+
233
+ ---
234
+
235
+ ## Policy Engine
236
+
237
+ ```python
238
+ from matimo import Matimo, InitOptions
239
+
240
+ matimo = await Matimo.init('./tools', InitOptions(
241
+ policy_file='./policy.yaml',
242
+ on_hitl=lambda req: {'approved': True, 'reason': 'auto'},
243
+ ))
244
+ ```
245
+
246
+ `policy.yaml`:
247
+ ```yaml
248
+ allowedDomains:
249
+ - api.github.com
250
+ - api.slack.com
251
+ allowedHttpMethods: [GET, POST]
252
+ allowCommandTools: false
253
+ allowFunctionTools: false
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Secrets Management
259
+
260
+ ```python
261
+ from matimo.mcp.secrets import create_resolver_chain
262
+
263
+ resolver = create_resolver_chain([
264
+ {'type': 'env'},
265
+ {'type': 'dotenv', 'path': '.env'},
266
+ {'type': 'vault', 'address': 'http://vault:8200'},
267
+ {'type': 'aws', 'region': 'us-east-1'},
268
+ ])
269
+ token = await resolver.resolve('SLACK_BOT_TOKEN')
270
+ ```
271
+
272
+ ---
273
+
274
+ ## Logging
275
+
276
+ ```python
277
+ from matimo import Matimo
278
+ from matimo.logging import get_global_matimo_logger
279
+
280
+ matimo = await Matimo.init('./tools', log_level='info', log_format='json')
281
+ logger = get_global_matimo_logger()
282
+ logger.info('Tool executed', {'tool': 'slack_send_channel_message'})
283
+ ```
284
+
285
+ ---
286
+
287
+ ## Meta-Tools (Agent Tool Lifecycle)
288
+
289
+ Built-in tools that let agents manage other tools at runtime:
290
+
291
+ | Tool | Purpose | Requires Approval |
292
+ |------|---------|:-----------------:|
293
+ | `matimo_validate_tool` | Validate YAML definition | No |
294
+ | `matimo_create_tool` | Write new tool to disk | Yes |
295
+ | `matimo_approve_tool` | Promote draft → approved | Yes |
296
+ | `matimo_reload_tools` | Hot-reload registry | Yes |
297
+ | `matimo_list_user_tools` | List agent-created tools | No |
298
+ | `matimo_get_tool_status` | Check approval state | Yes |
299
+ | `matimo_create_skill` | Create a SKILL.md | Yes |
300
+ | `matimo_list_skills` | List available skills | No |
301
+ | `matimo_get_skill` | Read skill content | No |
302
+ | `matimo_validate_skill` | Validate skill spec | No |
303
+
304
+ ---
305
+
306
+ ## Documentation
307
+
308
+ - [Getting Started](https://matimo.dev/docs/getting-started/QUICK_START)
309
+ - [Full API Reference](https://matimo.dev/docs/api-reference/SDK)
310
+ - [LangChain Integration](https://matimo.dev/docs/framework-integrations/LANGCHAIN)
311
+ - [CrewAI Integration](https://matimo.dev/docs/framework-integrations/CREWAI)
312
+ - [MCP Guide](https://matimo.dev/docs/MCP)
313
+ - [Policy & Lifecycle](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE)
314
+ - [Meta-Tools Reference](https://matimo.dev/docs/api-reference/META_TOOLS)
315
+
316
+ ---
317
+
318
+ ## Links
319
+
320
+ - **PyPI:** https://pypi.org/project/matimo-core/
321
+ - **Docs:** https://matimo.dev/docs
322
+ - **GitHub:** https://github.com/tallclub/matimo
323
+ - **Changelog:** https://github.com/tallclub/matimo/blob/main/docs/RELEASES.md
324
+
@@ -0,0 +1,265 @@
1
+ # matimo-core
2
+
3
+ > Configuration-driven AI tools SDK — core module.
4
+
5
+ [![PyPI](https://img.shields.io/pypi/v/matimo-core)](https://pypi.org/project/matimo-core/)
6
+ [![Python](https://img.shields.io/pypi/pyversions/matimo-core)](https://pypi.org/project/matimo-core/)
7
+ [![Docs](https://img.shields.io/badge/docs-matimo.dev-blue)](https://matimo.dev/docs)
8
+ [![Tests](https://img.shields.io/badge/tests-658%20passing-brightgreen)](https://github.com/tallclub/matimo)
9
+ [![Coverage](https://img.shields.io/badge/coverage-97%25-brightgreen)](https://github.com/tallclub/matimo)
10
+
11
+ Write tools once in YAML, use them everywhere — with LangChain, CrewAI, MCP, and more.
12
+
13
+ > **Note:** Most users should install [`matimo`](https://pypi.org/project/matimo/) (the convenience wrapper) instead of `matimo-core` directly.
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ ```bash
20
+ pip install matimo-core
21
+ # with framework extras
22
+ pip install "matimo-core[langchain]"
23
+ pip install "matimo-core[crewai]"
24
+ pip install "matimo-core[mcp]"
25
+ pip install "matimo-core[langchain,crewai,mcp]"
26
+ ```
27
+
28
+ ---
29
+
30
+ ## Quick Start
31
+
32
+ ### Factory pattern
33
+
34
+ ```python
35
+ import asyncio
36
+ from matimo import Matimo
37
+
38
+ async def main():
39
+ # Load tools from a directory
40
+ matimo = await Matimo.init('./tools')
41
+ result = await matimo.execute('my_tool', {'param': 'value'})
42
+ print(result)
43
+
44
+ asyncio.run(main())
45
+ ```
46
+
47
+ ### Auto-discover installed providers
48
+
49
+ ```python
50
+ from matimo import Matimo
51
+
52
+ matimo = await Matimo.init(auto_discover=True)
53
+ tools = matimo.list_tools()
54
+ print(f"{len(tools)} tools loaded")
55
+ ```
56
+
57
+ ### Decorator pattern
58
+
59
+ ```python
60
+ from matimo import Matimo, tool, set_global_matimo_instance
61
+
62
+ matimo = await Matimo.init('./tools')
63
+ set_global_matimo_instance(matimo)
64
+
65
+ class MyAgent:
66
+ @tool('slack_send_channel_message')
67
+ async def send_message(self, channel: str, text: str): ...
68
+ # Decorator handles execution automatically
69
+ ```
70
+
71
+ ### LangChain
72
+
73
+ ```python
74
+ from matimo import Matimo
75
+ from matimo.integrations.langchain import convert_tools_to_langchain
76
+ from langchain_openai import ChatOpenAI
77
+ from langchain.agents import AgentExecutor, create_tool_calling_agent
78
+ from langchain_core.prompts import ChatPromptTemplate
79
+
80
+ matimo = await Matimo.init(auto_discover=True)
81
+ lc_tools = convert_tools_to_langchain(
82
+ matimo.list_tools(),
83
+ matimo,
84
+ credentials={'SLACK_BOT_TOKEN': 'xoxb-...'},
85
+ )
86
+ llm = ChatOpenAI(model='gpt-4o-mini')
87
+ prompt = ChatPromptTemplate.from_messages([
88
+ ('system', 'You are a helpful assistant.'),
89
+ ('human', '{input}'),
90
+ ('placeholder', '{agent_scratchpad}'),
91
+ ])
92
+ agent = create_tool_calling_agent(llm, lc_tools, prompt)
93
+ executor = AgentExecutor(agent=agent, tools=lc_tools)
94
+ result = await executor.ainvoke({'input': 'List all Slack channels'})
95
+ ```
96
+
97
+ ### CrewAI
98
+
99
+ ```python
100
+ from matimo import Matimo
101
+ from matimo.integrations.crewai import convert_tools_to_crewai
102
+
103
+ matimo = await Matimo.init(auto_discover=True)
104
+ tools = convert_tools_to_crewai(matimo.list_tools(), matimo)
105
+ ```
106
+
107
+ ### MCP server
108
+
109
+ ```python
110
+ from matimo import Matimo, create_mcp_server, MCPServerOptions
111
+
112
+ matimo = await Matimo.init(auto_discover=True)
113
+ server = await create_mcp_server(matimo, MCPServerOptions(name='my-agent', version='1.0.0'))
114
+ await server.start()
115
+ ```
116
+
117
+ ---
118
+
119
+ ## Core API
120
+
121
+ ### `Matimo.init()`
122
+
123
+ ```python
124
+ from matimo import Matimo, InitOptions
125
+
126
+ matimo = await Matimo.init(
127
+ tool_paths=['./tools', './agent-tools'], # or a single string
128
+ auto_discover=False, # discover installed matimo-* packages
129
+ include_core=True, # include built-in meta-tools
130
+ policy_file='./policy.yaml',
131
+ untrusted_paths=['./agent-tools'],
132
+ skill_paths=['./skills'],
133
+ log_level='info', # silent | error | warn | info | debug
134
+ log_format='json', # json | simple
135
+ on_event=my_event_handler,
136
+ on_hitl=my_approval_callback,
137
+ )
138
+ ```
139
+
140
+ ### Key methods
141
+
142
+ | Method | Description |
143
+ |--------|-------------|
144
+ | `await matimo.execute(name, params)` | Execute a tool by name |
145
+ | `matimo.list_tools()` | Return all loaded `ToolDefinition` objects |
146
+ | `matimo.get_tool(name)` | Get a single `ToolDefinition` (or `None`) |
147
+ | `matimo.search_tools(query)` | Text search over tool names + descriptions |
148
+ | `await matimo.reload()` | Hot-reload tools from disk |
149
+ | `matimo.list_skills()` | Return all loaded skill definitions |
150
+ | `await matimo.semantic_search_skills(query)` | TF-IDF search over skills |
151
+ | `matimo.has_policy()` | Whether a policy engine is active |
152
+
153
+ ---
154
+
155
+ ## Tool YAML Format
156
+
157
+ ```yaml
158
+ name: my_api_tool
159
+ version: '1.0.0'
160
+ description: Fetch data from an API
161
+ parameters:
162
+ query:
163
+ type: string
164
+ required: true
165
+ description: Search query
166
+ execution:
167
+ type: http
168
+ method: GET
169
+ url: 'https://api.example.com/search?q={query}'
170
+ headers:
171
+ Authorization: 'Bearer {API_KEY}'
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Policy Engine
177
+
178
+ ```python
179
+ from matimo import Matimo, InitOptions
180
+
181
+ matimo = await Matimo.init('./tools', InitOptions(
182
+ policy_file='./policy.yaml',
183
+ on_hitl=lambda req: {'approved': True, 'reason': 'auto'},
184
+ ))
185
+ ```
186
+
187
+ `policy.yaml`:
188
+ ```yaml
189
+ allowedDomains:
190
+ - api.github.com
191
+ - api.slack.com
192
+ allowedHttpMethods: [GET, POST]
193
+ allowCommandTools: false
194
+ allowFunctionTools: false
195
+ ```
196
+
197
+ ---
198
+
199
+ ## Secrets Management
200
+
201
+ ```python
202
+ from matimo.mcp.secrets import create_resolver_chain
203
+
204
+ resolver = create_resolver_chain([
205
+ {'type': 'env'},
206
+ {'type': 'dotenv', 'path': '.env'},
207
+ {'type': 'vault', 'address': 'http://vault:8200'},
208
+ {'type': 'aws', 'region': 'us-east-1'},
209
+ ])
210
+ token = await resolver.resolve('SLACK_BOT_TOKEN')
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Logging
216
+
217
+ ```python
218
+ from matimo import Matimo
219
+ from matimo.logging import get_global_matimo_logger
220
+
221
+ matimo = await Matimo.init('./tools', log_level='info', log_format='json')
222
+ logger = get_global_matimo_logger()
223
+ logger.info('Tool executed', {'tool': 'slack_send_channel_message'})
224
+ ```
225
+
226
+ ---
227
+
228
+ ## Meta-Tools (Agent Tool Lifecycle)
229
+
230
+ Built-in tools that let agents manage other tools at runtime:
231
+
232
+ | Tool | Purpose | Requires Approval |
233
+ |------|---------|:-----------------:|
234
+ | `matimo_validate_tool` | Validate YAML definition | No |
235
+ | `matimo_create_tool` | Write new tool to disk | Yes |
236
+ | `matimo_approve_tool` | Promote draft → approved | Yes |
237
+ | `matimo_reload_tools` | Hot-reload registry | Yes |
238
+ | `matimo_list_user_tools` | List agent-created tools | No |
239
+ | `matimo_get_tool_status` | Check approval state | Yes |
240
+ | `matimo_create_skill` | Create a SKILL.md | Yes |
241
+ | `matimo_list_skills` | List available skills | No |
242
+ | `matimo_get_skill` | Read skill content | No |
243
+ | `matimo_validate_skill` | Validate skill spec | No |
244
+
245
+ ---
246
+
247
+ ## Documentation
248
+
249
+ - [Getting Started](https://matimo.dev/docs/getting-started/QUICK_START)
250
+ - [Full API Reference](https://matimo.dev/docs/api-reference/SDK)
251
+ - [LangChain Integration](https://matimo.dev/docs/framework-integrations/LANGCHAIN)
252
+ - [CrewAI Integration](https://matimo.dev/docs/framework-integrations/CREWAI)
253
+ - [MCP Guide](https://matimo.dev/docs/MCP)
254
+ - [Policy & Lifecycle](https://matimo.dev/docs/api-reference/POLICY_AND_LIFECYCLE)
255
+ - [Meta-Tools Reference](https://matimo.dev/docs/api-reference/META_TOOLS)
256
+
257
+ ---
258
+
259
+ ## Links
260
+
261
+ - **PyPI:** https://pypi.org/project/matimo-core/
262
+ - **Docs:** https://matimo.dev/docs
263
+ - **GitHub:** https://github.com/tallclub/matimo
264
+ - **Changelog:** https://github.com/tallclub/matimo/blob/main/docs/RELEASES.md
265
+