matimo-examples 0.1.0-alpha.12 → 0.1.0-alpha.13

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.
@@ -0,0 +1,316 @@
1
+ # Quick Command Reference
2
+
3
+ Fast validation of all Matimo implementations.
4
+
5
+ > ⚠️ **Important:** Matimo is a **pnpm monorepo**. Use `pnpm` commands, not `npm`. The `workspace:*` protocol is pnpm-specific and not supported by npm.
6
+
7
+ ## Test Everything (2-5 minutes)
8
+
9
+ ```bash
10
+ cd /path/to/matimo
11
+
12
+ # Build the project
13
+ pnpm build
14
+
15
+ # Change to examples directory
16
+ cd examples/tools
17
+
18
+ # Option A: Validate all implementations in batch
19
+ pnpm validate:all # Runs all examples with auto-approval
20
+ pnpm validate:meta # Only meta-tools
21
+ pnpm validate:policy # Only policy
22
+ pnpm validate:skills # Only skills
23
+
24
+ # Option B: Run specific category examples
25
+ # Meta/Demo Examples
26
+ pnpm meta:flow # Meta-tools integration (most comprehensive)
27
+ pnpm policy:demo # Policy engine focus
28
+ pnpm skills:demo # Skills system focus
29
+ pnpm credentials:example # Credentials management
30
+
31
+ # Option C: Run by provider (factory pattern is simplest to start, Please update provider api key in .env ref example.env)
32
+ pnpm agent:factory # Base agent example
33
+ pnpm slack:factory # Slack provider
34
+ pnpm gmail:factory # Gmail provider
35
+ pnpm github:factory # GitHub provider
36
+ pnpm postgres:factory # PostgreSQL provider
37
+ pnpm notion:factory # Notion provider
38
+ pnpm hubspot:factory # HubSpot provider
39
+ pnpm mailchimp:factory # Mailchimp provider
40
+ pnpm twilio:factory # Twilio provider
41
+
42
+ # Option D: Run by core functionality (decorator pattern)
43
+ pnpm execute:decorator # Execute tool
44
+ pnpm read:decorator # Read tool
45
+ pnpm edit:decorator # Edit tool
46
+ pnpm search:decorator # Search tool
47
+ pnpm web:decorator # Web tool
48
+
49
+ # Option E: Run LangChain integration examples
50
+ pnpm agent:langchain # Full LangChain agent
51
+ pnpm agent:skills-policy # LangChain with skills & policy
52
+ pnpm slack:langchain # Slack with LangChain
53
+ pnpm execute:langchain # Execute with LangChain
54
+ ```
55
+
56
+ ## Available Examples by Category
57
+
58
+ ### Meta/Demo Examples
59
+ | Command | Purpose |
60
+ |---------|---------|
61
+ | `pnpm meta:flow` | Meta-tools integration demo (tool creation, policy, approvals) |
62
+ | `pnpm policy:demo` | Policy engine validation & blocking scenarios |
63
+ | `pnpm skills:demo` | Skills system creation and validation |
64
+ | `pnpm credentials:example` | Credentials management patterns |
65
+
66
+ ### Provider Examples - Factory Pattern
67
+ | Command | Purpose |
68
+ |---------|---------|
69
+ | `pnpm agent:factory` | Base agent with factory pattern |
70
+ | `pnpm slack:factory` | Slack tools via factory |
71
+ | `pnpm gmail:factory` | Gmail tools via factory |
72
+ | `pnpm github:factory` | GitHub tools via factory |
73
+ | `pnpm postgres:factory` | PostgreSQL tools via factory |
74
+ | `pnpm postgres:approval` | PostgreSQL with approval workflow |
75
+ | `pnpm notion:factory` | Notion tools via factory |
76
+ | `pnpm hubspot:factory` | HubSpot tools via factory |
77
+ | `pnpm mailchimp:factory` | Mailchimp tools via factory |
78
+ | `pnpm twilio:factory` | Twilio tools via factory |
79
+
80
+ ### Provider Examples - Decorator Pattern
81
+ | Command | Purpose |
82
+ |---------|---------|
83
+ | `pnpm agent:decorator` | Base agent with decorator pattern |
84
+ | `pnpm slack:decorator` | Slack tools via decorators |
85
+ | `pnpm gmail:decorator` | Gmail tools via decorators |
86
+ | `pnpm github:decorator` | GitHub tools via decorators |
87
+ | `pnpm postgres:decorator` | PostgreSQL tools via decorators |
88
+ | `pnpm notion:decorator` | Notion tools via decorators |
89
+ | `pnpm hubspot:decorator` | HubSpot tools via decorators |
90
+ | `pnpm mailchimp:decorator` | Mailchimp tools via decorators |
91
+ | `pnpm twilio:decorator` | Twilio tools via decorators |
92
+
93
+ ### Provider Examples - LangChain Pattern
94
+ | Command | Purpose |
95
+ |---------|---------|
96
+ | `pnpm agent:langchain` | Base agent with LangChain integration |
97
+ | `pnpm agent:skills-policy` | LangChain agent with skills & policy |
98
+ | `pnpm slack:langchain` | Slack tools via LangChain |
99
+ | `pnpm gmail:langchain` | Gmail tools via LangChain |
100
+ | `pnpm github:langchain` | GitHub tools via LangChain |
101
+ | `pnpm github:approval` | GitHub with approval workflow |
102
+ | `pnpm postgres:langchain` | PostgreSQL tools via LangChain |
103
+ | `pnpm notion:langchain` | Notion tools via LangChain |
104
+ | `pnpm hubspot:langchain` | HubSpot tools via LangChain |
105
+ | `pnpm mailchimp:langchain` | Mailchimp tools via LangChain |
106
+ | `pnpm twilio:langchain` | Twilio tools via LangChain |
107
+
108
+ ### Core Functionality Examples - Factory Pattern
109
+ | Command | Purpose |
110
+ |---------|---------|
111
+ | `pnpm execute:factory` | Execute commands via factory |
112
+ | `pnpm read:factory` | Read files via factory |
113
+ | `pnpm edit:factory` | Edit files via factory |
114
+ | `pnpm search:factory` | Search files via factory |
115
+ | `pnpm web:factory` | Web scraping via factory |
116
+
117
+ ### Core Functionality Examples - Decorator Pattern
118
+ | Command | Purpose |
119
+ |---------|---------|
120
+ | `pnpm execute:decorator` | Execute commands via decorators |
121
+ | `pnpm read:decorator` | Read files via decorators |
122
+ | `pnpm edit:decorator` | Edit files via decorators |
123
+ | `pnpm search:decorator` | Search files via decorators |
124
+ | `pnpm web:decorator` | Web scraping via decorators |
125
+
126
+ ### Core Functionality Examples - LangChain Pattern
127
+ | Command | Purpose |
128
+ |---------|---------|
129
+ | `pnpm execute:langchain` | Execute commands via LangChain |
130
+ | `pnpm read:langchain` | Read files via LangChain |
131
+ | `pnpm edit:langchain` | Edit files via LangChain |
132
+ | `pnpm search:langchain` | Search files via LangChain |
133
+ | `pnpm web:langchain` | Web scraping via LangChain |
134
+
135
+ ### Validation Commands
136
+ | Command | Purpose |
137
+ |---------|---------|
138
+ | `pnpm validate:all` | Run meta examples with auto-approval |
139
+ | `pnpm validate:meta` | Only meta-tools example |
140
+ | `pnpm validate:policy` | Only policy demo |
141
+ | `pnpm validate:skills` | Only skills demo |
142
+ | `pnpm validate:impl` | Implementation validation |
143
+
144
+
145
+ ```bash
146
+ # From matimo root
147
+ cd packages/cli
148
+
149
+ # Validate all tools in a directory
150
+ pnpm cli -- doctor packages/core/tools/
151
+
152
+ # List pending and approved tools
153
+ pnpm cli -- review list
154
+
155
+ # Approve a tool (requires computed HMAC)
156
+ pnpm cli -- review approve calculator --secret <hmac-hash>
157
+
158
+ # Reject/revoke a tool
159
+ pnpm cli -- review reject calculator
160
+ ```
161
+
162
+ ## Test Coverage
163
+
164
+ ```bash
165
+ cd /path/to/matimo
166
+
167
+ # Test policy engine (100% coverage expected)
168
+ pnpm test -- packages/core/test/unit/policy/
169
+
170
+ # Test skills system (100% coverage expected)
171
+ pnpm test -- packages/core/test/unit/skills/
172
+
173
+ # Test CLI commands (doctor, review, skills, etc.)
174
+ pnpm test -- packages/cli/test/unit/commands/
175
+
176
+ # Full project coverage
177
+ pnpm test:coverage # Shows summary and detailed report
178
+ ```
179
+
180
+ ## Quick Validation Checklist
181
+
182
+ ```bash
183
+ # 1. Does meta-tools example run without errors?
184
+ npx tsx examples/tools/meta-flow/meta-tools-integration.ts --help
185
+ # Expected: Shows agent setup messages, or --help info
186
+
187
+ # 2. Does policy engine block dangerous tools?
188
+ cd examples/tools
189
+ printf "y\ny\ny\ny\ny\ny\n" | npx tsx policy/policy-demo.ts 2>&1 | grep -i "blocked\|error" | head -10
190
+ # Expected: Multiple "BLOCKED" messages for shell commands, SSRF, etc.
191
+
192
+ # 3. Does skills system create valid SKILL.md files?
193
+ printf "y\ny\ny\n" | npx tsx skills/skills-demo.ts 2>&1 | grep "skill" | grep -i "created\|pass"
194
+ # Expected: Messages about skills being created and validated
195
+
196
+ # 4. Can CLI doctor command validate tools?
197
+ pnpm cli -- doctor packages/core/tools/ 2>&1 | grep -i "valid\|error\|pass" | head -10
198
+ # Expected: Validation results for tools in directory
199
+
200
+ # 5. Can review command manage approvals?
201
+ pnpm cli -- review list 2>&1 | grep -i "pending\|approved\|tool"
202
+ # Expected: Tool status listing (even if empty)
203
+ ```
204
+
205
+ ## What Each Component Validates
206
+
207
+ For detailed validation details and expected outputs, see individual README files:
208
+
209
+ ### Meta-Tools Integration (`meta:flow`)
210
+ 📖 **Full details:** [meta-flow/README.md](./meta-flow/README.md)
211
+
212
+ ✓ Tool creation (matimo_create_tool)
213
+ ✓ Policy validation (matimo_doctor)
214
+ ✓ Human approval (matimo_review)
215
+ ✓ Registry reload (matimo_reload_tools)
216
+ ✓ Tool listing (matimo_list_user_tools)
217
+ ✓ Tool execution after approval
218
+ ✓ Agent learns from policy rejections
219
+
220
+ **Duration:** ~120s | **API Calls:** 12-15 | **Missions:** 5
221
+
222
+ ### Policy Demo (`policy:demo`)
223
+ 📖 **Full details:** [policy/README.md](./policy/README.md)
224
+
225
+ ✓ Safe tool validation passes
226
+ ✓ Shell commands blocked
227
+ ✓ SSRF attacks blocked
228
+ ✓ Namespace hijacking blocked
229
+ ✓ Human approval workflow
230
+ ✓ Risk classification
231
+
232
+ **Duration:** ~90s | **API Calls:** 10-12 | **Missions:** 10
233
+
234
+ ### Skills Demo (`skills:demo`)
235
+ 📖 **Full details:** [skills/README.md](./skills/README.md)
236
+
237
+ ✓ Skill creation with YAML frontmatter
238
+ ✓ Skill listing (Level 1 metadata)
239
+ ✓ Skill content retrieval (Level 2)
240
+ ✓ Spec validation
241
+ ✓ Multi-skill application to code
242
+
243
+ **Duration:** ~60s | **API Calls:** 8-10 | **Missions:** 6
244
+
245
+ ### Credentials Management
246
+ 📖 **Full details:** [credentials/README.md](./credentials/README.md)
247
+
248
+ ✓ Environment variable loading
249
+ ✓ Multi-provider credential setup
250
+ ✓ Credential validation
251
+ ✓ Best practices and patterns
252
+
253
+ ---
254
+
255
+ ## Troubleshooting Quick Fixes
256
+
257
+ | Problem | Fix |
258
+ |---------|-----|
259
+ | "OPENAI_API_KEY not set" | Add to examples/tools/.env |
260
+ | "Agent loops indefinitely" | Increase MAX_ITERATIONS constant |
261
+ | "No human prompt appears" | Ensure approval handler is set |
262
+ | "Module not found: tsx" | `pnpm install -g tsx` or use `npx tsx` |
263
+ | "Tools don't execute" | Verify matimo_reload_tools() called |
264
+ | "Policy doesn't block" | Check PolicyConfig in init() |
265
+
266
+ ---
267
+
268
+ ## Performance Benchmarks
269
+
270
+ | Example | Duration | API Calls | Missions |
271
+ |---------|----------|-----------|----------|
272
+ | meta:flow | ~120s | 12-15 | 5 |
273
+ | policy:demo | ~90s | 10-12 | 10 |
274
+ | skills:demo | ~60s | 8-10 | 6 |
275
+
276
+ (Times depend on LLM latency; gpt-4o-mini is optimized for fast responses)
277
+
278
+ ---
279
+
280
+ ## Report All Results
281
+
282
+ After running validations, check:
283
+
284
+ ```bash
285
+ # cd to Matimo root folder from example/tools
286
+ cd ../..
287
+ # Test results
288
+ pnpm test:coverage 2>&1 | tail -20
289
+
290
+ # Meta-tools: created tools on disk
291
+ ls -la /tmp/matimo-meta-flow-*/tools/*/definition.yaml
292
+
293
+ # Skills: created SKILL.md files
294
+ ls -la /tmp/matimo-skills-demo-*/skills/*/SKILL.md
295
+
296
+ # Policy: validation logs show blocks
297
+ grep -i "blocked\|invalid" /tmp/*.log
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Next: Detailed Information
303
+
304
+ For comprehensive information about each example including validation details, expected output patterns, troubleshooting, and performance metrics, see individual README files:
305
+
306
+ | Example | Documentation |
307
+ |---------|----------------|
308
+ | **Meta-Tools** | [meta-flow/README.md](./meta-flow/README.md) — Tool creation, policy validation, approvals |
309
+ | **Policy Engine** | [policy/README.md](./policy/README.md) — Policy validation, blocking scenarios, risk classification |
310
+ | **Skills System** | [skills/README.md](./skills/README.md) — Skills creation, listing, validation, multi-skill application |
311
+ | **Credentials** | [credentials/README.md](./credentials/README.md) — API key management, environment setup, best practices |
312
+ | **All Examples** | [README.md](./README.md) — Overview of all 50+ examples |
313
+
314
+ ---
315
+
316
+ **Quick tip: When in doubt, run: `pnpm meta:flow`** 🚀
package/README.md CHANGED
@@ -1,65 +1,158 @@
1
- # Matimo + LangChain.js Agent Examples
1
+ # Matimo Examples - All Patterns, Providers & Features
2
2
 
3
- Three complete, production-ready AI agent examples showing how to integrate **Matimo SDK** with **LangChain.js**.
3
+ **Complete collection of production-ready examples** demonstrating Matimo SDK integration across:
4
+ - **Three calling patterns** (LangChain Official, Decorator, Factory)
5
+ - **10+ providers** (Slack, Gmail, GitHub, PostgreSQL, Notion, HubSpot, Mailchimp, Twilio, etc.)
6
+ - **Core features** (Execute, Read, Edit, Search, Web scraping)
7
+ - **Advanced capabilities** (Policy validation, Skills system, Meta-tools, Credentials)
4
8
 
5
9
  ## 🎯 What These Examples Demonstrate
6
10
 
7
11
  ✅ **Framework-Independent Tool Execution:**
8
-
9
12
  - Matimo loads and manages tools independently
10
13
  - Tools work the same way in any framework (LangChain, CrewAI, etc.)
11
14
  - No tool redefinition needed across frameworks
12
- - Simple adapter layer for LangChain integration
13
-
14
- ✅ **Three SDK Calling Patterns:**
15
-
16
- 1. **LangChain Official API** (Recommended): Use `createAgent()` with `tool()` function
17
- - Simplest, fastest, most maintainable approach
18
- - LangChain handles tool selection and calling automatically
19
- - Use when: You want production-ready, framework-native integration
15
+ - Simple adapter layer for any framework integration
20
16
 
17
+ ✅ **Three SDK Calling Patterns (Demonstrated Everywhere):**
18
+ 1. **LangChain Official API** (⭐ Recommended): Use `createAgent()` with `tool()` function
21
19
  2. **Decorator Pattern**: Use `@tool(toolName)` decorator on methods
22
- - Decorator intercepts calls → executes via Matimo
23
- - Use when: You want method-based calling style
24
-
25
20
  3. **Factory Pattern**: Direct `matimo.execute(toolName, params)` calls
26
- - Call Matimo directly → tool executes
27
- - Use when: You prefer functional style
28
21
 
29
- ✅ **Full LangChain Integration:**
22
+ ✅ **10+ Provider Integrations:**
23
+ - Slack, Gmail, GitHub, PostgreSQL, Notion, HubSpot, Mailchimp, Twilio (each with 3 patterns)
24
+ - Approval workflows (PostgreSQL, GitHub)
30
25
 
31
- - Real OpenAI GPT-4 agent with multi-step reasoning
32
- - Tool orchestration with natural language understanding
33
- - Matimo stays independent of LangChain's details
26
+ **Core Functionality Examples:**
27
+ - Execute system commands
28
+ - Read files from disk
29
+ - Edit/modify files
30
+ - Search code/files
31
+ - Web scraping & HTTP requests
34
32
 
35
- ✅ **Production Ready:**
33
+ ✅ **Advanced Features:**
34
+ - Meta-tools (tool creation, policy checking, approvals)
35
+ - Policy validation & blocking
36
+ - Skills system (define reusable skill components)
37
+ - Credentials management
38
+ - Human-in-the-loop approval workflows
36
39
 
40
+ ✅ **Production Ready:**
37
41
  - Independent npm package setup
38
- - Environment variable management
42
+ - Environment variable management
39
43
  - Proper TypeScript configuration
40
44
  - Clean imports from Matimo SDK
41
45
 
42
- ## 📦 Quick Start
46
+ ## 🚀 Quick Start: Pick Your Path
47
+
48
+ ### Setup (All Examples)
49
+ ```bash
50
+ # 1. Install dependencies
51
+ pnpm install
52
+
53
+ # 2. Setup environment
54
+ cp .env.example .env
55
+ echo "OPENAI_API_KEY=sk-your-key-here" >> .env # From: https://platform.openai.com/api-keys
56
+ ```
43
57
 
44
- ### 1. Install Dependencies
58
+ ### Choose Your Learning Path
45
59
 
60
+ **👉 First time? Start here:**
46
61
  ```bash
47
- npm install
62
+ pnpm agent:langchain # ⭐ Simplest integration (recommended)
48
63
  ```
49
64
 
50
- This installs LangChain, Matimo SDK, and all required dependencies.
65
+ **👉 Want to explore all examples?**
66
+ ```bash
67
+ # See QUICK_COMMANDS.md for complete reference (50+ examples)
68
+ # Or run batch validation:
69
+ pnpm validate:all
70
+ ```
51
71
 
52
- ### 2. Setup Environment
72
+ **👉 Want to dive into providers?**
73
+ ```bash
74
+ pnpm slack:factory # Try any provider (factory/decorator/langchain)
75
+ pnpm gmail:langchain
76
+ pnpm github:decorator
77
+ ```
53
78
 
79
+ **👉 Want to test core features?**
54
80
  ```bash
55
- # Copy environment template
56
- cp .env.example .env
81
+ pnpm execute:factory # Execute, read, edit, search, web
82
+ pnpm search:langchain
83
+ pnpm web:decorator
84
+ ```
85
+
86
+ **👉 Want advanced features?**
87
+ ```bash
88
+ pnpm meta:flow # Meta-tools + policy + approvals
89
+ pnpm policy:demo
90
+ pnpm skills:demo
91
+ ```
92
+
93
+ ---
94
+
95
+ ## 📋 All Available Examples
96
+
97
+ For complete reference of all 50+ examples, see [QUICK_COMMANDS.md](./QUICK_COMMANDS.md).
98
+
99
+ Quick reference:
100
+
101
+ ### Meta/Demo Examples
102
+ ```bash
103
+ pnpm meta:flow # Meta-tools integration (most comprehensive)
104
+ pnpm policy:demo # Policy engine validation
105
+ pnpm skills:demo # Skills system
106
+ pnpm credentials:example # Credentials management
107
+ ```
108
+
109
+ ### Provider Examples (Pick Pattern)
110
+ ```bash
111
+ # Slack (3 patterns):
112
+ pnpm slack:factory | pnpm slack:decorator | pnpm slack:langchain
113
+
114
+ # Gmail (3 patterns):
115
+ pnpm gmail:factory | pnpm gmail:decorator | pnpm gmail:langchain
116
+
117
+ # GitHub (3 patterns + approval workflow):
118
+ pnpm github:factory | pnpm github:decorator | pnpm github:langchain | pnpm github:approval
119
+
120
+ # PostgreSQL (3 patterns + approval workflow):
121
+ pnpm postgres:factory | pnpm postgres:decorator | pnpm postgres:langchain | pnpm postgres:approval
122
+
123
+ # Notion, HubSpot, Mailchimp, Twilio (same 3-pattern structure)
124
+ ```
125
+
126
+ ### Core Functionality Examples (3 patterns each)
127
+ ```bash
128
+ # Execute system commands:
129
+ pnpm execute:factory | pnpm execute:decorator | pnpm execute:langchain
130
+
131
+ # Read files:
132
+ pnpm read:factory | pnpm read:decorator | pnpm read:langchain
57
133
 
58
- # Add your OpenAI API key
59
- # Get key from: https://platform.openai.com/api-keys
60
- echo "OPENAI_API_KEY=sk-your-key-here" >> .env
134
+ # Edit files:
135
+ pnpm edit:factory | pnpm edit:decorator | pnpm edit:langchain
136
+
137
+ # Search:
138
+ pnpm search:factory | pnpm search:decorator | pnpm search:langchain
139
+
140
+ # Web scraping:
141
+ pnpm web:factory | pnpm web:decorator | pnpm web:langchain
61
142
  ```
62
143
 
144
+ ### Agent Examples
145
+ ```bash
146
+ pnpm agent:factory # Factory pattern agent
147
+ pnpm agent:decorator # Decorator pattern agent
148
+ pnpm agent:langchain # LangChain Official API (⭐ recommended)
149
+ pnpm agent:skills-policy # LangChain with skills & policy
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 🌟 Deep Dive: Three Calling Patterns
155
+
63
156
  ### 3. Run LangChain Official API Agent (⭐ Recommended)
64
157
 
65
158
  ```bash
@@ -195,32 +288,57 @@ Result returned to LangChain
195
288
 
196
289
  ## 🔀 Patterns Compared
197
290
 
198
- | Aspect | LangChain Official | Decorator | Factory |
199
- | -------------------- | -------------------------- | ----------------------------------- | ------------------------ |
200
- | **Call Style** | `createAgent()` + `tool()` | `await agent.method()` | `await matimo.execute()` |
201
- | **Complexity** | ~100 lines | ~200 lines (with dynamic dispatch) | ~150 lines |
202
- | **Schema** | Automatic from Zod | Inferred from method signature | Manual mapping |
203
- | **Tool Binding** | Native LangChain | Decorator intercept with reflection | Direct call |
204
- | **Scalability** | ✅ Great | ✅ Excellent (no routing code) | ✅ Great |
205
- | **Type Safety** | ✅ Yes | ✅ Yes (full TS support) | ✅ Yes |
206
- | **Recommended** | **For frameworks** | ⭐ **For class-based agents** | For functional style |
207
- | **Production Ready** | Yes | Yes | Yes |
291
+ | Aspect | LangChain Official | Decorator | Factory |
292
+ | --------------------- | -------------------------- | ------------------------------------ | ------------------------ |
293
+ | **Call Style** | `createAgent()` + `tool()` | `await agent.method()` | `await matimo.execute()` |
294
+ | **Complexity** | ~100 lines | ~200 lines (with dynamic dispatch) | ~150 lines |
295
+ | **Schema** | Automatic from Zod | Inferred from method signature | Manual mapping |
296
+ | **Tool Binding** | Native LangChain | Decorator intercept + reflection | Direct call |
297
+ | **Scalability** | ✅ Great | ✅ Excellent (no routing code) | ✅ Great |
298
+ | **Type Safety** | ✅ Yes | ✅ Yes (full TS support) | ✅ Yes |
299
+ | **Best For** | Framework integration | Class-based agents | Functional style |
300
+ | **Recommended** | **Start here** | **For class apps** | For direct calls |
301
+ | **Production Ready** | ✅ Yes | ✅ Yes | ✅ Yes |
302
+ | **Works With** | All providers & features | All providers & features | All providers & features |
208
303
 
209
304
  ## 📁 Project Structure
210
305
 
211
- ````
306
+ ```
212
307
  examples/tools/
213
- ├── agents/
308
+ ├── agents/ # Agent examples (3 patterns)
214
309
  │ ├── langchain-agent.ts # ⭐ LangChain Official API (recommended)
215
310
  │ ├── decorator-pattern-agent.ts # Uses @tool decorator with MatimoInstance
216
- └── factory-pattern-agent.ts # Uses matimo.execute() with MatimoInstance
217
- ├── package.json # Standalone dependencies (LangChain, Matimo, etc.)
311
+ ├── factory-pattern-agent.ts # Uses matimo.execute() with MatimoInstance
312
+ │ └── langchain-skills-policy-agent.ts # LangChain with skills & policy
313
+ ├── slack/ # Slack provider (3 patterns)
314
+ ├── gmail/ # Gmail provider (3 patterns)
315
+ ├── github/ # GitHub provider (3 patterns + approval)
316
+ ├── postgres/ # PostgreSQL provider (3 patterns + approval)
317
+ ├── notion/ # Notion provider (3 patterns)
318
+ ├── hubspot/ # HubSpot provider (3 patterns)
319
+ ├── mailchimp/ # Mailchimp provider (3 patterns)
320
+ ├── twilio/ # Twilio provider (3 patterns)
321
+ ├── execute/ # Execute/run commands (3 patterns)
322
+ ├── read/ # Read files (3 patterns)
323
+ ├── edit/ # Edit files (3 patterns)
324
+ ├── search/ # Search files (3 patterns)
325
+ ├── web/ # Web scraping (3 patterns)
326
+ ├── meta-flow/ # Meta-tools integration demo
327
+ ├── policy/ # Policy engine demo
328
+ ├── skills/ # Skills system demo
329
+ ├── credentials/ # Credentials management
330
+ ├── package.json # Dependencies (LangChain, Matimo, etc.)
218
331
  ├── tsconfig.json # TypeScript configuration
219
- ├── .env.example # Environment template (OPENAI_API_KEY)
220
- ├── test-agents.ts # Testing script for tool verification
332
+ ├── .env.example # Environment template
333
+ ├── QUICK_COMMANDS.md # Complete reference (50+ examples)
221
334
  └── README.md # This file
222
335
 
223
- All agents load tools from: `../../tools/` (parent project's tool definitions)
336
+ **Key:** All examples load tools from: `../../tools/` (parent project's tool definitions)
337
+ **Pattern:** Each category (provider, feature) has 3 file variants:
338
+ - `*-factory.ts` — Use MatimoInstance.execute()
339
+ - `*-decorator.ts` — Use @tool() decorators
340
+ - `*-langchain.ts` — Use LangChain Official API
341
+ ```
224
342
 
225
343
  ## 🔄 SDK Patterns Explained
226
344
 
@@ -500,11 +618,20 @@ npm run agent:langchain # or agent:decorator, agent:factory
500
618
 
501
619
  ## 📚 Next Steps
502
620
 
503
- 1. **Try all three agents** - compare patterns: `npm run agent:langchain`, `agent:decorator`, `agent:factory`
504
- 2. **Modify agent queries** in `agents/*.ts` - change the example prompts
505
- 3. **Add custom tools** to `../../tools/` - they auto-appear in all agents
506
- 4. **Extend the agents** - add memory, streaming, custom system prompts
507
- 5. **Deploy to production** - use Matimo REST API or MCP server
621
+ ### Beginner
622
+ 1. **Run all three agent patterns** compare approaches: `npm run agent:langchain`, `agent:decorator`, `agent:factory`
623
+ 2. **Try a provider** pick Slack/Gmail/GitHub: `npm run slack:factory`, `npm run github:langchain`, etc.
624
+ 3. **Test core features** execute, read, edit: `npm run execute:factory`, `npm run read:langchain`, etc.
625
+
626
+ ### Intermediate
627
+ 4. **Modify example prompts** — edit `agents/*.ts` or provider files to change queries
628
+ 5. **Add custom tools** — create `../../tools/custom-tool/definition.yaml`, they auto-appear in all examples
629
+ 6. **Extend agents** — add memory, streaming, custom system prompts, better error handling
630
+
631
+ ### Advanced
632
+ 7. **Use advanced features** — try `npm run meta:flow` (meta-tools), `pnpm policy:demo` (validation), `pnpm skills:demo` (reusable skills)
633
+ 8. **Implement approvals** — try PostgreSQL/GitHub approval workflows: `npm run postgres:approval`, `npm run github:approval`
634
+ 9. **Deploy to production** — use Matimo REST API (Phase 2) or MCP server for Claude integration
508
635
 
509
636
  ## 🔗 Related Documentation
510
637
 
@@ -516,10 +643,26 @@ npm run agent:langchain # or agent:decorator, agent:factory
516
643
 
517
644
  ## 💡 Key Takeaway
518
645
 
519
- This example proves Matimo's core value proposition:
646
+ These examples prove Matimo's core value proposition:
520
647
 
521
648
  **Define tools ONCE in YAML** ↓
522
- **Use them EVERYWHERE**: LangChain (3 patterns), SDK, CrewAI, MCP, REST, CLI
649
+ **Use them with THREE calling patterns** (LangChain, Decorator, Factory)
650
+ **Use them with TEN+ providers** (Slack, Gmail, GitHub, PostgreSQL, Notion, HubSpot, Mailchimp, Twilio, etc.) ↓
651
+ **Use them with FIVE core features** (Execute, Read, Edit, Search, Web) ↓
652
+ **Use them with advanced capabilities** (Meta-tools, Policy, Skills, Approvals) ↓
653
+ **Use them EVERYWHERE**: LangChain, SDK, CrewAI, MCP, REST API, CLI ↓
654
+
523
655
  **Zero duplication. Pure productivity.**
524
656
 
525
- All three agents use the exact same Matimo tools with different SDK patterns. That's the Matimo difference.
657
+ All examples use the exact same Matimo tools with different patterns, providers, and frameworks. **That's the Matimo difference.**
658
+
659
+ ---
660
+
661
+ ### 📖 For Complete Reference
662
+
663
+ See [QUICK_COMMANDS.md](./QUICK_COMMANDS.md) for:
664
+ - All 50+ example commands organized by category
665
+ - Complete provider list with all three patterns
666
+ - Core functionality examples (execute, read, edit, search, web)
667
+ - Meta/demo examples (meta-tools, policy, skills, credentials)
668
+ - Validation & testing commands