agentic-flow 1.1.1 β†’ 1.1.3

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 (32) hide show
  1. package/README.md +305 -158
  2. package/dist/agents/directApiAgent.js +108 -22
  3. package/dist/cli-proxy.js +120 -22
  4. package/dist/proxy/anthropic-to-openrouter.js +5 -1
  5. package/dist/router/providers/gemini.js +102 -0
  6. package/dist/router/router.js +65 -7
  7. package/dist/utils/logger.js +4 -0
  8. package/dist/utils/modelOptimizer.js +22 -22
  9. package/docs/PACKAGE_STRUCTURE.md +199 -0
  10. package/package.json +2 -1
  11. package/.claude/commands/coordination/README.md +0 -9
  12. package/.claude/commands/coordination/agent-spawn.md +0 -25
  13. package/.claude/commands/coordination/init.md +0 -44
  14. package/.claude/commands/coordination/orchestrate.md +0 -43
  15. package/.claude/commands/coordination/spawn.md +0 -45
  16. package/.claude/commands/coordination/swarm-init.md +0 -85
  17. package/.claude/commands/coordination/task-orchestrate.md +0 -25
  18. package/.claude/commands/memory/README.md +0 -9
  19. package/.claude/commands/memory/memory-persist.md +0 -25
  20. package/.claude/commands/memory/memory-search.md +0 -25
  21. package/.claude/commands/memory/memory-usage.md +0 -25
  22. package/.claude/commands/memory/neural.md +0 -47
  23. package/.claude/commands/memory/usage.md +0 -46
  24. package/dist/cli.js +0 -158
  25. package/dist/coordination/parallelSwarm.js +0 -226
  26. package/dist/index-with-proxy.js +0 -101
  27. package/dist/mcp/fastmcp/tools/memory/retrieve.js +0 -38
  28. package/dist/mcp/fastmcp/tools/memory/search.js +0 -41
  29. package/dist/mcp/fastmcp/tools/memory/store.js +0 -56
  30. package/docs/.claude-flow/metrics/agent-metrics.json +0 -1
  31. package/docs/.claude-flow/metrics/performance.json +0 -9
  32. package/docs/.claude-flow/metrics/task-metrics.json +0 -10
package/README.md CHANGED
@@ -1,31 +1,58 @@
1
1
  # πŸ€– Agentic Flow
2
2
 
3
- **Ephemeral AI Agent Orchestration Framework with Multi-Model Router, OpenRouter Integration & Free Local Inference**
3
+ **Production-Ready AI Agent Orchestration with Multi-Model Router, OpenRouter Integration & Free Local Inference**
4
4
 
5
- Deploy autonomous multi-agent swarms with **99% cost savings** via OpenRouter integration. Features intelligent multi-model routing with **100+ LLM models** at 1/100th the cost, plus **100% free local CPU/GPU inference** via ONNX Runtime for privacy-sensitive workloads. Agents spin up on-demand, execute complex tasks, and automatically terminate.
5
+ Agentic Flow works with any agent or command built or used in Claude Code. It automatically runs through the Claude Agent SDK, forming swarms of intelligent, cost and performance-optimized agents that decide how to execute each task. Built for business, government, and commercial use where cost, traceability, and reliability matter.
6
6
 
7
- Built on **[Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk)** by Anthropic, powered by **[Claude Flow](https://github.com/ruvnet/claude-flow)** (101 MCP tools), **[Flow Nexus](https://github.com/ruvnet/flow-nexus)** (96 cloud tools), **[OpenRouter](https://openrouter.ai)** (100+ LLM models), **[Agentic Payments](https://www.npmjs.com/package/agentic-payments)** (payment authorization), and **ONNX Runtime** (free local CPU or GPU inference).
7
+ Agentic Flow runs Claude Code agents at near zero cost without rewriting a thing. It routes every task to the cheapest lane that still meets the bar. Local ONNX when privacy or price wins. OpenRouter for breadth. Gemini for speed. Anthropic when quality matters most. One agent. Any model. Lowest viable cost.
8
+
9
+ The system takes the Claude SDK's logic and merges it with Claude Flow memory to give every agent a durable brain. Each run logs inputs, outputs, and route decisions with artifacts, manifests, and checksums for proof and reproducibility. It self-optimizes in real time, balancing price, latency, and accuracy through a simple policy file.
10
+
11
+ Strict mode keeps sensitive data offline. Economy mode prefers ONNX or OpenRouter. Premium mode goes Anthropic first. The policy defines the rules, and the swarm enforces them automatically.
12
+
13
+ It runs anywhere: local for dev, Docker for CI, or Flow Nexus for scale. With project-scoped settings, explicit tool allowlists, and an offline privacy lane, it stays secure by default.
14
+
15
+ **Agentic Flow is the framework for autonomous efficiencyβ€”one unified runner for every Claude Code agent, self-tuning, self-routing, and built for real-world deployment.**
16
+
17
+ Built on **[Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk)** by Anthropic, powered by **[Claude Flow](https://github.com/ruvnet/claude-flow)** (101 MCP tools), **[Flow Nexus](https://github.com/ruvnet/flow-nexus)** (96 cloud tools), **[OpenRouter](https://openrouter.ai)** (100+ LLM models), **Google Gemini** (fast, cost-effective inference), **[Agentic Payments](https://www.npmjs.com/package/agentic-payments)** (payment authorization), and **ONNX Runtime** (free local CPU or GPU inference).
8
18
 
9
19
  [![npm version](https://img.shields.io/npm/v/agentic-flow.svg)](https://www.npmjs.com/package/agentic-flow)
20
+ [![npm downloads](https://img.shields.io/npm/dm/agentic-flow.svg)](https://www.npmjs.com/package/agentic-flow)
21
+ [![npm total downloads](https://img.shields.io/npm/dt/agentic-flow.svg)](https://www.npmjs.com/package/agentic-flow)
10
22
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
11
23
  [![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen)](https://nodejs.org/)
24
+ [![rUv](https://img.shields.io/badge/by-rUv-purple.svg)](https://github.com/ruvnet/)
25
+ [![Agentic Engineering](https://img.shields.io/badge/Agentic-Engineering-orange.svg)](https://github.com/ruvnet/agentic-flow#-agent-types)
12
26
 
13
27
  ---
14
28
 
15
29
  ## Why Agentic Flow?
16
30
 
17
- Traditional AI frameworks require persistent infrastructure and complex orchestration. **Agentic Flow** takes a different approach by combining the power of Anthropic's **Claude Agent SDK**, the orchestration capabilities of **Claude Flow**, OpenRouter's **100+ LLM models**, and the cloud infrastructure of **Flow Nexus**:
31
+ **The Problem:** You need agents that actually complete tasks, not chatbots that need constant supervision. Long-running workflows - migrating codebases, generating documentation, analyzing datasets - shouldn't require you to sit there clicking "continue."
32
+
33
+ **What True Agentic Systems Need:**
34
+ - **Autonomy** - Agents that plan, execute, and recover from errors without hand-holding
35
+ - **Persistence** - Tasks that run for hours, even when you're offline
36
+ - **Collaboration** - Multiple agents coordinating on complex work
37
+ - **Tool Access** - Real capabilities: file systems, APIs, databases, not just text generation
38
+ - **Cost Control** - Run cheap models for grunt work, expensive ones only when needed
39
+
40
+ **What You Get:**
18
41
 
19
- - **99% Cost Savings** - OpenRouter integration with Llama 3.1, DeepSeek, Gemini
20
- - **Deploy Anywhere** - Local development, Docker containers, or cloud sandboxes
21
- - **Ephemeral by Design** - Agents exist only while working, minimizing costs
22
- - **Full MCP Support** - 203+ tools locally and in containers, cloud-ready
23
- - **Auto-Scaling** - Spawn 1 or 100 agents based on workload
24
- - **Zero Infrastructure** - No databases, queues, or persistent services required
25
- - **Production-Ready** - Built on battle-tested Claude Agent SDK v0.1.5
26
- - **Model Flexibility** - Use Claude, OpenRouter, or free local ONNX models
42
+ - **150+ Specialized Agents** - Researcher, coder, reviewer, tester, architect - each with domain expertise and tool access
43
+ - **Multi-Agent Swarms** - Deploy 3, 10, or 100 agents that collaborate via shared memory to complete complex projects
44
+ - **Long-Running Tasks** - Agents persist through hours-long operations: full codebase refactors, comprehensive audits, dataset processing
45
+ - **213 MCP Tools** - Agents have real capabilities: GitHub operations, neural network training, workflow automation, memory persistence
46
+ - **Auto Model Optimization** - `--optimize` flag intelligently selects best model for each task. DeepSeek R1 costs 85% less than Claude with similar quality. Save $2,400/month on 100 daily reviews.
47
+ - **Deploy Anywhere** - Same agentic capabilities locally, in Docker/Kubernetes, or cloud sandboxes
27
48
 
28
- > **Deploy your way:** Run locally for development (all 203 tools), containerize for production (Docker/Kubernetes), or scale in cloud sandboxes (Flow Nexus E2B). **Use OpenRouter for 99% cost savings** or ONNX for 100% free local inference.
49
+ **Real Agentic Use Cases:**
50
+ - **Overnight Code Migration** - Deploy a swarm to migrate a 50K line codebase from JavaScript to TypeScript while you sleep
51
+ - **Continuous Security Audits** - Agents monitor repos, analyze PRs, and flag vulnerabilities 24/7
52
+ - **Automated API Development** - One agent designs schema, another implements endpoints, a third writes tests - all coordinated
53
+ - **Data Pipeline Processing** - Agents process TBs of data across distributed sandboxes, checkpoint progress, and recover from failures
54
+
55
+ > **True autonomy at commodity prices.** Your agents work independently on long-running tasks, coordinate when needed, and cost pennies per hour instead of dollars.
29
56
 
30
57
  ### Built on Industry Standards
31
58
 
@@ -40,7 +67,7 @@ Traditional AI frameworks require persistent infrastructure and complex orchestr
40
67
 
41
68
  ## πŸš€ Quick Start
42
69
 
43
- ### Installation
70
+ ### Local Installation (Recommended for Development)
44
71
 
45
72
  ```bash
46
73
  # Global installation
@@ -48,29 +75,11 @@ npm install -g agentic-flow
48
75
 
49
76
  # Or use directly with npx (no installation)
50
77
  npx agentic-flow --help
51
- ```
52
78
 
53
- ### Configuration Wizard (Interactive Setup)
54
-
55
- ```bash
56
- # Launch interactive configuration wizard
57
- npx agentic-flow config
58
-
59
- # Or use direct commands
60
- npx agentic-flow config set ANTHROPIC_API_KEY sk-ant-xxxxx
61
- npx agentic-flow config set PROVIDER anthropic
62
- npx agentic-flow config list
79
+ # Set your API key
80
+ export ANTHROPIC_API_KEY=sk-ant-...
63
81
  ```
64
82
 
65
- The wizard helps you configure:
66
- - **API Keys** - Anthropic, OpenRouter with validation
67
- - **Provider Settings** - Choose default provider (anthropic/openrouter/onnx)
68
- - **Model Selection** - Set default models
69
- - **Custom Paths** - Configure agents directory
70
- - **Advanced Options** - Proxy port, feature flags
71
-
72
- All configuration is saved to `.env` with helpful comments.
73
-
74
83
  ### Your First Agent (Local Execution)
75
84
 
76
85
  ```bash
@@ -180,7 +189,7 @@ docker run --rm \
180
189
  - **Pay-Per-Use** - Only pay for actual sandbox runtime (β‰ˆ$1/hour)
181
190
 
182
191
  ### πŸ€– Intelligent Agents
183
- - **75 Pre-Built Specialists** - Researchers, coders, testers, reviewers, architects
192
+ - **150+ Pre-Built Specialists** - Researchers, coders, testers, reviewers, architects
184
193
  - **Swarm Coordination** - Agents collaborate via shared memory
185
194
  - **Tool Access** - 200+ MCP tools for GitHub, neural networks, workflows
186
195
  - **Custom Agents** - Define your own in YAML with system prompts
@@ -351,35 +360,34 @@ spec:
351
360
  }
352
361
  ```
353
362
 
354
- ### ⚠️ AWS Lambda (Limited - Not Recommended)
355
- ```javascript
356
- // Lambda limitations: No MCP subprocesses, only 6 in-SDK tools
357
- exports.handler = async (event) => {
358
- // ❌ claude-flow MCP server won't work (subprocess not allowed)
359
- // ❌ flow-nexus MCP server won't work (subprocess not allowed)
360
- // βœ… Only claude-flow-sdk in-SDK tools available (6 tools)
361
-
362
- const result = await query({
363
- prompt: event.query,
364
- options: {
365
- mcpServers: {
366
- 'claude-flow-sdk': claudeFlowSdkServer // Only 6 tools work
367
- // 'claude-flow': subprocess blocked by Lambda
368
- // 'flow-nexus': subprocess blocked by Lambda
369
- }
370
- }
371
- });
363
+ ### πŸ”“ ONNX Local Inference (Free Offline AI)
372
364
 
373
- return { statusCode: 200, body: JSON.stringify(result) };
374
- };
365
+ **Run agents completely offline with zero API costs:**
366
+
367
+ ```bash
368
+ # Auto-downloads Phi-4 model (~4.9GB one-time download)
369
+ npx agentic-flow \
370
+ --agent coder \
371
+ --task "Build a REST API" \
372
+ --provider onnx
373
+
374
+ # Router auto-selects ONNX for privacy-sensitive tasks
375
+ npx agentic-flow \
376
+ --agent researcher \
377
+ --task "Analyze confidential medical records" \
378
+ --privacy high \
379
+ --local-only
375
380
  ```
376
381
 
377
- **Why Lambda Doesn't Work Well:**
378
- - ❌ Cannot spawn MCP subprocess servers (npx blocked)
379
- - ❌ No access to 197 tools (101 claude-flow + 96 flow-nexus)
380
- - ❌ No persistent memory (Claude Flow memory unavailable)
381
- - ❌ Limited to 6 in-SDK tools only
382
- - βœ… **Solution**: Use Flow Nexus sandboxes instead for full functionality
382
+ **ONNX Capabilities:**
383
+ - βœ… 100% free local inference (Microsoft Phi-4 model)
384
+ - βœ… Privacy: All processing stays on your machine
385
+ - βœ… Offline: No internet required after model download
386
+ - βœ… Performance: ~6 tokens/sec CPU, 60-300 tokens/sec GPU
387
+ - βœ… Auto-download: Model fetches automatically on first use
388
+ - βœ… Quantized: INT4 optimization for efficiency (~4.9GB total)
389
+ - ⚠️ Limited to 6 in-SDK tools (no subprocess MCP servers)
390
+ - πŸ“š See [docs](docs/ONNX_INTEGRATION.md) for full capabilities
383
391
 
384
392
  ---
385
393
 
@@ -441,50 +449,174 @@ Docker: Infrastructure costs (AWS/GCP/Azure) + Claude API costs.*
441
449
  - **`production-validator`** - Deployment readiness checks
442
450
  - **`tdd-london-swarm`** - Test-driven development
443
451
 
444
- *Use `npx agentic-flow --list` to see all 75 agents*
452
+ *Use `npx agentic-flow --list` to see all 150+ agents*
453
+
454
+ ---
455
+
456
+ ## 🎯 Model Optimization (NEW!)
457
+
458
+ **Automatically select the optimal model for any agent and task**, balancing quality, cost, and speed based on your priorities.
459
+
460
+ ### Why Model Optimization?
461
+
462
+ Different tasks need different models:
463
+ - **Production code** β†’ Claude Sonnet 4.5 (highest quality)
464
+ - **Code reviews** β†’ DeepSeek R1 (85% cheaper, nearly same quality)
465
+ - **Simple functions** β†’ Llama 3.1 8B (99% cheaper)
466
+ - **Privacy-critical** β†’ ONNX Phi-4 (free, local, offline)
467
+
468
+ **The optimizer analyzes your agent type + task complexity and recommends the best model automatically.**
469
+
470
+ ### Quick Examples
471
+
472
+ ```bash
473
+ # Let the optimizer choose (balanced quality vs cost)
474
+ npx agentic-flow --agent coder --task "Build REST API" --optimize
475
+
476
+ # Optimize for lowest cost
477
+ npx agentic-flow --agent coder --task "Simple function" --optimize --priority cost
478
+
479
+ # Optimize for highest quality
480
+ npx agentic-flow --agent reviewer --task "Security audit" --optimize --priority quality
481
+
482
+ # Optimize for speed
483
+ npx agentic-flow --agent researcher --task "Quick analysis" --optimize --priority speed
484
+
485
+ # Set maximum budget ($0.001 per task)
486
+ npx agentic-flow --agent coder --task "Code cleanup" --optimize --max-cost 0.001
487
+ ```
488
+
489
+ ### Optimization Priorities
490
+
491
+ - **`quality`** (70% quality, 20% speed, 10% cost) - Best results, production code
492
+ - **`balanced`** (40% quality, 40% cost, 20% speed) - Default, good mix
493
+ - **`cost`** (70% cost, 20% quality, 10% speed) - Cheapest, development/testing
494
+ - **`speed`** (70% speed, 20% quality, 10% cost) - Fastest responses
495
+ - **`privacy`** - Local-only models (ONNX), zero cloud API calls
496
+
497
+ ### Model Tier Examples
498
+
499
+ The optimizer chooses from 10+ models across 5 tiers:
500
+
501
+ **Tier 1: Flagship** (premium quality)
502
+ - Claude Sonnet 4.5 - $3/$15 per 1M tokens
503
+ - GPT-4o - $2.50/$10 per 1M tokens
504
+ - Gemini 2.5 Pro - $0.00/$2.00 per 1M tokens
505
+
506
+ **Tier 2: Cost-Effective** (2025 breakthrough models)
507
+ - **DeepSeek R1** - $0.55/$2.19 per 1M tokens (85% cheaper, flagship quality)
508
+ - **DeepSeek Chat V3** - $0.14/$0.28 per 1M tokens (98% cheaper)
509
+
510
+ **Tier 3: Balanced**
511
+ - Gemini 2.5 Flash - $0.07/$0.30 per 1M tokens (fastest)
512
+ - Llama 3.3 70B - $0.30/$0.30 per 1M tokens (open-source)
513
+
514
+ **Tier 4: Budget**
515
+ - Llama 3.1 8B - $0.055/$0.055 per 1M tokens (ultra-low cost)
516
+
517
+ **Tier 5: Local/Privacy**
518
+ - **ONNX Phi-4** - FREE (offline, private, no API)
519
+
520
+ ### Agent-Specific Recommendations
521
+
522
+ The optimizer knows what each agent needs:
523
+
524
+ ```bash
525
+ # Coder agent β†’ prefers high quality (min 85/100)
526
+ npx agentic-flow --agent coder --task "Production API" --optimize
527
+ # β†’ Selects: DeepSeek R1 (quality 90, cost 85)
528
+
529
+ # Researcher agent β†’ flexible, can use cheaper models
530
+ npx agentic-flow --agent researcher --task "Trend analysis" --optimize --priority cost
531
+ # β†’ Selects: Gemini 2.5 Flash (quality 78, cost 98)
532
+
533
+ # Reviewer agent β†’ needs reasoning (min 85/100)
534
+ npx agentic-flow --agent reviewer --task "Security review" --optimize
535
+ # β†’ Selects: DeepSeek R1 (quality 90, reasoning-optimized)
536
+
537
+ # Tester agent β†’ simple tasks, use budget models
538
+ npx agentic-flow --agent tester --task "Unit tests" --optimize --priority cost
539
+ # β†’ Selects: Llama 3.1 8B (cost 95)
540
+ ```
541
+
542
+ ### Cost Savings Examples
543
+
544
+ **Without Optimization** (always using Claude Sonnet 4.5):
545
+ - 100 code reviews/day Γ— $0.08 each = **$8/day = $240/month**
546
+
547
+ **With Optimization** (DeepSeek R1 for reviews):
548
+ - 100 code reviews/day Γ— $0.012 each = **$1.20/day = $36/month**
549
+ - **Savings: $204/month (85% reduction)**
550
+
551
+ ### Comprehensive Model Guide
552
+
553
+ For detailed analysis of all 10 models, see:
554
+ πŸ“– **[Model Capabilities Guide](docs/agentic-flow/benchmarks/MODEL_CAPABILITIES.md)**
555
+
556
+ Includes:
557
+ - Full benchmark results across 6 task types
558
+ - Cost comparison tables
559
+ - Use case decision matrices
560
+ - Performance characteristics
561
+ - Best practices by model
562
+
563
+ ### MCP Tool for Optimization
564
+
565
+ ```javascript
566
+ // Get model recommendation via MCP tool
567
+ await query({
568
+ mcp: {
569
+ server: 'agentic-flow',
570
+ tool: 'agentic_flow_optimize_model',
571
+ params: {
572
+ agent: 'coder',
573
+ task: 'Build REST API with auth',
574
+ priority: 'balanced', // quality | balanced | cost | speed | privacy
575
+ max_cost: 0.01 // optional budget cap in dollars
576
+ }
577
+ }
578
+ });
579
+ ```
580
+
581
+ **Learn More:**
582
+ - See [benchmarks/README.md](docs/agentic-flow/benchmarks/README.md) for quick results
583
+ - Run your own tests: `cd docs/agentic-flow/benchmarks && ./quick-benchmark.sh`
445
584
 
446
585
  ---
447
586
 
448
587
  ## πŸ“‹ Commands
449
588
 
450
- ### Configuration Management
589
+ ### MCP Server Management (Direct Tool Access)
451
590
 
452
591
  ```bash
453
- # Interactive configuration wizard
454
- npx agentic-flow config
592
+ # Start all MCP servers (213 tools)
593
+ npx agentic-flow mcp start
455
594
 
456
- # Direct configuration commands
457
- npx agentic-flow config set ANTHROPIC_API_KEY sk-ant-xxxxx
458
- npx agentic-flow config set OPENROUTER_API_KEY sk-or-v1-xxxxx
459
- npx agentic-flow config set PROVIDER openrouter
460
- npx agentic-flow config set COMPLETION_MODEL meta-llama/llama-3.1-8b-instruct
595
+ # Start specific MCP server
596
+ npx agentic-flow mcp start claude-flow # 101 tools
597
+ npx agentic-flow mcp start flow-nexus # 96 cloud tools
598
+ npx agentic-flow mcp start agentic-payments # Payment tools
461
599
 
462
- # View configuration
463
- npx agentic-flow config list
464
- npx agentic-flow config get PROVIDER
600
+ # List all available MCP tools (213 total)
601
+ npx agentic-flow mcp list
465
602
 
466
- # Manage configuration
467
- npx agentic-flow config delete OPENROUTER_API_KEY
468
- npx agentic-flow config reset
603
+ # Check MCP server status
604
+ npx agentic-flow mcp status
469
605
 
470
- # Get help
471
- npx agentic-flow config help
606
+ # Stop MCP servers
607
+ npx agentic-flow mcp stop [server]
472
608
  ```
473
609
 
474
- **Available Configuration Keys:**
475
- - `ANTHROPIC_API_KEY` - Anthropic API key (validated: must start with `sk-ant-`)
476
- - `OPENROUTER_API_KEY` - OpenRouter API key (validated: must start with `sk-or-`)
477
- - `COMPLETION_MODEL` - Default model name
478
- - `PROVIDER` - Default provider (anthropic, openrouter, onnx)
479
- - `AGENTS_DIR` - Custom agents directory path
480
- - `PROXY_PORT` - Proxy server port (default: 3000)
481
- - `USE_OPENROUTER` - Force OpenRouter usage (true/false)
482
- - `USE_ONNX` - Use ONNX local inference (true/false)
610
+ **MCP Servers Available:**
611
+ - **claude-flow** (101 tools): Neural networks, GitHub integration, workflows, DAA, performance
612
+ - **flow-nexus** (96 tools): E2B sandboxes, distributed swarms, templates, cloud storage
613
+ - **agentic-payments** (10 tools): Payment authorization, Ed25519 signatures, consensus
614
+ - **claude-flow-sdk** (6 tools): In-process memory and swarm coordination
483
615
 
484
616
  ### Basic Operations (Works Locally, Docker, Cloud)
485
617
 
486
618
  ```bash
487
- # List all available agents (75 total)
619
+ # List all available agents (150+ total)
488
620
  npx agentic-flow --list
489
621
 
490
622
  # Run specific agent (local execution)
@@ -497,15 +629,12 @@ npx agentic-flow --agent coder --task "Build API" --stream
497
629
  npx agentic-flow # Requires TOPIC, DIFF, DATASET env vars
498
630
  ```
499
631
 
500
- ### Environment Configuration (Alternative to Config Wizard)
632
+ ### Environment Configuration
501
633
 
502
634
  ```bash
503
- # Required (use config wizard instead for better UX)
635
+ # Required
504
636
  export ANTHROPIC_API_KEY=sk-ant-...
505
637
 
506
- # Or use OpenRouter
507
- export OPENROUTER_API_KEY=sk-or-v1-...
508
-
509
638
  # Agent mode (optional)
510
639
  export AGENT=researcher
511
640
  export TASK="Your task description"
@@ -775,9 +904,34 @@ npx agentic-flow \
775
904
 
776
905
  ---
777
906
 
778
- ## πŸ”§ MCP Tools (203+)
907
+ ## πŸ”§ MCP Tools (213 Total)
779
908
 
780
- Agentic Flow integrates with **four MCP servers** providing 203+ tools:
909
+ Agentic Flow integrates with **four MCP servers** providing 213 tools total:
910
+
911
+ ### Direct MCP Access
912
+
913
+ You can now directly manage MCP servers via the CLI:
914
+
915
+ ```bash
916
+ # Start all MCP servers
917
+ npx agentic-flow mcp start
918
+
919
+ # List all 213 available tools
920
+ npx agentic-flow mcp list
921
+
922
+ # Check server status
923
+ npx agentic-flow mcp status
924
+
925
+ # Start specific server
926
+ npx agentic-flow mcp start claude-flow
927
+ ```
928
+
929
+ **How It Works:**
930
+ 1. **Automatic** (Recommended): Agents automatically access all 213 tools when you run tasks
931
+ 2. **Manual**: Use `npx agentic-flow mcp <command>` for direct server management
932
+ 3. **Integrated**: All tools work seamlessly whether accessed automatically or manually
933
+
934
+ ### Tool Breakdown
781
935
 
782
936
  ### Core Orchestration (claude-flow - 101 tools)
783
937
 
@@ -894,15 +1048,16 @@ Add to your MCP config (`~/.config/claude/mcp.json`):
894
1048
 
895
1049
  ## πŸ” Deployment Comparison
896
1050
 
897
- | Feature | Local | Docker | Flow Nexus Sandboxes | AWS Lambda |
1051
+ | Feature | Local | Docker | Flow Nexus Sandboxes | ONNX Local |
898
1052
  |---------|-------|--------|----------------------|------------|
899
1053
  | **MCP Tools Available** | 203 (100%) | 203 (100%) | 203 (100%) | 6 (3%) |
900
- | **Setup Complexity** | Low | Medium | Medium | High |
901
- | **Cold Start Time** | <500ms | <2s | <2s | <800ms |
902
- | **Cost (Development)** | Free* | Free* | $1/hour | $0.20/1M |
903
- | **Cost (Production)** | Free* | Infra costs | $1/hour | Limited tools |
904
- | **Scaling** | Manual | Orchestrator | Automatic | Automatic |
905
- | **Best For** | Dev/Testing | CI/CD/Prod | Cloud-Scale | ❌ Not Recommended |
1054
+ | **Setup Complexity** | Low | Medium | Medium | Low |
1055
+ | **Cold Start Time** | <500ms | <2s | <2s | ~2s (first load) |
1056
+ | **Cost (Development)** | Free* | Free* | $1/hour | $0 (100% free) |
1057
+ | **Cost (Production)** | Free* | Infra costs | $1/hour | $0 (100% free) |
1058
+ | **Privacy** | Local | Local | Cloud | 100% Offline |
1059
+ | **Scaling** | Manual | Orchestrator | Automatic | Manual |
1060
+ | **Best For** | Dev/Testing | CI/CD/Prod | Cloud-Scale | Privacy/Offline |
906
1061
 
907
1062
  *Free infrastructure, Claude API costs only
908
1063
 
@@ -1033,63 +1188,55 @@ spec:
1033
1188
  - Implement PodDisruptionBudgets
1034
1189
  - All 203 MCP tools available
1035
1190
 
1036
- ### ⚠️ Serverless Functions (Limited - Not Recommended)
1191
+ ### πŸ’‘ ONNX Local Inference - Extended Configuration
1037
1192
 
1038
- #### AWS Lambda (Restricted)
1193
+ **Advanced ONNX setup with router integration:**
1039
1194
 
1040
1195
  ```javascript
1041
- // ❌ THIS WON'T WORK AS EXPECTED
1042
- // Lambda blocks subprocess spawning, breaking MCP servers
1043
-
1044
- import { query } from '@anthropic-ai/claude-agent-sdk';
1045
- import { claudeFlowSdkServer } from './mcp/claudeFlowSdkServer.js';
1046
-
1047
- export const handler = async (event) => {
1048
- const result = await query({
1049
- prompt: event.task,
1050
- options: {
1051
- permissionMode: 'bypassPermissions',
1052
- mcpServers: {
1053
- // βœ… Works: In-SDK server (6 tools)
1054
- 'claude-flow-sdk': claudeFlowSdkServer,
1055
-
1056
- // ❌ Blocked: Cannot spawn subprocess
1057
- // 'claude-flow': { command: 'npx', args: [...] },
1058
-
1059
- // ❌ Blocked: Cannot spawn subprocess
1060
- // 'flow-nexus': { command: 'npx', args: [...] }
1196
+ // router.config.json - Auto-route privacy tasks to ONNX
1197
+ {
1198
+ "routing": {
1199
+ "rules": [
1200
+ {
1201
+ "condition": { "privacy": "high", "localOnly": true },
1202
+ "action": { "provider": "onnx" }
1203
+ },
1204
+ {
1205
+ "condition": { "cost": "free" },
1206
+ "action": { "provider": "onnx" }
1061
1207
  }
1208
+ ]
1209
+ },
1210
+ "providers": {
1211
+ "onnx": {
1212
+ "modelPath": "./models/phi-4/model.onnx",
1213
+ "maxTokens": 2048,
1214
+ "temperature": 0.7
1062
1215
  }
1063
- });
1064
-
1065
- return { statusCode: 200, body: JSON.stringify(result) };
1066
- };
1216
+ }
1217
+ }
1067
1218
  ```
1068
1219
 
1069
- **Lambda Limitations:**
1070
- | Feature | Status | Notes |
1071
- |---------|--------|-------|
1072
- | Claude Agent SDK | βœ… Works | Core SDK functions normally |
1073
- | In-SDK MCP Tools | βœ… Works | 6 tools from claude-flow-sdk |
1074
- | Claude Flow MCP | ❌ Blocked | Cannot spawn `npx claude-flow` subprocess |
1075
- | Flow Nexus MCP | ❌ Blocked | Cannot spawn `npx flow-nexus` subprocess |
1076
- | Persistent Memory | ❌ Unavailable | Claude Flow memory requires subprocess |
1077
- | Total Tools | 6/203 | Only 3% of tools work |
1220
+ **Performance Benchmarks:**
1221
+ | Metric | CPU (Intel i7) | GPU (NVIDIA RTX 3060) |
1222
+ |--------|---------------|----------------------|
1223
+ | Tokens/sec | ~6 | 60-300 |
1224
+ | First Token | ~2s | ~500ms |
1225
+ | Model Load | ~3s | ~2s |
1226
+ | Memory Usage | ~2GB | ~3GB |
1227
+ | Cost | $0 | $0 |
1078
1228
 
1079
- **Why Lambda Fails:**
1080
- 1. **Subprocess Restrictions**: Lambda blocks `child_process.spawn()` for security
1081
- 2. **No npx**: Cannot run `npx claude-flow` or `npx flow-nexus`
1082
- 3. **Memory Architecture**: Persistent memory requires subprocess MCP server
1083
- 4. **File System**: Read-only `/tmp` prevents MCP server file operations
1084
-
1085
- **Solution: Use Flow Nexus sandboxes instead** - Full 203 tool support with Lambda-triggered sandbox execution:
1086
-
1087
- ```javascript
1088
- // βœ… RECOMMENDED: Lambda triggers Flow Nexus sandbox
1089
- import { flowNexus } from 'flow-nexus';
1229
+ **Use Cases:**
1230
+ - βœ… Privacy-sensitive data processing
1231
+ - βœ… Offline/air-gapped environments
1232
+ - βœ… Cost-conscious development
1233
+ - βœ… Compliance requirements (HIPAA, GDPR)
1234
+ - βœ… Prototype/testing without API costs
1090
1235
 
1091
- export const handler = async (event) => {
1092
- // Lambda just orchestrates - execution happens in sandbox
1236
+ **Documentation:**
1237
+ - [ONNX Integration Guide](docs/ONNX_INTEGRATION.md)
1238
+ - [ONNX CLI Usage](docs/ONNX_CLI_USAGE.md)
1239
+ - [ONNX vs Claude Quality Analysis](docs/ONNX_VS_CLAUDE_QUALITY.md)
1093
1240
  const sandbox = await flowNexus.sandboxCreate({
1094
1241
  template: 'node',
1095
1242
  env_vars: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY }
@@ -1225,16 +1372,16 @@ npx agentic-flow --agent flow-nexus-sandbox \
1225
1372
  | **Concurrent Agents** | 10+ on t3.small, 100+ on c6a.xlarge |
1226
1373
  | **Token Efficiency** | 32% reduction via swarm coordination |
1227
1374
 
1228
- ### Cost Analysis (AWS Lambda arm64)
1375
+ ### Cost Analysis - ONNX vs Cloud APIs
1229
1376
 
1230
- | Memory | Duration | Cost per Invocation | Monthly (10K requests) |
1231
- |--------|----------|---------------------|------------------------|
1232
- | 1GB | 30s | $0.0008 | $8 |
1233
- | 2GB | 30s | $0.0016 | $16 |
1234
- | 2GB | 60s | $0.0032 | $32 |
1235
- | 4GB | 60s | $0.0064 | $64 |
1377
+ | Provider | Model | Tokens/sec | Cost per 1M tokens | Monthly (100K tasks) |
1378
+ |----------|-------|------------|-------------------|---------------------|
1379
+ | ONNX Local | Phi-4 | 6-300 | $0 | $0 |
1380
+ | OpenRouter | Llama 3.1 8B | API | $0.06 | $6 |
1381
+ | OpenRouter | DeepSeek | API | $0.14 | $14 |
1382
+ | Claude | Sonnet 3.5 | API | $3.00 | $300 |
1236
1383
 
1237
- *Free tier: 400,000 GB-seconds/month*
1384
+ **ONNX Savings:** Up to $3,600/year for typical development workloads
1238
1385
 
1239
1386
  ---
1240
1387