agentic-flow 1.1.11 β 1.1.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.
package/README.md
CHANGED
|
@@ -1,526 +1,267 @@
|
|
|
1
1
|
# π€ Agentic Flow
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/agentic-flow)
|
|
4
|
+
[](https://www.npmjs.com/package/agentic-flow)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://nodejs.org/)
|
|
7
|
+
[](https://github.com/ruvnet/)
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
**Production-ready AI agent orchestration with 66+ specialized agents, 213 MCP tools, and multi-model routing (Anthropic, OpenRouter, Gemini, ONNX).**
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
---
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
# Start standalone proxy
|
|
11
|
-
npx agentic-flow proxy --provider gemini
|
|
13
|
+
## π Introduction
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
export ANTHROPIC_BASE_URL=http://localhost:3000
|
|
15
|
-
export ANTHROPIC_API_KEY=sk-ant-proxy-dummy-key
|
|
16
|
-
claude # Now using Gemini instead of Anthropic!
|
|
17
|
-
```
|
|
15
|
+
Agentic Flow is a framework for running AI agents at scale with intelligent cost optimization. It runs any Claude Code agent through the [Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk), automatically routing tasks to the cheapest model that meets quality requirements.
|
|
18
16
|
|
|
19
|
-
**
|
|
20
|
-
- β
**
|
|
21
|
-
- β
**
|
|
22
|
-
- β
**
|
|
23
|
-
- β
**
|
|
17
|
+
**Key Capabilities:**
|
|
18
|
+
- β
**66 Specialized Agents** - Pre-built experts for coding, research, review, testing, DevOps
|
|
19
|
+
- β
**213 MCP Tools** - Memory, GitHub, neural networks, sandboxes, workflows, payments
|
|
20
|
+
- β
**Multi-Model Router** - Anthropic, OpenRouter (100+ models), Gemini, ONNX (free local)
|
|
21
|
+
- β
**Cost Optimization** - 85-99% savings with DeepSeek, Llama, Gemini vs Claude
|
|
22
|
+
- β
**Standalone Proxy** - Use Gemini/OpenRouter with Claude Code at 85% cost savings
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
**Built On:**
|
|
25
|
+
- [Claude Agent SDK](https://docs.claude.com/en/api/agent-sdk) by Anthropic
|
|
26
|
+
- [Claude Flow](https://github.com/ruvnet/claude-flow) - 101 MCP tools
|
|
27
|
+
- [Flow Nexus](https://github.com/ruvnet/flow-nexus) - 96 cloud tools
|
|
28
|
+
- [OpenRouter](https://openrouter.ai) - 100+ LLM models
|
|
29
|
+
- [Agentic Payments](https://www.npmjs.com/package/agentic-payments) - Multi-agent payments
|
|
26
30
|
|
|
27
31
|
---
|
|
28
32
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
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.
|
|
32
|
-
|
|
33
|
-
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.
|
|
34
|
-
|
|
35
|
-
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.
|
|
36
|
-
|
|
37
|
-
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.
|
|
33
|
+
## π Quick Start
|
|
38
34
|
|
|
39
|
-
|
|
35
|
+
### Option 1: CLI Agent Execution (Fastest)
|
|
40
36
|
|
|
41
|
-
|
|
37
|
+
Run specialized agents for coding, research, testing, and more:
|
|
42
38
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
[](https://opensource.org/licenses/MIT)
|
|
47
|
-
[](https://nodejs.org/)
|
|
48
|
-
[](https://github.com/ruvnet/)
|
|
49
|
-
[](https://github.com/ruvnet/agentic-flow#-agent-types)
|
|
39
|
+
```bash
|
|
40
|
+
# Install globally
|
|
41
|
+
npm install -g agentic-flow
|
|
50
42
|
|
|
51
|
-
|
|
43
|
+
# Run with Claude (Anthropic)
|
|
44
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
45
|
+
npx agentic-flow --agent coder --task "Build a REST API with authentication"
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
# Run with OpenRouter (99% cost savings)
|
|
48
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
49
|
+
npx agentic-flow --agent coder --task "Build REST API" --model "meta-llama/llama-3.1-8b-instruct"
|
|
54
50
|
|
|
55
|
-
|
|
51
|
+
# Run with Gemini (free tier)
|
|
52
|
+
export GOOGLE_GEMINI_API_KEY=AIza...
|
|
53
|
+
npx agentic-flow --agent coder --task "Build REST API" --provider gemini
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
- **Collaboration** - Multiple agents coordinating on complex work
|
|
61
|
-
- **Tool Access** - Real capabilities: file systems, APIs, databases, not just text generation
|
|
62
|
-
- **Cost Control** - Run cheap models for grunt work, expensive ones only when needed
|
|
55
|
+
# List all 66 available agents
|
|
56
|
+
npx agentic-flow --list
|
|
57
|
+
```
|
|
63
58
|
|
|
64
|
-
**
|
|
59
|
+
**Available Agents:**
|
|
60
|
+
- `coder`, `reviewer`, `tester`, `planner`, `researcher`
|
|
61
|
+
- `backend-dev`, `mobile-dev`, `ml-developer`, `cicd-engineer`
|
|
62
|
+
- `pr-manager`, `code-review-swarm`, `release-manager`
|
|
63
|
+
- `perf-analyzer`, `production-validator`, `system-architect`
|
|
64
|
+
- And 50+ more...
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
- **Multi-Agent Swarms** - Deploy 3, 10, or 100 agents that collaborate via shared memory to complete complex projects
|
|
68
|
-
- **Long-Running Tasks** - Agents persist through hours-long operations: full codebase refactors, comprehensive audits, dataset processing
|
|
69
|
-
- **213 MCP Tools** - Agents have real capabilities: GitHub operations, neural network training, workflow automation, memory persistence
|
|
70
|
-
- **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.
|
|
71
|
-
- **Deploy Anywhere** - Same agentic capabilities locally, in Docker/Kubernetes, or cloud sandboxes
|
|
66
|
+
---
|
|
72
67
|
|
|
73
|
-
|
|
74
|
-
- **Overnight Code Migration** - Deploy a swarm to migrate a 50K line codebase from JavaScript to TypeScript while you sleep
|
|
75
|
-
- **Continuous Security Audits** - Agents monitor repos, analyze PRs, and flag vulnerabilities 24/7
|
|
76
|
-
- **Automated API Development** - One agent designs schema, another implements endpoints, a third writes tests - all coordinated
|
|
77
|
-
- **Data Pipeline Processing** - Agents process TBs of data across distributed sandboxes, checkpoint progress, and recover from failures
|
|
68
|
+
### Option 2: MCP Tools (Direct Access)
|
|
78
69
|
|
|
79
|
-
|
|
70
|
+
Access 213 MCP tools for memory, swarms, GitHub, neural networks, and cloud sandboxes:
|
|
80
71
|
|
|
81
|
-
|
|
72
|
+
```bash
|
|
73
|
+
# Start all MCP servers (213 tools) - stdio transport
|
|
74
|
+
npx agentic-flow mcp start
|
|
82
75
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
- **[Flow Nexus](https://github.com/ruvnet/flow-nexus)** - 96 cloud tools for sandboxes, distributed swarms, workflows
|
|
86
|
-
- **[OpenRouter](https://openrouter.ai)** - Access to 100+ LLM models at 99% cost savings (Llama, DeepSeek, Gemini, etc.)
|
|
87
|
-
- **[Agentic Payments](https://www.npmjs.com/package/agentic-payments)** - Multi-agent payment authorization with Ed25519 cryptography
|
|
88
|
-
- **[ONNX Runtime](https://onnxruntime.ai)** - Free local CPU/GPU inference with Microsoft Phi-4
|
|
76
|
+
# List all available tools
|
|
77
|
+
npx agentic-flow mcp list
|
|
89
78
|
|
|
90
|
-
|
|
79
|
+
# Check server status
|
|
80
|
+
npx agentic-flow mcp status
|
|
91
81
|
|
|
92
|
-
|
|
82
|
+
# Use tools in any agent automatically
|
|
83
|
+
export ENABLE_CLAUDE_FLOW_SDK=true
|
|
84
|
+
npx agentic-flow --agent coder --task "Store config in memory using memory_store"
|
|
85
|
+
```
|
|
93
86
|
|
|
94
|
-
|
|
87
|
+
**MCP Transports:**
|
|
88
|
+
- **stdio** (default): Standard input/output for Claude Desktop integration
|
|
89
|
+
- **HTTP/SSE** (new): HTTP server with Server-Sent Events for web apps
|
|
95
90
|
|
|
96
91
|
```bash
|
|
97
|
-
#
|
|
98
|
-
npm
|
|
99
|
-
|
|
100
|
-
#
|
|
101
|
-
|
|
92
|
+
# Start HTTP/SSE server on port 8080
|
|
93
|
+
npm run mcp:http
|
|
94
|
+
# Endpoints:
|
|
95
|
+
# - HTTP: http://localhost:8080/mcp
|
|
96
|
+
# - SSE: http://localhost:8080/sse
|
|
97
|
+
# - Health: http://localhost:8080/health
|
|
102
98
|
|
|
103
|
-
#
|
|
104
|
-
|
|
99
|
+
# Start stdio server (default)
|
|
100
|
+
npm run mcp:stdio
|
|
105
101
|
```
|
|
106
102
|
|
|
107
|
-
|
|
103
|
+
**MCP Tool Categories:**
|
|
104
|
+
- **Agentic Flow** (6 tools): Agent execution, creation, optimization, model selection
|
|
105
|
+
- **Claude Flow SDK** (6 tools): In-process memory and swarm coordination
|
|
106
|
+
- **Claude Flow** (101 tools): Neural networks, GitHub, workflows, performance, DAA
|
|
107
|
+
- **Flow Nexus** (96 tools): E2B sandboxes, distributed swarms, templates, storage
|
|
108
|
+
- **Agentic Payments** (10 tools): Payment authorization, Ed25519 signatures, consensus
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### Option 3: Standalone Proxy (NEW in v1.1.11)
|
|
108
113
|
|
|
109
|
-
Use Gemini or OpenRouter with
|
|
114
|
+
Use Gemini or OpenRouter with Claude Code at 85-90% cost savings:
|
|
110
115
|
|
|
111
116
|
```bash
|
|
112
|
-
# Terminal 1: Start proxy
|
|
117
|
+
# Terminal 1: Start proxy server
|
|
113
118
|
export GOOGLE_GEMINI_API_KEY=your-key-here
|
|
114
119
|
npx agentic-flow proxy
|
|
115
120
|
|
|
116
|
-
# Terminal 2: Use Claude Code
|
|
121
|
+
# Terminal 2: Use Claude Code with proxy
|
|
117
122
|
export ANTHROPIC_BASE_URL=http://localhost:3000
|
|
118
123
|
export ANTHROPIC_API_KEY=sk-ant-proxy-dummy-key
|
|
119
|
-
claude # Now uses Gemini
|
|
124
|
+
claude # Now uses Gemini instead of Anthropic!
|
|
120
125
|
|
|
121
|
-
# Or
|
|
126
|
+
# Or use OpenRouter (90% savings)
|
|
122
127
|
npx agentic-flow proxy --provider openrouter --model "openai/gpt-4o-mini"
|
|
123
128
|
```
|
|
124
129
|
|
|
125
130
|
**Features:**
|
|
126
|
-
- β
MCP tools work through proxy (
|
|
131
|
+
- β
MCP tools work through proxy (all 213 tools)
|
|
127
132
|
- β
Compatible with Claude Code official CLI
|
|
128
|
-
- β
Future Cursor IDE support (
|
|
133
|
+
- β
Future Cursor IDE support (waiting for ANTHROPIC_BASE_URL)
|
|
129
134
|
- β
85-90% cost savings vs direct Anthropic API
|
|
130
135
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
**Cost Savings:**
|
|
137
|
+
| Provider | Model | Cost per 1M tokens | Savings |
|
|
138
|
+
|----------|-------|-------------------|---------|
|
|
139
|
+
| Anthropic | Claude Sonnet 4.5 | $3.00 | Baseline |
|
|
140
|
+
| Gemini (proxy) | gemini-2.0-flash | $0.00 (free tier) | **100%** |
|
|
141
|
+
| OpenRouter (proxy) | gpt-4o-mini | $0.15 | **95%** |
|
|
142
|
+
| OpenRouter (proxy) | deepseek-v3 | $0.014 | **99.5%** |
|
|
134
143
|
|
|
135
|
-
|
|
136
|
-
# Run locally with full 203 MCP tool access (Claude)
|
|
137
|
-
npx agentic-flow \
|
|
138
|
-
--agent researcher \
|
|
139
|
-
--task "Analyze microservices architecture trends in 2025"
|
|
144
|
+
π **See [Standalone Proxy Guide](docs/STANDALONE_PROXY_GUIDE.md) for details**
|
|
140
145
|
|
|
141
|
-
|
|
142
|
-
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
143
|
-
npx agentic-flow \
|
|
144
|
-
--agent coder \
|
|
145
|
-
--task "Build a REST API with authentication" \
|
|
146
|
-
--model "meta-llama/llama-3.1-8b-instruct"
|
|
146
|
+
---
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
```
|
|
148
|
+
## π Tutorial: Agent Execution
|
|
150
149
|
|
|
151
|
-
###
|
|
150
|
+
### 1. Basic Agent Usage
|
|
152
151
|
|
|
153
|
-
|
|
154
|
-
# 3 agents work in parallel on your machine
|
|
155
|
-
export TOPIC="API security best practices"
|
|
156
|
-
export DIFF="feat: add OAuth2 authentication"
|
|
157
|
-
export DATASET="API response times last 30 days"
|
|
158
|
-
|
|
159
|
-
npx agentic-flow # Spawns: researcher + code-reviewer + data-analyst
|
|
160
|
-
```
|
|
152
|
+
**What it does:** Runs a specialized agent with Claude SDK and all 213 MCP tools.
|
|
161
153
|
|
|
162
|
-
**
|
|
163
|
-
- β
All 203 MCP tools work (full subprocess support)
|
|
164
|
-
- β
Fast iteration and debugging
|
|
165
|
-
- β
No cloud costs during development
|
|
166
|
-
- β
Full access to local filesystem and resources
|
|
167
|
-
|
|
168
|
-
### Docker Deployment (Production)
|
|
154
|
+
**When to use:** Quick tasks that need one expert (code review, API generation, testing).
|
|
169
155
|
|
|
170
156
|
```bash
|
|
171
|
-
#
|
|
172
|
-
|
|
157
|
+
# Code generation
|
|
158
|
+
npx agentic-flow --agent coder --task "Create a REST API with OAuth2 authentication"
|
|
173
159
|
|
|
174
|
-
#
|
|
175
|
-
|
|
176
|
-
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
177
|
-
agentic-flow \
|
|
178
|
-
--agent researcher \
|
|
179
|
-
--task "Analyze cloud patterns"
|
|
160
|
+
# Security review
|
|
161
|
+
npx agentic-flow --agent reviewer --task "Review this code for security vulnerabilities"
|
|
180
162
|
|
|
181
|
-
#
|
|
182
|
-
|
|
183
|
-
-e OPENROUTER_API_KEY=sk-or-v1-... \
|
|
184
|
-
agentic-flow \
|
|
185
|
-
--agent coder \
|
|
186
|
-
--task "Build REST API" \
|
|
187
|
-
--model "meta-llama/llama-3.1-8b-instruct"
|
|
163
|
+
# Test generation
|
|
164
|
+
npx agentic-flow --agent tester --task "Write comprehensive tests for this API"
|
|
188
165
|
```
|
|
189
166
|
|
|
190
|
-
**
|
|
191
|
-
-
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
195
|
-
- β
Isolated execution environment
|
|
196
|
-
|
|
197
|
-
---
|
|
198
|
-
|
|
199
|
-
## β¨ Key Features
|
|
200
|
-
|
|
201
|
-
### π Ephemeral Architecture
|
|
202
|
-
- **On-Demand Spawning** - Agents created only when needed
|
|
203
|
-
- **Automatic Cleanup** - Terminate after task completion
|
|
204
|
-
- **Stateless Execution** - No persistent state between runs
|
|
205
|
-
- **Cost-Optimized** - Pay only for actual compute time
|
|
206
|
-
|
|
207
|
-
### π€ Multi-Model Router with ONNX Local Inference
|
|
208
|
-
- **Intelligent Provider Routing** - Automatic selection between Anthropic, OpenRouter, and ONNX based on task requirements
|
|
209
|
-
- **100% Free Local Inference** - ONNX Runtime CPU/GPU execution with Microsoft Phi-4 (zero API costs)
|
|
210
|
-
- **Privacy-First Processing** - GDPR/HIPAA-compliant local processing for sensitive workloads
|
|
211
|
-
- **Cost Optimization** - Route privacy tasks to free ONNX, complex reasoning to cloud APIs
|
|
212
|
-
- **Rule-Based Routing** - Automatic provider selection based on privacy, cost, and performance
|
|
213
|
-
- **GPU Acceleration Ready** - CPU inference at 6 tokens/sec, GPU capable of 60-300 tokens/sec
|
|
214
|
-
- **Zero-Cost Agents** - Run agents entirely offline with local ONNX models
|
|
215
|
-
|
|
216
|
-
### π» Local Development (Full Features)
|
|
217
|
-
- **Native Execution** - Run directly on macOS, Linux, Windows
|
|
218
|
-
- **All 203 MCP Tools** - Full subprocess support, no restrictions
|
|
219
|
-
- **Fast Iteration** - Instant feedback, no cold starts
|
|
220
|
-
- **Persistent Memory** - Claude Flow memory persists across runs
|
|
221
|
-
- **File System Access** - Full access to local files and directories
|
|
222
|
-
- **Git Integration** - Direct GitHub operations and repository management
|
|
223
|
-
- **Zero Cloud Costs** - Free during development
|
|
224
|
-
|
|
225
|
-
### π³ Container Deployment (Production Ready)
|
|
226
|
-
- **Docker Support** - Complete feature set for ECS, Cloud Run, Kubernetes
|
|
227
|
-
- **All 203 MCP Tools** - Full subprocess support in containers
|
|
228
|
-
- **Reproducible Builds** - Same environment across dev/staging/prod
|
|
229
|
-
- **Orchestration Ready** - Works with Kubernetes Jobs, ECS Tasks, Cloud Run
|
|
230
|
-
- **Health Checks Built-in** - `/health` endpoint for load balancers
|
|
231
|
-
- **Resource Controls** - CPU/memory limits via container configs
|
|
232
|
-
|
|
233
|
-
### βοΈ Cloud Sandboxes (Scalable Execution)
|
|
234
|
-
- **Flow Nexus E2B Sandboxes** - Fully isolated execution environments
|
|
235
|
-
- **All 203 MCP Tools** - Complete tool access in cloud sandboxes
|
|
236
|
-
- **Multi-Language Templates** - Node.js, Python, React, Next.js
|
|
237
|
-
- **Real-Time Streaming** - Live output and monitoring
|
|
238
|
-
- **Auto-Scaling** - Spin up 1 to 100+ sandboxes on demand
|
|
239
|
-
- **Pay-Per-Use** - Only pay for actual sandbox runtime (β$1/hour)
|
|
240
|
-
|
|
241
|
-
### π€ Intelligent Agents
|
|
242
|
-
- **150+ Pre-Built Specialists** - Researchers, coders, testers, reviewers, architects
|
|
243
|
-
- **Swarm Coordination** - Agents collaborate via shared memory
|
|
244
|
-
- **Tool Access** - 200+ MCP tools for GitHub, neural networks, workflows
|
|
245
|
-
- **Custom Agents** - Define your own in YAML with system prompts
|
|
246
|
-
|
|
247
|
-
### π Observability
|
|
248
|
-
- **Real-Time Streaming** - See agent output as it happens
|
|
249
|
-
- **Structured Logging** - JSON logs for aggregation and analysis
|
|
250
|
-
- **Performance Metrics** - Track agent duration, tool usage, token consumption
|
|
251
|
-
- **Health Checks** - Built-in healthcheck endpoint for orchestrators
|
|
167
|
+
**Technical Details:**
|
|
168
|
+
- Uses Claude Agent SDK's `query()` function
|
|
169
|
+
- Automatically loads agent's system prompt from `.claude/agents/`
|
|
170
|
+
- All 213 MCP tools available via `mcpServers` configuration
|
|
171
|
+
- Streams output in real-time with `--stream` flag
|
|
252
172
|
|
|
253
173
|
---
|
|
254
174
|
|
|
255
|
-
|
|
175
|
+
### 2. Multi-Agent Swarms
|
|
256
176
|
|
|
257
|
-
|
|
177
|
+
**What it does:** Runs 3 agents in parallel for complex workflows.
|
|
258
178
|
|
|
259
|
-
**
|
|
179
|
+
**When to use:** Multi-faceted tasks requiring research + coding + analysis.
|
|
260
180
|
|
|
261
181
|
```bash
|
|
262
|
-
#
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
267
|
-
|
|
268
|
-
# Run any agent locally
|
|
269
|
-
npx agentic-flow --agent coder --task "Build REST API"
|
|
182
|
+
# Set environment variables
|
|
183
|
+
export TOPIC="API security best practices"
|
|
184
|
+
export DIFF="feat: add OAuth2 authentication"
|
|
185
|
+
export DATASET="API response times last 30 days"
|
|
270
186
|
|
|
271
|
-
#
|
|
272
|
-
npx agentic-flow
|
|
187
|
+
# Run parallel swarm (researcher + code-reviewer + data-analyst)
|
|
188
|
+
npx agentic-flow
|
|
273
189
|
```
|
|
274
190
|
|
|
275
|
-
**
|
|
276
|
-
-
|
|
277
|
-
-
|
|
278
|
-
-
|
|
279
|
-
-
|
|
280
|
-
- β
**Git Integration**: Full GitHub operations
|
|
281
|
-
- β
**Memory Persistence**: Claude Flow memory persists across runs
|
|
282
|
-
- β
**Easy Debugging**: Standard Node.js debugging tools work
|
|
283
|
-
|
|
284
|
-
**System Requirements:**
|
|
285
|
-
- Node.js β₯18.0.0
|
|
286
|
-
- npm or pnpm
|
|
287
|
-
- 2GB RAM minimum (4GB recommended for swarms)
|
|
288
|
-
- macOS, Linux, or Windows
|
|
191
|
+
**Technical Details:**
|
|
192
|
+
- Spawns 3 agents concurrently: `researcher`, `code-review`, `data-analyst`
|
|
193
|
+
- Agents coordinate via Claude Flow memory tools
|
|
194
|
+
- Each agent has access to all 213 MCP tools
|
|
195
|
+
- Results aggregated and returned together
|
|
289
196
|
|
|
290
197
|
---
|
|
291
198
|
|
|
292
|
-
###
|
|
293
|
-
```javascript
|
|
294
|
-
// Create isolated sandbox and execute agent with full MCP tool access
|
|
295
|
-
const { query } = require('@anthropic-ai/claude-agent-sdk');
|
|
296
|
-
|
|
297
|
-
// 1. Login to Flow Nexus
|
|
298
|
-
await flowNexus.login({ email: 'user@example.com', password: 'secure' });
|
|
299
|
-
|
|
300
|
-
// 2. Create E2B sandbox with Node.js template
|
|
301
|
-
const sandbox = await flowNexus.sandboxCreate({
|
|
302
|
-
template: 'node',
|
|
303
|
-
name: 'agent-execution',
|
|
304
|
-
env_vars: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY }
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
// 3. Execute agent in sandbox with all 203 MCP tools
|
|
308
|
-
const result = await flowNexus.sandboxExecute({
|
|
309
|
-
sandbox_id: sandbox.id,
|
|
310
|
-
code: `
|
|
311
|
-
const { query } = require('@anthropic-ai/claude-agent-sdk');
|
|
312
|
-
const result = await query({
|
|
313
|
-
prompt: "Analyze API security patterns",
|
|
314
|
-
options: {
|
|
315
|
-
mcpServers: { /* all 3 MCP servers available */ }
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
console.log(result);
|
|
319
|
-
`
|
|
320
|
-
});
|
|
321
|
-
|
|
322
|
-
// 4. Automatic cleanup
|
|
323
|
-
await flowNexus.sandboxDelete({ sandbox_id: sandbox.id });
|
|
324
|
-
```
|
|
199
|
+
### 3. Cost Optimization with OpenRouter
|
|
325
200
|
|
|
326
|
-
**
|
|
327
|
-
- β
Full 203 MCP tool support (all subprocess servers work)
|
|
328
|
-
- β
Persistent memory across sandbox instances
|
|
329
|
-
- β
Multi-language templates (Node.js, Python, React, Next.js)
|
|
330
|
-
- β
Real-time output streaming
|
|
331
|
-
- β
Secure process isolation
|
|
332
|
-
- β
Pay-per-use pricing (10 credits/hour)
|
|
201
|
+
**What it does:** Uses OpenRouter models for 90-99% cost savings vs Claude.
|
|
333
202
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
### π³ Docker Containers (Best for Production Deployments)
|
|
337
|
-
|
|
338
|
-
**Full 203 MCP tool support in containers:**
|
|
203
|
+
**When to use:** Development, testing, or budget-conscious production workloads.
|
|
339
204
|
|
|
340
205
|
```bash
|
|
341
|
-
#
|
|
342
|
-
|
|
206
|
+
# Ultra-low cost with Llama 3.1 8B (99% savings)
|
|
207
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
208
|
+
npx agentic-flow --agent coder --task "Build REST API" --model "meta-llama/llama-3.1-8b-instruct"
|
|
343
209
|
|
|
344
|
-
#
|
|
345
|
-
|
|
346
|
-
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
347
|
-
agentic-flow \
|
|
348
|
-
--agent researcher \
|
|
349
|
-
--task "Analyze microservices patterns"
|
|
210
|
+
# Balanced cost/quality with DeepSeek (97% savings)
|
|
211
|
+
npx agentic-flow --agent coder --task "Production code" --model "deepseek/deepseek-chat-v3.1"
|
|
350
212
|
|
|
351
|
-
#
|
|
352
|
-
|
|
353
|
-
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
354
|
-
-e TOPIC="API security" \
|
|
355
|
-
-e DIFF="feat: auth" \
|
|
356
|
-
-e DATASET="logs.json" \
|
|
357
|
-
agentic-flow
|
|
213
|
+
# Fast responses with Gemini (95% savings)
|
|
214
|
+
npx agentic-flow --agent researcher --task "Analyze trends" --model "google/gemini-2.5-flash-preview"
|
|
358
215
|
```
|
|
359
216
|
|
|
360
|
-
**
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
-
|
|
364
|
-
-
|
|
365
|
-
- β
**Orchestration**: Integrates with container orchestrators
|
|
366
|
-
- β
**CI/CD**: Perfect for automated workflows
|
|
367
|
-
|
|
368
|
-
**Container Orchestration Examples:**
|
|
217
|
+
**Technical Details:**
|
|
218
|
+
- Proxy auto-starts on port 3000 when OpenRouter model detected
|
|
219
|
+
- Translates Anthropic Messages API β OpenAI Chat Completions API
|
|
220
|
+
- All 213 MCP tools work through proxy
|
|
221
|
+
- No code changes needed - transparent to Claude SDK
|
|
369
222
|
|
|
370
|
-
|
|
371
|
-
# Kubernetes Job
|
|
372
|
-
apiVersion: batch/v1
|
|
373
|
-
kind: Job
|
|
374
|
-
metadata:
|
|
375
|
-
name: code-review
|
|
376
|
-
spec:
|
|
377
|
-
template:
|
|
378
|
-
spec:
|
|
379
|
-
containers:
|
|
380
|
-
- name: agent
|
|
381
|
-
image: agentic-flow:latest
|
|
382
|
-
args: ["--agent", "code-review", "--task", "Review PR #123"]
|
|
383
|
-
env:
|
|
384
|
-
- name: ANTHROPIC_API_KEY
|
|
385
|
-
valueFrom:
|
|
386
|
-
secretKeyRef:
|
|
387
|
-
name: anthropic
|
|
388
|
-
key: api-key
|
|
389
|
-
restartPolicy: Never
|
|
390
|
-
|
|
391
|
-
# GitHub Actions
|
|
392
|
-
- name: AI Code Review
|
|
393
|
-
run: |
|
|
394
|
-
docker run -e ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} \
|
|
395
|
-
agentic-flow:latest \
|
|
396
|
-
--agent code-review \
|
|
397
|
-
--task "${{ github.event.pull_request.diff }}"
|
|
398
|
-
|
|
399
|
-
# AWS ECS Task Definition
|
|
400
|
-
{
|
|
401
|
-
"family": "agentic-flow-task",
|
|
402
|
-
"containerDefinitions": [{
|
|
403
|
-
"name": "agent",
|
|
404
|
-
"image": "agentic-flow:latest",
|
|
405
|
-
"command": ["--agent", "researcher", "--task", "$(TASK)"],
|
|
406
|
-
"environment": [
|
|
407
|
-
{"name": "ANTHROPIC_API_KEY", "value": "from-secrets-manager"}
|
|
408
|
-
]
|
|
409
|
-
}]
|
|
410
|
-
}
|
|
223
|
+
**Cost Comparison:**
|
|
411
224
|
```
|
|
225
|
+
Task: Generate 100K tokens (200 functions)
|
|
412
226
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
```bash
|
|
418
|
-
# Auto-downloads Phi-4 model (~4.9GB one-time download)
|
|
419
|
-
npx agentic-flow \
|
|
420
|
-
--agent coder \
|
|
421
|
-
--task "Build a REST API" \
|
|
422
|
-
--provider onnx
|
|
423
|
-
|
|
424
|
-
# Router auto-selects ONNX for privacy-sensitive tasks
|
|
425
|
-
npx agentic-flow \
|
|
426
|
-
--agent researcher \
|
|
427
|
-
--task "Analyze confidential medical records" \
|
|
428
|
-
--privacy high \
|
|
429
|
-
--local-only
|
|
227
|
+
Anthropic Claude Sonnet 4.5: $1.80
|
|
228
|
+
DeepSeek V3 (OpenRouter): $0.028 (98% savings)
|
|
229
|
+
Llama 3.1 8B (OpenRouter): $0.011 (99% savings)
|
|
430
230
|
```
|
|
431
231
|
|
|
432
|
-
**ONNX Capabilities:**
|
|
433
|
-
- β
100% free local inference (Microsoft Phi-4 model)
|
|
434
|
-
- β
Privacy: All processing stays on your machine
|
|
435
|
-
- β
Offline: No internet required after model download
|
|
436
|
-
- β
Performance: ~6 tokens/sec CPU, 60-300 tokens/sec GPU
|
|
437
|
-
- β
Auto-download: Model fetches automatically on first use
|
|
438
|
-
- β
Quantized: INT4 optimization for efficiency (~4.9GB total)
|
|
439
|
-
- β οΈ Limited to 6 in-SDK tools (no subprocess MCP servers)
|
|
440
|
-
- π See [docs](docs/ONNX_INTEGRATION.md) for full capabilities
|
|
441
|
-
|
|
442
232
|
---
|
|
443
233
|
|
|
444
|
-
|
|
234
|
+
### 4. Free Local Inference with ONNX
|
|
445
235
|
|
|
446
|
-
|
|
447
|
-
|----------|-----------|----------------|------------|-------------|-----------------|
|
|
448
|
-
| **Code Review** | `code-review` | 15-45s | Free* | Self-hosted | 0.13-0.38 credits |
|
|
449
|
-
| **API Testing** | `tester` | 10-30s | Free* | Self-hosted | 0.08-0.25 credits |
|
|
450
|
-
| **Documentation** | `api-docs` | 20-60s | Free* | Self-hosted | 0.17-0.50 credits |
|
|
451
|
-
| **Data Analysis** | `data-analyst` | 30-90s | Free* | Self-hosted | 0.25-0.75 credits |
|
|
452
|
-
| **Security Audit** | `reviewer` | 45-120s | Free* | Self-hosted | 0.38-1.00 credits |
|
|
453
|
-
| **Microservice Generation** | `backend-dev` | 60-180s | Free* | Self-hosted | 0.50-1.50 credits |
|
|
454
|
-
| **Performance Analysis** | `perf-analyzer` | 20-60s | Free* | Self-hosted | 0.17-0.50 credits |
|
|
236
|
+
**What it does:** Runs agents completely offline with zero API costs.
|
|
455
237
|
|
|
456
|
-
|
|
457
|
-
Flow Nexus: 10 credits/hour sandbox (β$1/hour) + Claude API costs. 1 credit β $0.10.
|
|
458
|
-
Docker: Infrastructure costs (AWS/GCP/Azure) + Claude API costs.*
|
|
238
|
+
**When to use:** Privacy-sensitive data, air-gapped environments, development without API costs.
|
|
459
239
|
|
|
460
|
-
|
|
461
|
-
-
|
|
462
|
-
-
|
|
463
|
-
- **Production Scale**: Use **Flow Nexus** - auto-scaling, cloud-native
|
|
240
|
+
```bash
|
|
241
|
+
# Auto-downloads Phi-4 model (~4.9GB one-time)
|
|
242
|
+
npx agentic-flow --agent coder --task "Build REST API" --provider onnx
|
|
464
243
|
|
|
465
|
-
|
|
244
|
+
# Privacy-first routing (auto-selects ONNX)
|
|
245
|
+
npx agentic-flow --agent researcher --task "Analyze medical records" --privacy high --local-only
|
|
246
|
+
```
|
|
466
247
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
-
|
|
471
|
-
-
|
|
472
|
-
-
|
|
473
|
-
- **`planner`** - Strategic planning and task decomposition
|
|
474
|
-
- **`researcher`** - Deep research and information gathering
|
|
475
|
-
|
|
476
|
-
### Specialized Agents
|
|
477
|
-
- **`backend-dev`** - REST/GraphQL API development
|
|
478
|
-
- **`mobile-dev`** - React Native mobile apps
|
|
479
|
-
- **`ml-developer`** - Machine learning model creation
|
|
480
|
-
- **`system-architect`** - System design and architecture
|
|
481
|
-
- **`cicd-engineer`** - CI/CD pipeline creation
|
|
482
|
-
- **`api-docs`** - OpenAPI/Swagger documentation
|
|
483
|
-
|
|
484
|
-
### Swarm Coordinators
|
|
485
|
-
- **`hierarchical-coordinator`** - Tree-based leadership
|
|
486
|
-
- **`mesh-coordinator`** - Peer-to-peer coordination
|
|
487
|
-
- **`adaptive-coordinator`** - Dynamic topology switching
|
|
488
|
-
- **`swarm-memory-manager`** - Cross-agent memory sync
|
|
489
|
-
|
|
490
|
-
### GitHub Integration
|
|
491
|
-
- **`pr-manager`** - Pull request lifecycle management
|
|
492
|
-
- **`code-review-swarm`** - Multi-agent code review
|
|
493
|
-
- **`issue-tracker`** - Intelligent issue management
|
|
494
|
-
- **`release-manager`** - Automated release coordination
|
|
495
|
-
- **`workflow-automation`** - GitHub Actions specialist
|
|
496
|
-
|
|
497
|
-
### Performance & Analysis
|
|
498
|
-
- **`perf-analyzer`** - Performance bottleneck detection
|
|
499
|
-
- **`production-validator`** - Deployment readiness checks
|
|
500
|
-
- **`tdd-london-swarm`** - Test-driven development
|
|
501
|
-
|
|
502
|
-
*Use `npx agentic-flow --list` to see all 150+ agents*
|
|
248
|
+
**Technical Details:**
|
|
249
|
+
- Uses Microsoft Phi-4 (INT4 quantized) via ONNX Runtime
|
|
250
|
+
- CPU: ~6 tokens/sec, GPU: 60-300 tokens/sec
|
|
251
|
+
- 100% offline after model download
|
|
252
|
+
- Limited to 6 in-SDK tools (no subprocess MCP servers)
|
|
253
|
+
- Zero API costs forever
|
|
503
254
|
|
|
504
255
|
---
|
|
505
256
|
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
**Automatically select the optimal model for any agent and task**, balancing quality, cost, and speed based on your priorities.
|
|
257
|
+
### 5. Model Optimization (Auto-Select Best Model)
|
|
509
258
|
|
|
510
|
-
|
|
259
|
+
**What it does:** Automatically picks optimal model based on task complexity and priorities.
|
|
511
260
|
|
|
512
|
-
|
|
513
|
-
- **Production code** β Claude Sonnet 4.5 (highest quality)
|
|
514
|
-
- **Code reviews** β DeepSeek R1 (85% cheaper, nearly same quality)
|
|
515
|
-
- **Simple functions** β Llama 3.1 8B (99% cheaper)
|
|
516
|
-
- **Privacy-critical** β ONNX Phi-4 (free, local, offline)
|
|
517
|
-
|
|
518
|
-
**The optimizer analyzes your agent type + task complexity and recommends the best model automatically.**
|
|
519
|
-
|
|
520
|
-
### Quick Examples
|
|
261
|
+
**When to use:** You want best quality/cost/speed balance without manual selection.
|
|
521
262
|
|
|
522
263
|
```bash
|
|
523
|
-
# Let
|
|
264
|
+
# Let optimizer choose (balanced quality vs cost)
|
|
524
265
|
npx agentic-flow --agent coder --task "Build REST API" --optimize
|
|
525
266
|
|
|
526
267
|
# Optimize for lowest cost
|
|
@@ -529,975 +270,545 @@ npx agentic-flow --agent coder --task "Simple function" --optimize --priority co
|
|
|
529
270
|
# Optimize for highest quality
|
|
530
271
|
npx agentic-flow --agent reviewer --task "Security audit" --optimize --priority quality
|
|
531
272
|
|
|
532
|
-
#
|
|
533
|
-
npx agentic-flow --agent researcher --task "Quick analysis" --optimize --priority speed
|
|
534
|
-
|
|
535
|
-
# Set maximum budget ($0.001 per task)
|
|
273
|
+
# Set budget cap ($0.001 per task max)
|
|
536
274
|
npx agentic-flow --agent coder --task "Code cleanup" --optimize --max-cost 0.001
|
|
537
275
|
```
|
|
538
276
|
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
-
|
|
542
|
-
-
|
|
543
|
-
-
|
|
544
|
-
- **`speed`** (70% speed, 20% quality, 10% cost) - Fastest responses
|
|
545
|
-
- **`privacy`** - Local-only models (ONNX), zero cloud API calls
|
|
546
|
-
|
|
547
|
-
### Model Tier Examples
|
|
548
|
-
|
|
549
|
-
The optimizer chooses from 10+ models across 5 tiers:
|
|
550
|
-
|
|
551
|
-
**Tier 1: Flagship** (premium quality)
|
|
552
|
-
- Claude Sonnet 4.5 - $3/$15 per 1M tokens
|
|
553
|
-
- GPT-4o - $2.50/$10 per 1M tokens
|
|
554
|
-
- Gemini 2.5 Pro - $0.00/$2.00 per 1M tokens
|
|
555
|
-
|
|
556
|
-
**Tier 2: Cost-Effective** (2025 breakthrough models)
|
|
557
|
-
- **DeepSeek R1** - $0.55/$2.19 per 1M tokens (85% cheaper, flagship quality)
|
|
558
|
-
- **DeepSeek Chat V3** - $0.14/$0.28 per 1M tokens (98% cheaper)
|
|
559
|
-
|
|
560
|
-
**Tier 3: Balanced**
|
|
561
|
-
- Gemini 2.5 Flash - $0.07/$0.30 per 1M tokens (fastest)
|
|
562
|
-
- Llama 3.3 70B - $0.30/$0.30 per 1M tokens (open-source)
|
|
563
|
-
|
|
564
|
-
**Tier 4: Budget**
|
|
565
|
-
- Llama 3.1 8B - $0.055/$0.055 per 1M tokens (ultra-low cost)
|
|
566
|
-
|
|
567
|
-
**Tier 5: Local/Privacy**
|
|
568
|
-
- **ONNX Phi-4** - FREE (offline, private, no API)
|
|
569
|
-
|
|
570
|
-
### Agent-Specific Recommendations
|
|
571
|
-
|
|
572
|
-
The optimizer knows what each agent needs:
|
|
573
|
-
|
|
574
|
-
```bash
|
|
575
|
-
# Coder agent β prefers high quality (min 85/100)
|
|
576
|
-
npx agentic-flow --agent coder --task "Production API" --optimize
|
|
577
|
-
# β Selects: DeepSeek R1 (quality 90, cost 85)
|
|
578
|
-
|
|
579
|
-
# Researcher agent β flexible, can use cheaper models
|
|
580
|
-
npx agentic-flow --agent researcher --task "Trend analysis" --optimize --priority cost
|
|
581
|
-
# β Selects: Gemini 2.5 Flash (quality 78, cost 98)
|
|
582
|
-
|
|
583
|
-
# Reviewer agent β needs reasoning (min 85/100)
|
|
584
|
-
npx agentic-flow --agent reviewer --task "Security review" --optimize
|
|
585
|
-
# β Selects: DeepSeek R1 (quality 90, reasoning-optimized)
|
|
586
|
-
|
|
587
|
-
# Tester agent β simple tasks, use budget models
|
|
588
|
-
npx agentic-flow --agent tester --task "Unit tests" --optimize --priority cost
|
|
589
|
-
# β Selects: Llama 3.1 8B (cost 95)
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
### Cost Savings Examples
|
|
593
|
-
|
|
594
|
-
**Without Optimization** (always using Claude Sonnet 4.5):
|
|
595
|
-
- 100 code reviews/day Γ $0.08 each = **$8/day = $240/month**
|
|
596
|
-
|
|
597
|
-
**With Optimization** (DeepSeek R1 for reviews):
|
|
598
|
-
- 100 code reviews/day Γ $0.012 each = **$1.20/day = $36/month**
|
|
599
|
-
- **Savings: $204/month (85% reduction)**
|
|
277
|
+
**Technical Details:**
|
|
278
|
+
- Analyzes agent requirements (coder needs 85+ quality score)
|
|
279
|
+
- Evaluates task complexity via keyword analysis
|
|
280
|
+
- Scores 10+ models across quality, cost, speed, privacy
|
|
281
|
+
- Returns recommendation with reasoning
|
|
600
282
|
|
|
601
|
-
|
|
283
|
+
**Optimization Priorities:**
|
|
284
|
+
- `quality` - Best results (70% quality, 20% speed, 10% cost)
|
|
285
|
+
- `balanced` - Default mix (40% quality, 40% cost, 20% speed)
|
|
286
|
+
- `cost` - Cheapest (70% cost, 20% quality, 10% speed)
|
|
287
|
+
- `speed` - Fastest (70% speed, 20% quality, 10% cost)
|
|
288
|
+
- `privacy` - Local-only (ONNX models, zero cloud API calls)
|
|
602
289
|
|
|
603
|
-
|
|
604
|
-
π **[Model Capabilities Guide](docs/agentic-flow/benchmarks/MODEL_CAPABILITIES.md)**
|
|
290
|
+
---
|
|
605
291
|
|
|
606
|
-
|
|
607
|
-
- Full benchmark results across 6 task types
|
|
608
|
-
- Cost comparison tables
|
|
609
|
-
- Use case decision matrices
|
|
610
|
-
- Performance characteristics
|
|
611
|
-
- Best practices by model
|
|
292
|
+
## π Tutorial: MCP Tools
|
|
612
293
|
|
|
613
|
-
###
|
|
294
|
+
### What are MCP Tools?
|
|
614
295
|
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
agent: 'coder',
|
|
623
|
-
task: 'Build REST API with auth',
|
|
624
|
-
priority: 'balanced', // quality | balanced | cost | speed | privacy
|
|
625
|
-
max_cost: 0.01 // optional budget cap in dollars
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
```
|
|
630
|
-
|
|
631
|
-
**Learn More:**
|
|
632
|
-
- See [benchmarks/README.md](docs/agentic-flow/benchmarks/README.md) for quick results
|
|
633
|
-
- Run your own tests: `cd docs/agentic-flow/benchmarks && ./quick-benchmark.sh`
|
|
634
|
-
|
|
635
|
-
---
|
|
296
|
+
MCP (Model Context Protocol) tools extend agent capabilities beyond text generation. They provide:
|
|
297
|
+
- **Memory** - Persistent storage across sessions
|
|
298
|
+
- **GitHub** - Repository operations, PR management, code review
|
|
299
|
+
- **Sandboxes** - Isolated execution environments in the cloud
|
|
300
|
+
- **Neural Networks** - Training, inference, model management
|
|
301
|
+
- **Workflows** - Event-driven automation with message queues
|
|
302
|
+
- **Payments** - Multi-agent payment authorization
|
|
636
303
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
### MCP Server Management (Direct Tool Access)
|
|
304
|
+
### Starting MCP Servers
|
|
640
305
|
|
|
306
|
+
**stdio Transport (default for Claude Desktop):**
|
|
641
307
|
```bash
|
|
642
|
-
# Start all
|
|
308
|
+
# Start all 213 tools (4 servers)
|
|
643
309
|
npx agentic-flow mcp start
|
|
644
310
|
|
|
645
|
-
# Start specific
|
|
311
|
+
# Start specific server
|
|
646
312
|
npx agentic-flow mcp start claude-flow # 101 tools
|
|
647
|
-
npx agentic-flow mcp start flow-nexus # 96
|
|
648
|
-
npx agentic-flow mcp start agentic-payments #
|
|
313
|
+
npx agentic-flow mcp start flow-nexus # 96 tools (requires registration)
|
|
314
|
+
npx agentic-flow mcp start agentic-payments # 10 tools
|
|
649
315
|
|
|
650
|
-
# List all
|
|
316
|
+
# List all tools
|
|
651
317
|
npx agentic-flow mcp list
|
|
652
318
|
|
|
653
|
-
# Check
|
|
319
|
+
# Check status
|
|
654
320
|
npx agentic-flow mcp status
|
|
655
321
|
|
|
656
|
-
# Stop
|
|
657
|
-
npx agentic-flow mcp stop
|
|
322
|
+
# Stop servers
|
|
323
|
+
npx agentic-flow mcp stop
|
|
658
324
|
```
|
|
659
325
|
|
|
660
|
-
**
|
|
661
|
-
- **claude-flow** (101 tools): Neural networks, GitHub integration, workflows, DAA, performance
|
|
662
|
-
- **flow-nexus** (96 tools): E2B sandboxes, distributed swarms, templates, cloud storage
|
|
663
|
-
- **agentic-payments** (10 tools): Payment authorization, Ed25519 signatures, consensus
|
|
664
|
-
- **claude-flow-sdk** (6 tools): In-process memory and swarm coordination
|
|
665
|
-
|
|
666
|
-
### Basic Operations (Works Locally, Docker, Cloud)
|
|
667
|
-
|
|
326
|
+
**HTTP/SSE Transport (new for web applications):**
|
|
668
327
|
```bash
|
|
669
|
-
#
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
# Run specific agent (local execution)
|
|
673
|
-
npx agentic-flow --agent <name> --task "<description>"
|
|
328
|
+
# Start HTTP/SSE MCP server on port 8080
|
|
329
|
+
npm run mcp:http
|
|
674
330
|
|
|
675
|
-
#
|
|
676
|
-
|
|
331
|
+
# Or manually:
|
|
332
|
+
node dist/mcp/fastmcp/servers/http-sse.js
|
|
677
333
|
|
|
678
|
-
#
|
|
679
|
-
|
|
334
|
+
# Server provides 3 endpoints:
|
|
335
|
+
# - http://localhost:8080/mcp (MCP protocol)
|
|
336
|
+
# - http://localhost:8080/sse (Server-Sent Events)
|
|
337
|
+
# - http://localhost:8080/health (health check)
|
|
680
338
|
```
|
|
681
339
|
|
|
682
|
-
|
|
340
|
+
**When to use each transport:**
|
|
341
|
+
- **stdio**: Claude Desktop, Cursor IDE, command-line tools
|
|
342
|
+
- **HTTP/SSE**: Web apps, browser extensions, REST APIs, mobile apps
|
|
683
343
|
|
|
684
|
-
|
|
685
|
-
# Required
|
|
686
|
-
export ANTHROPIC_API_KEY=sk-ant-...
|
|
687
|
-
|
|
688
|
-
# Agent mode (optional)
|
|
689
|
-
export AGENT=researcher
|
|
690
|
-
export TASK="Your task description"
|
|
691
|
-
|
|
692
|
-
# Parallel mode (optional)
|
|
693
|
-
export TOPIC="research topic"
|
|
694
|
-
export DIFF="code changes"
|
|
695
|
-
export DATASET="data to analyze"
|
|
696
|
-
|
|
697
|
-
# Options
|
|
698
|
-
export ENABLE_STREAMING=true
|
|
699
|
-
export HEALTH_PORT=8080
|
|
700
|
-
```
|
|
701
|
-
|
|
702
|
-
### Docker Deployment
|
|
344
|
+
### Using MCP Tools in Agents
|
|
703
345
|
|
|
346
|
+
**Automatic (Recommended):**
|
|
704
347
|
```bash
|
|
705
|
-
#
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
# Run agent in container
|
|
709
|
-
docker run --rm \
|
|
710
|
-
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
711
|
-
agentic-flow \
|
|
712
|
-
--agent researcher \
|
|
713
|
-
--task "Analyze cloud patterns"
|
|
714
|
-
|
|
715
|
-
# Run with streaming
|
|
716
|
-
docker run --rm \
|
|
717
|
-
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
718
|
-
-e ENABLE_STREAMING=true \
|
|
719
|
-
agentic-flow \
|
|
720
|
-
--agent coder --task "Build REST API" --stream
|
|
348
|
+
# Tools available automatically when ENABLE_CLAUDE_FLOW_SDK=true
|
|
349
|
+
export ENABLE_CLAUDE_FLOW_SDK=true
|
|
350
|
+
npx agentic-flow --agent coder --task "Store config in memory_store"
|
|
721
351
|
```
|
|
722
352
|
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
---
|
|
726
|
-
|
|
727
|
-
## ποΈ Using the Multi-Model Router
|
|
728
|
-
|
|
729
|
-
### Quick Start with Router
|
|
730
|
-
|
|
353
|
+
**Manual (Advanced):**
|
|
731
354
|
```javascript
|
|
732
|
-
import {
|
|
733
|
-
|
|
734
|
-
// Initialize router (auto-loads configuration)
|
|
735
|
-
const router = new ModelRouter();
|
|
736
|
-
|
|
737
|
-
// Use default provider (Anthropic)
|
|
738
|
-
const response = await router.chat({
|
|
739
|
-
model: 'claude-3-5-sonnet-20241022',
|
|
740
|
-
messages: [{ role: 'user', content: 'Your prompt here' }]
|
|
741
|
-
});
|
|
742
|
-
|
|
743
|
-
console.log(response.content[0].text);
|
|
744
|
-
console.log(`Cost: $${response.metadata.cost}`);
|
|
745
|
-
```
|
|
355
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
746
356
|
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
**OpenRouter (Multi-Model Gateway)**
|
|
757
|
-
- Models: 100+ models from multiple providers
|
|
758
|
-
- Cost: $0.002-0.10/1K tokens (varies by model)
|
|
759
|
-
- Best for: Cost optimization, model diversity, fallback
|
|
760
|
-
|
|
761
|
-
**ONNX Runtime (Free Local)**
|
|
762
|
-
- Models: Microsoft Phi-4-mini-instruct (INT4 quantized)
|
|
763
|
-
- Cost: **$0.00** (100% free)
|
|
764
|
-
- Best for: Privacy-sensitive data, offline operation, zero-cost development
|
|
765
|
-
|
|
766
|
-
**Ollama (Local Server - Coming Soon)**
|
|
767
|
-
- Models: Any Ollama-supported model
|
|
768
|
-
- Cost: Free (requires local Ollama server)
|
|
769
|
-
- Best for: Local development with larger models
|
|
770
|
-
|
|
771
|
-
**LiteLLM (Gateway - Coming Soon)**
|
|
772
|
-
- Models: Unified API for 100+ providers
|
|
773
|
-
- Cost: Varies by provider
|
|
774
|
-
- Best for: Multi-cloud deployments
|
|
775
|
-
|
|
776
|
-
**Configuration Example:**
|
|
777
|
-
```json
|
|
778
|
-
// router.config.json
|
|
779
|
-
{
|
|
780
|
-
"defaultProvider": "anthropic",
|
|
781
|
-
"fallbackChain": ["anthropic", "onnx", "openrouter"],
|
|
782
|
-
"providers": {
|
|
783
|
-
"anthropic": {
|
|
784
|
-
"apiKey": "sk-ant-...",
|
|
785
|
-
"models": { "default": "claude-3-5-sonnet-20241022" }
|
|
786
|
-
},
|
|
787
|
-
"openrouter": {
|
|
788
|
-
"apiKey": "sk-or-...",
|
|
789
|
-
"baseUrl": "https://openrouter.ai/api/v1",
|
|
790
|
-
"models": { "default": "anthropic/claude-3.5-sonnet" }
|
|
791
|
-
},
|
|
792
|
-
"onnx": {
|
|
793
|
-
"modelPath": "./models/phi-4/.../model.onnx",
|
|
794
|
-
"executionProviders": ["cpu"],
|
|
795
|
-
"localInference": true
|
|
357
|
+
const result = await query({
|
|
358
|
+
prompt: 'Store API key in memory',
|
|
359
|
+
options: {
|
|
360
|
+
mcpServers: {
|
|
361
|
+
'claude-flow-sdk': {
|
|
362
|
+
command: 'npx',
|
|
363
|
+
args: ['claude-flow', 'mcp', 'start'],
|
|
364
|
+
env: { ENABLE_CLAUDE_FLOW_SDK: 'true' }
|
|
365
|
+
}
|
|
796
366
|
}
|
|
797
367
|
}
|
|
798
|
-
}
|
|
368
|
+
});
|
|
799
369
|
```
|
|
800
370
|
|
|
801
|
-
###
|
|
371
|
+
### MCP Tool Categories
|
|
372
|
+
|
|
373
|
+
**1. Memory & Storage (claude-flow-sdk)**
|
|
374
|
+
- `memory_store` - Store persistent key-value data
|
|
375
|
+
- `memory_retrieve` - Retrieve stored data
|
|
376
|
+
- `memory_search` - Search memory by pattern
|
|
377
|
+
- `memory_list` - List all stored keys
|
|
378
|
+
- `memory_delete` - Delete stored data
|
|
379
|
+
|
|
380
|
+
**2. Swarm Coordination (claude-flow)**
|
|
381
|
+
- `swarm_init` - Initialize multi-agent swarm
|
|
382
|
+
- `agent_spawn` - Create specialized agents
|
|
383
|
+
- `task_orchestrate` - Distribute work across agents
|
|
384
|
+
- `swarm_status` - Monitor swarm health
|
|
385
|
+
- `coordination_sync` - Synchronize agent state
|
|
386
|
+
|
|
387
|
+
**3. GitHub Integration (claude-flow)**
|
|
388
|
+
- `github_repo_analyze` - Repository analysis
|
|
389
|
+
- `github_pr_manage` - PR lifecycle management
|
|
390
|
+
- `github_code_review` - Automated code review
|
|
391
|
+
- `github_issue_track` - Issue triage and tracking
|
|
392
|
+
- `github_workflow_auto` - CI/CD automation
|
|
393
|
+
|
|
394
|
+
**4. Cloud Sandboxes (flow-nexus)**
|
|
395
|
+
- `sandbox_create` - Isolated execution environments
|
|
396
|
+
- `sandbox_execute` - Run code in sandbox
|
|
397
|
+
- `sandbox_upload` - Upload files to sandbox
|
|
398
|
+
- `sandbox_status` - Check sandbox health
|
|
399
|
+
- `sandbox_delete` - Cleanup sandbox
|
|
400
|
+
|
|
401
|
+
**5. Neural Networks (claude-flow)**
|
|
402
|
+
- `neural_train` - Train models with WASM acceleration
|
|
403
|
+
- `neural_predict` - Run inference
|
|
404
|
+
- `neural_patterns` - Analyze cognitive patterns
|
|
405
|
+
- `neural_status` - Model metrics
|
|
406
|
+
|
|
407
|
+
**6. Workflows (flow-nexus)**
|
|
408
|
+
- `workflow_create` - Event-driven automation
|
|
409
|
+
- `workflow_execute` - Run workflow with message queues
|
|
410
|
+
- `workflow_status` - Monitor execution
|
|
411
|
+
- `workflow_agent_assign` - Optimal agent assignment
|
|
412
|
+
|
|
413
|
+
**7. Payments (agentic-payments)**
|
|
414
|
+
- `create_active_mandate` - Payment authorization with spend caps
|
|
415
|
+
- `sign_mandate` - Ed25519 cryptographic signing
|
|
416
|
+
- `verify_mandate` - Signature verification
|
|
417
|
+
- `verify_consensus` - Multi-agent Byzantine consensus
|
|
802
418
|
|
|
803
|
-
|
|
419
|
+
---
|
|
804
420
|
|
|
805
|
-
|
|
806
|
-
# Set OpenRouter API key
|
|
807
|
-
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
421
|
+
## π Tutorial: Standalone Proxy
|
|
808
422
|
|
|
809
|
-
|
|
810
|
-
npx agentic-flow \
|
|
811
|
-
--agent coder \
|
|
812
|
-
--task "Build REST API" \
|
|
813
|
-
--model "meta-llama/llama-3.1-8b-instruct"
|
|
423
|
+
### What is the Standalone Proxy?
|
|
814
424
|
|
|
815
|
-
|
|
816
|
-
export USE_OPENROUTER=true
|
|
817
|
-
npx agentic-flow --agent coder --task "Build REST API"
|
|
818
|
-
```
|
|
425
|
+
The standalone proxy lets you use **cheaper models** (Gemini, OpenRouter) with tools that expect the **Anthropic API** (Claude Code, future Cursor).
|
|
819
426
|
|
|
820
|
-
**
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
427
|
+
**How it works:**
|
|
428
|
+
1. Proxy server translates Anthropic API β Gemini/OpenRouter API
|
|
429
|
+
2. Claude Code sends requests to proxy instead of Anthropic
|
|
430
|
+
3. Proxy forwards to cheaper provider and translates responses
|
|
431
|
+
4. MCP tools work seamlessly through proxy
|
|
825
432
|
|
|
826
|
-
|
|
827
|
-
| Provider | Model | Input (1K tokens) | Output (1K tokens) | Savings |
|
|
828
|
-
|----------|-------|-------------------|-------------------|---------|
|
|
829
|
-
| Anthropic Direct | Claude 3.5 Sonnet | $0.003 | $0.015 | Baseline |
|
|
830
|
-
| OpenRouter | Llama 3.1 8B | $0.00003 | $0.00006 | **99%** |
|
|
831
|
-
| OpenRouter | DeepSeek V3.1 | $0.00014 | $0.00028 | **97%** |
|
|
832
|
-
| OpenRouter | Gemini 2.5 Flash | $0.000075 | $0.0003 | **95%** |
|
|
833
|
-
|
|
834
|
-
**How It Works:**
|
|
835
|
-
1. Detects OpenRouter model (contains "/") or USE_OPENROUTER=true
|
|
836
|
-
2. Auto-starts integrated proxy server on port 3000
|
|
837
|
-
3. Translates Anthropic Messages API β OpenAI Chat Completions API
|
|
838
|
-
4. Claude Agent SDK transparently uses OpenRouter via ANTHROPIC_BASE_URL
|
|
839
|
-
5. Full MCP tool support (all 203 tools work)
|
|
840
|
-
|
|
841
|
-
**Environment Variables:**
|
|
842
|
-
```bash
|
|
843
|
-
# Required for OpenRouter
|
|
844
|
-
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
433
|
+
### Setup: Gemini Proxy (85% savings)
|
|
845
434
|
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
export
|
|
849
|
-
|
|
850
|
-
```
|
|
435
|
+
```bash
|
|
436
|
+
# Terminal 1: Start Gemini proxy
|
|
437
|
+
export GOOGLE_GEMINI_API_KEY=your-key-here
|
|
438
|
+
npx agentic-flow proxy
|
|
851
439
|
|
|
852
|
-
|
|
440
|
+
# Proxy starts on http://localhost:3000
|
|
441
|
+
# Instructions displayed for configuring Claude Code
|
|
853
442
|
|
|
854
|
-
|
|
443
|
+
# Terminal 2: Configure Claude Code to use proxy
|
|
444
|
+
export ANTHROPIC_BASE_URL=http://localhost:3000
|
|
445
|
+
export ANTHROPIC_API_KEY=sk-ant-proxy-dummy-key # Any value works
|
|
855
446
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
const router = new ModelRouter();
|
|
859
|
-
const onnxProvider = router.providers.get('onnx');
|
|
860
|
-
|
|
861
|
-
const response = await onnxProvider.chat({
|
|
862
|
-
model: 'phi-4',
|
|
863
|
-
messages: [{ role: 'user', content: 'Analyze this sensitive data...' }],
|
|
864
|
-
maxTokens: 100
|
|
865
|
-
});
|
|
447
|
+
# Now use Claude Code normally
|
|
448
|
+
claude
|
|
866
449
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
console.log(`Latency: ${response.metadata.latency}ms`);
|
|
870
|
-
console.log(`Privacy: 100% local processing`);
|
|
450
|
+
# Or run agent directly
|
|
451
|
+
claude --agent coder --task "Build REST API"
|
|
871
452
|
```
|
|
872
453
|
|
|
873
|
-
|
|
454
|
+
**Cost Savings:**
|
|
455
|
+
- Gemini free tier: 100% savings vs Anthropic
|
|
456
|
+
- All MCP tools work through proxy
|
|
457
|
+
- Real-time streaming supported
|
|
874
458
|
|
|
875
|
-
|
|
459
|
+
### Setup: OpenRouter Proxy (90-99% savings)
|
|
876
460
|
|
|
877
|
-
```
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
"mode": "rule-based",
|
|
882
|
-
"rules": [
|
|
883
|
-
{
|
|
884
|
-
"condition": { "privacy": "high", "localOnly": true },
|
|
885
|
-
"action": { "provider": "onnx" },
|
|
886
|
-
"reason": "Privacy-sensitive tasks use free ONNX local models"
|
|
887
|
-
}
|
|
888
|
-
]
|
|
889
|
-
}
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
// Router automatically uses ONNX for privacy workloads
|
|
893
|
-
const response = await router.chat({
|
|
894
|
-
model: 'any-model',
|
|
895
|
-
messages: [{ role: 'user', content: 'Process medical records...' }],
|
|
896
|
-
metadata: { privacy: 'high', localOnly: true }
|
|
897
|
-
});
|
|
898
|
-
|
|
899
|
-
// Routed to ONNX automatically (zero cost, 100% local)
|
|
900
|
-
console.log(response.metadata.provider); // "onnx-local"
|
|
901
|
-
```
|
|
902
|
-
|
|
903
|
-
### GPU Acceleration
|
|
904
|
-
|
|
905
|
-
Enable GPU acceleration for 10-50x performance boost:
|
|
461
|
+
```bash
|
|
462
|
+
# Terminal 1: Start OpenRouter proxy
|
|
463
|
+
export OPENROUTER_API_KEY=sk-or-v1-...
|
|
464
|
+
npx agentic-flow proxy --provider openrouter --model "openai/gpt-4o-mini"
|
|
906
465
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
"onnx": {
|
|
912
|
-
"executionProviders": ["cuda"], // or ["dml"] for Windows
|
|
913
|
-
"gpuAcceleration": true,
|
|
914
|
-
"modelPath": "./models/phi-4/...",
|
|
915
|
-
"maxTokens": 100
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
}
|
|
466
|
+
# Terminal 2: Use Claude Code
|
|
467
|
+
export ANTHROPIC_BASE_URL=http://localhost:3000
|
|
468
|
+
export ANTHROPIC_API_KEY=sk-ant-proxy-dummy-key
|
|
469
|
+
claude --agent coder --task "Build web scraper"
|
|
919
470
|
```
|
|
920
471
|
|
|
921
|
-
**
|
|
922
|
-
-
|
|
923
|
-
-
|
|
924
|
-
-
|
|
925
|
-
|
|
926
|
-
### Zero-Cost Agent Execution
|
|
472
|
+
**Popular OpenRouter Models:**
|
|
473
|
+
- `openai/gpt-4o-mini` - $0.15/1M tokens (95% savings)
|
|
474
|
+
- `deepseek/deepseek-chat-v3.1` - $0.014/1M tokens (99.5% savings)
|
|
475
|
+
- `meta-llama/llama-3.3-70b-instruct` - $0.30/1M tokens (90% savings)
|
|
927
476
|
|
|
928
|
-
|
|
477
|
+
### Proxy Command Reference
|
|
929
478
|
|
|
930
479
|
```bash
|
|
931
|
-
#
|
|
932
|
-
npx agentic-flow
|
|
933
|
-
--agent researcher \
|
|
934
|
-
--task "Analyze this privacy-sensitive data" \
|
|
935
|
-
--provider onnx \
|
|
936
|
-
--local-only
|
|
480
|
+
# Start Gemini proxy (default)
|
|
481
|
+
npx agentic-flow proxy
|
|
937
482
|
|
|
938
|
-
#
|
|
939
|
-
|
|
483
|
+
# Start OpenRouter proxy
|
|
484
|
+
npx agentic-flow proxy --provider openrouter
|
|
940
485
|
|
|
941
|
-
|
|
486
|
+
# Custom port
|
|
487
|
+
npx agentic-flow proxy --port 8080
|
|
942
488
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
| **Privacy-Sensitive** | ONNX (CPU) | **$0.00** | 100% local | 6 tokens/sec |
|
|
946
|
-
| **Privacy-Sensitive** | ONNX (GPU) | **$0.00** | 100% local | 60-300 tokens/sec |
|
|
947
|
-
| **Complex Reasoning** | Anthropic Claude | $0.003 | Cloud | Fast |
|
|
948
|
-
| **General Tasks** | OpenRouter | $0.002 | Cloud | Variable |
|
|
489
|
+
# Specific model
|
|
490
|
+
npx agentic-flow proxy --provider openrouter --model "anthropic/claude-3.5-sonnet"
|
|
949
491
|
|
|
950
|
-
|
|
951
|
-
-
|
|
952
|
-
|
|
953
|
-
- 100% cloud APIs: **$60-90**
|
|
492
|
+
# Help
|
|
493
|
+
npx agentic-flow proxy --help
|
|
494
|
+
```
|
|
954
495
|
|
|
955
|
-
|
|
496
|
+
### How MCP Tools Work Through Proxy
|
|
956
497
|
|
|
957
|
-
|
|
498
|
+
**Technical Implementation:**
|
|
958
499
|
|
|
959
|
-
|
|
500
|
+
1. **Tool Schema Forwarding**
|
|
501
|
+
- Anthropic format: `{ name, description, input_schema }`
|
|
502
|
+
- OpenRouter format: `{ type: 'function', function: {...} }`
|
|
503
|
+
- Gemini format: `{ functionDeclarations: [{...}] }`
|
|
960
504
|
|
|
961
|
-
|
|
505
|
+
2. **Schema Cleaning for Gemini**
|
|
506
|
+
- Removes unsupported fields: `$schema`, `additionalProperties`
|
|
507
|
+
- Recursively cleans nested objects
|
|
962
508
|
|
|
963
|
-
|
|
509
|
+
3. **Response Conversion**
|
|
510
|
+
- OpenRouter: `tool_calls` β `tool_use`
|
|
511
|
+
- Gemini: `functionCall` β `tool_use`
|
|
964
512
|
|
|
513
|
+
**Example:**
|
|
965
514
|
```bash
|
|
966
|
-
#
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
npx agentic-flow mcp list
|
|
971
|
-
|
|
972
|
-
# Check server status
|
|
973
|
-
npx agentic-flow mcp status
|
|
515
|
+
# MCP tools work automatically through proxy
|
|
516
|
+
export ENABLE_CLAUDE_FLOW_SDK=true
|
|
517
|
+
export ANTHROPIC_BASE_URL=http://localhost:3000
|
|
518
|
+
export ANTHROPIC_API_KEY=sk-ant-proxy-dummy-key
|
|
974
519
|
|
|
975
|
-
#
|
|
976
|
-
npx agentic-flow
|
|
520
|
+
# memory_store MCP tool works with Gemini (85% cost savings)
|
|
521
|
+
npx agentic-flow --agent coder --task "Store API config in memory_store"
|
|
977
522
|
```
|
|
978
523
|
|
|
979
|
-
**How It Works:**
|
|
980
|
-
1. **Automatic** (Recommended): Agents automatically access all 213 tools when you run tasks
|
|
981
|
-
2. **Manual**: Use `npx agentic-flow mcp <command>` for direct server management
|
|
982
|
-
3. **Integrated**: All tools work seamlessly whether accessed automatically or manually
|
|
983
|
-
|
|
984
|
-
### Tool Breakdown
|
|
985
|
-
|
|
986
|
-
### Core Orchestration (claude-flow - 101 tools)
|
|
987
|
-
|
|
988
|
-
| Category | Tools | Capabilities |
|
|
989
|
-
|----------|-------|--------------|
|
|
990
|
-
| **Swarm Management** | 12 | Initialize, spawn, coordinate multi-agent swarms |
|
|
991
|
-
| **Memory & Storage** | 10 | Persistent memory with TTL and namespaces |
|
|
992
|
-
| **Neural Networks** | 12 | Training, inference, WASM-accelerated computation |
|
|
993
|
-
| **GitHub Integration** | 8 | PR management, code review, repository analysis |
|
|
994
|
-
| **Performance** | 11 | Metrics, bottleneck detection, optimization |
|
|
995
|
-
| **Workflow Automation** | 9 | Task orchestration, CI/CD integration |
|
|
996
|
-
| **Dynamic Agents** | 7 | Runtime agent creation and coordination |
|
|
997
|
-
| **System Utilities** | 8 | Health checks, diagnostics, feature detection |
|
|
998
|
-
|
|
999
|
-
### Cloud Platform (flow-nexus - 96 tools)
|
|
1000
|
-
|
|
1001
|
-
| Category | Tools | Capabilities |
|
|
1002
|
-
|----------|-------|--------------|
|
|
1003
|
-
| **βοΈ E2B Sandboxes** | 12 | Isolated execution environments (Node, Python, React) |
|
|
1004
|
-
| **βοΈ Distributed Swarms** | 8 | Cloud-based multi-agent deployment |
|
|
1005
|
-
| **βοΈ Neural Training** | 10 | Distributed model training clusters |
|
|
1006
|
-
| **βοΈ Workflows** | 9 | Event-driven automation with message queues |
|
|
1007
|
-
| **βοΈ Templates** | 8 | Pre-built project templates and marketplace |
|
|
1008
|
-
| **βοΈ Challenges** | 6 | Coding challenges with leaderboards |
|
|
1009
|
-
| **βοΈ User Management** | 7 | Authentication, profiles, credit management |
|
|
1010
|
-
| **βοΈ Storage** | 5 | Cloud file storage with real-time sync |
|
|
1011
|
-
|
|
1012
|
-
### Payment Authorization (agentic-payments - MCP tools)
|
|
1013
|
-
|
|
1014
|
-
Multi-agent payment infrastructure for autonomous AI commerce:
|
|
1015
|
-
|
|
1016
|
-
| Category | Tools | Capabilities |
|
|
1017
|
-
|----------|-------|--------------|
|
|
1018
|
-
| **π³ Active Mandates** | MCP | Create spending limits, time windows, merchant restrictions |
|
|
1019
|
-
| **π Ed25519 Signatures** | MCP | Cryptographic transaction signing (<1ms verification) |
|
|
1020
|
-
| **π€ Multi-Agent Consensus** | MCP | Byzantine fault-tolerant transaction approval |
|
|
1021
|
-
| **π Payment Tracking** | MCP | Authorization to settlement lifecycle monitoring |
|
|
1022
|
-
| **π‘οΈ Security** | MCP | Spend caps, revocation, audit trails |
|
|
1023
|
-
|
|
1024
|
-
**Use Cases:**
|
|
1025
|
-
- E-commerce: AI shopping agents with weekly budgets
|
|
1026
|
-
- Finance: Robo-advisors executing trades within portfolios
|
|
1027
|
-
- Enterprise: Multi-agent procurement with consensus approval
|
|
1028
|
-
- Accounting: Automated AP/AR with policy-based workflows
|
|
1029
|
-
|
|
1030
|
-
**Protocols:**
|
|
1031
|
-
- **AP2**: Agent Payments Protocol with Ed25519 signatures
|
|
1032
|
-
- **ACP**: Agentic Commerce Protocol (Stripe-compatible)
|
|
1033
|
-
- **MCP**: Natural language interface for AI assistants
|
|
1034
|
-
|
|
1035
|
-
### In-Process Tools (claude-flow-sdk - 6 tools)
|
|
1036
|
-
|
|
1037
|
-
Fast, zero-latency tools running in-process:
|
|
1038
|
-
- `memory_store`, `memory_retrieve`, `memory_list`
|
|
1039
|
-
- `swarm_init`, `agent_spawn`, `coordination_sync`
|
|
1040
|
-
|
|
1041
524
|
---
|
|
1042
525
|
|
|
1043
|
-
##
|
|
1044
|
-
|
|
1045
|
-
Agentic Flow now supports **[FastMCP](https://github.com/QuantGeekDev/fastmcp)**, a modern TypeScript framework for building high-performance MCP servers with:
|
|
526
|
+
## π Tutorial: Deployment Options
|
|
1046
527
|
|
|
1047
|
-
|
|
1048
|
-
- **Type Safety**: Full TypeScript + Zod schema validation
|
|
1049
|
-
- **Progress Reporting**: Real-time execution feedback
|
|
1050
|
-
- **Authentication**: JWT, API keys, OAuth 2.0 support
|
|
1051
|
-
- **Rate Limiting**: Built-in abuse prevention
|
|
528
|
+
### Local Development (Best for Prototyping)
|
|
1052
529
|
|
|
1053
|
-
|
|
530
|
+
**What it does:** Runs agents directly on your machine with full MCP tool access.
|
|
1054
531
|
|
|
1055
|
-
|
|
532
|
+
**When to use:** Development, testing, debugging, low-cost experimentation.
|
|
1056
533
|
|
|
1057
534
|
```bash
|
|
1058
|
-
#
|
|
1059
|
-
npm
|
|
1060
|
-
|
|
1061
|
-
# Or run directly
|
|
1062
|
-
npm run mcp:fastmcp-poc
|
|
1063
|
-
```
|
|
1064
|
-
|
|
1065
|
-
### Using with Claude Code
|
|
1066
|
-
|
|
1067
|
-
Add to your MCP config (`~/.config/claude/mcp.json`):
|
|
535
|
+
# Install globally
|
|
536
|
+
npm install -g agentic-flow
|
|
1068
537
|
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
"fastmcp-poc": {
|
|
1073
|
-
"command": "node",
|
|
1074
|
-
"args": ["/path/to/agentic-flow/dist/mcp/fastmcp/servers/poc-stdio.js"]
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
538
|
+
# Run locally
|
|
539
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
540
|
+
npx agentic-flow --agent coder --task "Build REST API"
|
|
1078
541
|
```
|
|
1079
542
|
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
**Coming Soon (Phase 1):**
|
|
1088
|
-
- Migration of 6 claude-flow-sdk tools to fastmcp
|
|
1089
|
-
- HTTP streaming transport with authentication
|
|
1090
|
-
- Direct in-process execution (no execSync)
|
|
1091
|
-
- Comprehensive test suite
|
|
543
|
+
**Benefits:**
|
|
544
|
+
- β
All 213 MCP tools work
|
|
545
|
+
- β
Fast iteration (<500ms warm start)
|
|
546
|
+
- β
Free infrastructure (API costs only)
|
|
547
|
+
- β
Full filesystem access
|
|
548
|
+
- β
Git integration
|
|
1092
549
|
|
|
1093
|
-
**
|
|
1094
|
-
-
|
|
1095
|
-
-
|
|
1096
|
-
|
|
1097
|
-
---
|
|
1098
|
-
|
|
1099
|
-
## π Deployment Comparison
|
|
1100
|
-
|
|
1101
|
-
| Feature | Local | Docker | Flow Nexus Sandboxes | ONNX Local |
|
|
1102
|
-
|---------|-------|--------|----------------------|------------|
|
|
1103
|
-
| **MCP Tools Available** | 203 (100%) | 203 (100%) | 203 (100%) | 6 (3%) |
|
|
1104
|
-
| **Setup Complexity** | Low | Medium | Medium | Low |
|
|
1105
|
-
| **Cold Start Time** | <500ms | <2s | <2s | ~2s (first load) |
|
|
1106
|
-
| **Cost (Development)** | Free* | Free* | $1/hour | $0 (100% free) |
|
|
1107
|
-
| **Cost (Production)** | Free* | Infra costs | $1/hour | $0 (100% free) |
|
|
1108
|
-
| **Privacy** | Local | Local | Cloud | 100% Offline |
|
|
1109
|
-
| **Scaling** | Manual | Orchestrator | Automatic | Manual |
|
|
1110
|
-
| **Best For** | Dev/Testing | CI/CD/Prod | Cloud-Scale | Privacy/Offline |
|
|
1111
|
-
|
|
1112
|
-
*Free infrastructure, Claude API costs only
|
|
550
|
+
**Requirements:**
|
|
551
|
+
- Node.js β₯18.0.0
|
|
552
|
+
- 2GB RAM minimum (4GB for swarms)
|
|
553
|
+
- macOS, Linux, or Windows
|
|
1113
554
|
|
|
1114
555
|
---
|
|
1115
556
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
### βοΈ Flow Nexus Cloud Sandboxes (Scalable Production)
|
|
557
|
+
### Docker Containers (Best for Production)
|
|
1119
558
|
|
|
1120
|
-
**
|
|
1121
|
-
|
|
1122
|
-
```javascript
|
|
1123
|
-
// Full-featured agent execution in isolated E2B sandboxes
|
|
1124
|
-
import { flowNexus } from 'flow-nexus';
|
|
559
|
+
**What it does:** Packages agents in containers for Kubernetes, ECS, Cloud Run.
|
|
1125
560
|
|
|
1126
|
-
|
|
1127
|
-
await flowNexus.login({
|
|
1128
|
-
email: process.env.FLOW_NEXUS_EMAIL,
|
|
1129
|
-
password: process.env.FLOW_NEXUS_PASSWORD
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
|
-
// Deploy: Create sandbox and execute
|
|
1133
|
-
async function deployAgent(task) {
|
|
1134
|
-
// 1. Create isolated sandbox
|
|
1135
|
-
const sandbox = await flowNexus.sandboxCreate({
|
|
1136
|
-
template: 'node', // or 'python', 'react', 'nextjs'
|
|
1137
|
-
name: `agent-${Date.now()}`,
|
|
1138
|
-
env_vars: {
|
|
1139
|
-
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY
|
|
1140
|
-
},
|
|
1141
|
-
install_packages: ['@anthropic-ai/claude-agent-sdk'],
|
|
1142
|
-
timeout: 3600 // 1 hour max
|
|
1143
|
-
});
|
|
1144
|
-
|
|
1145
|
-
// 2. Execute agent with ALL 203 MCP tools
|
|
1146
|
-
const result = await flowNexus.sandboxExecute({
|
|
1147
|
-
sandbox_id: sandbox.id,
|
|
1148
|
-
code: `
|
|
1149
|
-
const { query } = require('@anthropic-ai/claude-agent-sdk');
|
|
1150
|
-
const result = await query({
|
|
1151
|
-
prompt: "${task}",
|
|
1152
|
-
options: {
|
|
1153
|
-
permissionMode: 'bypassPermissions',
|
|
1154
|
-
mcpServers: {
|
|
1155
|
-
'claude-flow-sdk': /* 6 tools */,
|
|
1156
|
-
'claude-flow': /* 101 tools */,
|
|
1157
|
-
'flow-nexus': /* 96 tools */
|
|
1158
|
-
}
|
|
1159
|
-
}
|
|
1160
|
-
});
|
|
1161
|
-
console.log(JSON.stringify(result));
|
|
1162
|
-
`,
|
|
1163
|
-
language: 'javascript',
|
|
1164
|
-
capture_output: true
|
|
1165
|
-
});
|
|
1166
|
-
|
|
1167
|
-
// 3. Cleanup (automatic after timeout)
|
|
1168
|
-
await flowNexus.sandboxDelete({ sandbox_id: sandbox.id });
|
|
1169
|
-
|
|
1170
|
-
return result;
|
|
1171
|
-
}
|
|
1172
|
-
```
|
|
561
|
+
**When to use:** CI/CD pipelines, production deployments, reproducible environments.
|
|
1173
562
|
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
- β
**Security**: Complete process isolation per sandbox
|
|
1178
|
-
- β
**Multi-Language**: Node.js, Python, React, Next.js templates
|
|
1179
|
-
- β
**Real-Time**: Live output streaming and monitoring
|
|
1180
|
-
- β
**Cost-Effective**: Pay per use (10 credits/hour β $1/hour)
|
|
1181
|
-
|
|
1182
|
-
**Flow Nexus Pricing:**
|
|
1183
|
-
| Resource | Cost | Notes |
|
|
1184
|
-
|----------|------|-------|
|
|
1185
|
-
| Sandbox (hourly) | 10 credits | β $1/hour per sandbox |
|
|
1186
|
-
| Storage | 1 credit/GB/month | Files and environment data |
|
|
1187
|
-
| Credits Package | $10 = 100 credits | 10+ hours of sandbox time |
|
|
1188
|
-
|
|
1189
|
-
---
|
|
1190
|
-
|
|
1191
|
-
### π³ Container Platforms (Production Orchestration)
|
|
563
|
+
```bash
|
|
564
|
+
# Build image
|
|
565
|
+
docker build -t agentic-flow .
|
|
1192
566
|
|
|
1193
|
-
|
|
567
|
+
# Run agent in container
|
|
568
|
+
docker run --rm \
|
|
569
|
+
-e ANTHROPIC_API_KEY=sk-ant-... \
|
|
570
|
+
agentic-flow \
|
|
571
|
+
--agent researcher \
|
|
572
|
+
--task "Analyze cloud patterns"
|
|
1194
573
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
574
|
+
# Run with OpenRouter (99% cost savings)
|
|
575
|
+
docker run --rm \
|
|
576
|
+
-e OPENROUTER_API_KEY=sk-or-v1-... \
|
|
577
|
+
agentic-flow \
|
|
578
|
+
--agent coder \
|
|
579
|
+
--task "Build API" \
|
|
580
|
+
--model "meta-llama/llama-3.1-8b-instruct"
|
|
1202
581
|
```
|
|
1203
582
|
|
|
1204
|
-
**
|
|
1205
|
-
-
|
|
1206
|
-
-
|
|
1207
|
-
-
|
|
1208
|
-
-
|
|
1209
|
-
-
|
|
583
|
+
**Benefits:**
|
|
584
|
+
- β
All 213 MCP tools work
|
|
585
|
+
- β
Reproducible builds
|
|
586
|
+
- β
Works on Kubernetes, ECS, Cloud Run, Fargate
|
|
587
|
+
- β
Process isolation
|
|
588
|
+
- β
CI/CD integration
|
|
1210
589
|
|
|
1211
|
-
|
|
590
|
+
**Orchestration Examples:**
|
|
1212
591
|
|
|
592
|
+
**Kubernetes Job:**
|
|
1213
593
|
```yaml
|
|
1214
594
|
apiVersion: batch/v1
|
|
1215
595
|
kind: Job
|
|
1216
596
|
metadata:
|
|
1217
|
-
name:
|
|
597
|
+
name: code-review
|
|
1218
598
|
spec:
|
|
1219
599
|
template:
|
|
1220
600
|
spec:
|
|
1221
601
|
containers:
|
|
1222
602
|
- name: agent
|
|
1223
603
|
image: agentic-flow:latest
|
|
1224
|
-
args: ["--agent", "
|
|
604
|
+
args: ["--agent", "code-review", "--task", "Review PR #123"]
|
|
1225
605
|
env:
|
|
1226
606
|
- name: ANTHROPIC_API_KEY
|
|
1227
607
|
valueFrom:
|
|
1228
608
|
secretKeyRef:
|
|
1229
|
-
name: anthropic
|
|
609
|
+
name: anthropic
|
|
1230
610
|
key: api-key
|
|
1231
611
|
restartPolicy: Never
|
|
1232
612
|
```
|
|
1233
613
|
|
|
1234
|
-
**
|
|
1235
|
-
|
|
1236
|
-
-
|
|
1237
|
-
|
|
1238
|
-
-
|
|
1239
|
-
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
**Advanced ONNX setup with router integration:**
|
|
1244
|
-
|
|
1245
|
-
```javascript
|
|
1246
|
-
// router.config.json - Auto-route privacy tasks to ONNX
|
|
1247
|
-
{
|
|
1248
|
-
"routing": {
|
|
1249
|
-
"rules": [
|
|
1250
|
-
{
|
|
1251
|
-
"condition": { "privacy": "high", "localOnly": true },
|
|
1252
|
-
"action": { "provider": "onnx" }
|
|
1253
|
-
},
|
|
1254
|
-
{
|
|
1255
|
-
"condition": { "cost": "free" },
|
|
1256
|
-
"action": { "provider": "onnx" }
|
|
1257
|
-
}
|
|
1258
|
-
]
|
|
1259
|
-
},
|
|
1260
|
-
"providers": {
|
|
1261
|
-
"onnx": {
|
|
1262
|
-
"modelPath": "./models/phi-4/model.onnx",
|
|
1263
|
-
"maxTokens": 2048,
|
|
1264
|
-
"temperature": 0.7
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
```
|
|
1269
|
-
|
|
1270
|
-
**Performance Benchmarks:**
|
|
1271
|
-
| Metric | CPU (Intel i7) | GPU (NVIDIA RTX 3060) |
|
|
1272
|
-
|--------|---------------|----------------------|
|
|
1273
|
-
| Tokens/sec | ~6 | 60-300 |
|
|
1274
|
-
| First Token | ~2s | ~500ms |
|
|
1275
|
-
| Model Load | ~3s | ~2s |
|
|
1276
|
-
| Memory Usage | ~2GB | ~3GB |
|
|
1277
|
-
| Cost | $0 | $0 |
|
|
1278
|
-
|
|
1279
|
-
**Use Cases:**
|
|
1280
|
-
- β
Privacy-sensitive data processing
|
|
1281
|
-
- β
Offline/air-gapped environments
|
|
1282
|
-
- β
Cost-conscious development
|
|
1283
|
-
- β
Compliance requirements (HIPAA, GDPR)
|
|
1284
|
-
- β
Prototype/testing without API costs
|
|
1285
|
-
|
|
1286
|
-
**Documentation:**
|
|
1287
|
-
- [ONNX Integration Guide](docs/ONNX_INTEGRATION.md)
|
|
1288
|
-
- [ONNX CLI Usage](docs/ONNX_CLI_USAGE.md)
|
|
1289
|
-
- [ONNX vs Claude Quality Analysis](docs/ONNX_VS_CLAUDE_QUALITY.md)
|
|
1290
|
-
const sandbox = await flowNexus.sandboxCreate({
|
|
1291
|
-
template: 'node',
|
|
1292
|
-
env_vars: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY }
|
|
1293
|
-
});
|
|
1294
|
-
|
|
1295
|
-
const result = await flowNexus.sandboxExecute({
|
|
1296
|
-
sandbox_id: sandbox.id,
|
|
1297
|
-
code: `/* Full agent code with all 203 tools */`
|
|
1298
|
-
});
|
|
1299
|
-
|
|
1300
|
-
await flowNexus.sandboxDelete({ sandbox_id: sandbox.id });
|
|
1301
|
-
|
|
1302
|
-
return { statusCode: 200, body: JSON.stringify(result) };
|
|
1303
|
-
};
|
|
1304
|
-
```
|
|
1305
|
-
|
|
1306
|
-
---
|
|
1307
|
-
|
|
1308
|
-
## π Architecture
|
|
1309
|
-
|
|
1310
|
-
### Ephemeral Agent Lifecycle
|
|
1311
|
-
|
|
1312
|
-
```
|
|
1313
|
-
1. REQUEST β Agent definition loaded from YAML
|
|
1314
|
-
2. SPAWN β Agent initialized with system prompt + tools
|
|
1315
|
-
3. EXECUTE β Task processed using Claude SDK + MCP tools
|
|
1316
|
-
4. STREAM β Real-time output (optional)
|
|
1317
|
-
5. COMPLETE β Result returned to caller
|
|
1318
|
-
6. TERMINATE β Agent process exits, memory released
|
|
1319
|
-
```
|
|
1320
|
-
|
|
1321
|
-
**Key Characteristics:**
|
|
1322
|
-
- **Cold Start**: <2s (includes MCP server initialization)
|
|
1323
|
-
- **Warm Start**: <500ms (MCP servers cached)
|
|
1324
|
-
- **Memory Usage**: 100-200MB per agent
|
|
1325
|
-
- **Concurrent Agents**: Limited only by host resources
|
|
1326
|
-
|
|
1327
|
-
### Multi-Agent Coordination
|
|
1328
|
-
|
|
1329
|
-
```
|
|
1330
|
-
βββββββββββββββ βββββββββββββββ βββββββββββββββ
|
|
1331
|
-
β Researcher ββββββΆβ Memory βββββββ Code Review β
|
|
1332
|
-
β Agent β β Storage β β Agent β
|
|
1333
|
-
βββββββββββββββ βββββββββββββββ βββββββββββββββ
|
|
1334
|
-
β
|
|
1335
|
-
βΌ
|
|
1336
|
-
βββββββββββββββ
|
|
1337
|
-
β Data β
|
|
1338
|
-
β Analyst β
|
|
1339
|
-
βββββββββββββββ
|
|
614
|
+
**GitHub Actions:**
|
|
615
|
+
```yaml
|
|
616
|
+
- name: AI Code Review
|
|
617
|
+
run: |
|
|
618
|
+
docker run -e ANTHROPIC_API_KEY=${{ secrets.ANTHROPIC_API_KEY }} \
|
|
619
|
+
agentic-flow:latest \
|
|
620
|
+
--agent code-review \
|
|
621
|
+
--task "${{ github.event.pull_request.diff }}"
|
|
1340
622
|
```
|
|
1341
623
|
|
|
1342
|
-
**Coordination via:**
|
|
1343
|
-
- Shared memory (in-process or external)
|
|
1344
|
-
- Claude Flow MCP tools
|
|
1345
|
-
- File system (for batch jobs)
|
|
1346
|
-
- Message queues (for async workflows)
|
|
1347
|
-
|
|
1348
|
-
---
|
|
1349
|
-
|
|
1350
|
-
## π Advanced Usage
|
|
1351
|
-
|
|
1352
|
-
### Custom Agent Definition
|
|
1353
|
-
|
|
1354
|
-
Create `.claude/agents/custom/my-agent.md`:
|
|
1355
|
-
|
|
1356
|
-
```markdown
|
|
1357
|
-
---
|
|
1358
|
-
name: my-agent
|
|
1359
|
-
description: Custom agent for specific tasks
|
|
1360
624
|
---
|
|
1361
625
|
|
|
1362
|
-
|
|
626
|
+
### Cloud Sandboxes (Best for Scale)
|
|
1363
627
|
|
|
1364
|
-
|
|
628
|
+
**What it does:** Isolated E2B sandboxes with auto-scaling and cloud-native features.
|
|
1365
629
|
|
|
1366
|
-
|
|
1367
|
-
- [List capabilities]
|
|
630
|
+
**When to use:** Production scale, multi-tenant workloads, distributed processing.
|
|
1368
631
|
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
632
|
+
```javascript
|
|
633
|
+
// Requires Flow Nexus registration (https://flow-nexus.ruv.io)
|
|
634
|
+
const { flowNexus } = require('flow-nexus');
|
|
1372
635
|
|
|
1373
|
-
|
|
636
|
+
// 1. Login
|
|
637
|
+
await flowNexus.login({ email: 'user@example.com', password: '***' });
|
|
1374
638
|
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
639
|
+
// 2. Create sandbox
|
|
640
|
+
const sandbox = await flowNexus.sandboxCreate({
|
|
641
|
+
template: 'node',
|
|
642
|
+
name: 'agent-execution',
|
|
643
|
+
env_vars: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY }
|
|
644
|
+
});
|
|
1378
645
|
|
|
1379
|
-
|
|
1380
|
-
const result = await
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
646
|
+
// 3. Execute agent with all 213 MCP tools
|
|
647
|
+
const result = await flowNexus.sandboxExecute({
|
|
648
|
+
sandbox_id: sandbox.id,
|
|
649
|
+
code: `
|
|
650
|
+
const { query } = require('@anthropic-ai/claude-agent-sdk');
|
|
651
|
+
await query({ prompt: "Analyze API security", options: { mcpServers: {...} } });
|
|
652
|
+
`
|
|
1386
653
|
});
|
|
1387
654
|
|
|
1388
|
-
|
|
655
|
+
// 4. Cleanup
|
|
656
|
+
await flowNexus.sandboxDelete({ sandbox_id: sandbox.id });
|
|
1389
657
|
```
|
|
1390
658
|
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
npx agentic-flow --agent flow-nexus-auth \
|
|
1398
|
-
--task "Register with email: user@example.com"
|
|
1399
|
-
|
|
1400
|
-
# Login
|
|
1401
|
-
npx agentic-flow --agent flow-nexus-auth \
|
|
1402
|
-
--task "Login with email: user@example.com, password: ***"
|
|
1403
|
-
|
|
1404
|
-
# Create cloud sandbox
|
|
1405
|
-
npx agentic-flow --agent flow-nexus-sandbox \
|
|
1406
|
-
--task "Create Node.js sandbox and execute: console.log('Hello')"
|
|
1407
|
-
```
|
|
659
|
+
**Benefits:**
|
|
660
|
+
- β
All 213 MCP tools work
|
|
661
|
+
- β
Auto-scaling (1 to 100+ sandboxes)
|
|
662
|
+
- β
Multi-language templates (Node, Python, React, Next.js)
|
|
663
|
+
- β
Real-time streaming
|
|
664
|
+
- β
Pay-per-use (10 credits/hour β $1/hour)
|
|
1408
665
|
|
|
1409
666
|
---
|
|
1410
667
|
|
|
1411
|
-
##
|
|
1412
|
-
|
|
1413
|
-
### Benchmarks
|
|
668
|
+
## π Cost Analysis
|
|
1414
669
|
|
|
1415
|
-
|
|
1416
|
-
|--------|--------|
|
|
1417
|
-
| **Cold Start** | <2s (including MCP initialization) |
|
|
1418
|
-
| **Warm Start** | <500ms (cached MCP servers) |
|
|
1419
|
-
| **Agent Spawn** | 75 agents loaded in <2s |
|
|
1420
|
-
| **Tool Discovery** | 203 tools accessible in <1s |
|
|
1421
|
-
| **Memory Footprint** | 100-200MB per agent process |
|
|
1422
|
-
| **Concurrent Agents** | 10+ on t3.small, 100+ on c6a.xlarge |
|
|
1423
|
-
| **Token Efficiency** | 32% reduction via swarm coordination |
|
|
670
|
+
### Monthly Costs for 100 Daily Code Reviews
|
|
1424
671
|
|
|
1425
|
-
|
|
672
|
+
| Provider | Model | Cost per Review | Monthly Total | Savings |
|
|
673
|
+
|----------|-------|----------------|---------------|---------|
|
|
674
|
+
| Anthropic | Claude Sonnet 4.5 | $0.08 | **$240** | Baseline |
|
|
675
|
+
| DeepSeek (OpenRouter) | deepseek-chat-v3.1 | $0.012 | **$36** | **85%** |
|
|
676
|
+
| Llama (OpenRouter) | llama-3.1-8b | $0.003 | **$9** | **96%** |
|
|
677
|
+
| Gemini (Proxy) | gemini-2.0-flash | $0.00 (free tier) | **$0** | **100%** |
|
|
678
|
+
| ONNX (Local) | phi-4 | $0.00 | **$0** | **100%** |
|
|
1426
679
|
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
| OpenRouter | DeepSeek | API | $0.14 | $14 |
|
|
1432
|
-
| Claude | Sonnet 3.5 | API | $3.00 | $300 |
|
|
1433
|
-
|
|
1434
|
-
**ONNX Savings:** Up to $3,600/year for typical development workloads
|
|
680
|
+
**Real Savings:**
|
|
681
|
+
- **$204/month** switching to DeepSeek
|
|
682
|
+
- **$231/month** switching to Llama 3.1
|
|
683
|
+
- **$240/month** using Gemini free tier or ONNX
|
|
1435
684
|
|
|
1436
685
|
---
|
|
1437
686
|
|
|
1438
|
-
## π οΈ
|
|
687
|
+
## π οΈ Configuration
|
|
1439
688
|
|
|
1440
|
-
###
|
|
689
|
+
### Environment Variables
|
|
1441
690
|
|
|
1442
691
|
```bash
|
|
1443
|
-
#
|
|
1444
|
-
|
|
1445
|
-
|
|
692
|
+
# Required (choose one provider)
|
|
693
|
+
export ANTHROPIC_API_KEY=sk-ant-... # For Claude models
|
|
694
|
+
export OPENROUTER_API_KEY=sk-or-v1-... # For OpenRouter models
|
|
695
|
+
export GOOGLE_GEMINI_API_KEY=AIza... # For Gemini models
|
|
696
|
+
|
|
697
|
+
# MCP Tools (optional)
|
|
698
|
+
export ENABLE_CLAUDE_FLOW_SDK=true # Enable in-SDK MCP tools
|
|
1446
699
|
|
|
1447
|
-
#
|
|
1448
|
-
|
|
700
|
+
# Proxy (optional)
|
|
701
|
+
export ANTHROPIC_BASE_URL=http://localhost:3000 # For proxy usage
|
|
1449
702
|
|
|
1450
|
-
#
|
|
1451
|
-
|
|
703
|
+
# Model Selection (optional)
|
|
704
|
+
export COMPLETION_MODEL=meta-llama/llama-3.1-8b-instruct # Override default
|
|
1452
705
|
|
|
1453
|
-
#
|
|
1454
|
-
|
|
706
|
+
# Execution (optional)
|
|
707
|
+
export ENABLE_STREAMING=true # Enable real-time streaming
|
|
708
|
+
export HEALTH_PORT=8080 # Health check port
|
|
1455
709
|
```
|
|
1456
710
|
|
|
1457
|
-
###
|
|
711
|
+
### Configuration File (.env)
|
|
1458
712
|
|
|
1459
713
|
```bash
|
|
1460
|
-
#
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
# Validate MCP tools
|
|
1467
|
-
npm run validate
|
|
714
|
+
# .env file (auto-loaded)
|
|
715
|
+
ANTHROPIC_API_KEY=sk-ant-...
|
|
716
|
+
OPENROUTER_API_KEY=sk-or-v1-...
|
|
717
|
+
GOOGLE_GEMINI_API_KEY=AIza...
|
|
718
|
+
ENABLE_CLAUDE_FLOW_SDK=true
|
|
719
|
+
COMPLETION_MODEL=deepseek/deepseek-chat-v3.1
|
|
1468
720
|
```
|
|
1469
721
|
|
|
1470
|
-
### Adding Custom Agents
|
|
1471
|
-
|
|
1472
|
-
1. Create agent definition: `.claude/agents/custom/my-agent.md`
|
|
1473
|
-
2. Define system prompt and capabilities
|
|
1474
|
-
3. Test: `npx agentic-flow --agent my-agent --task "Test"`
|
|
1475
|
-
4. Deploy: `npm run build && docker build -t my-agents .`
|
|
1476
|
-
|
|
1477
722
|
---
|
|
1478
723
|
|
|
1479
|
-
##
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
-
|
|
1483
|
-
-
|
|
1484
|
-
-
|
|
1485
|
-
-
|
|
724
|
+
## π Complete Agent List
|
|
725
|
+
|
|
726
|
+
### Core Development (5 agents)
|
|
727
|
+
- `coder` - Implementation specialist
|
|
728
|
+
- `reviewer` - Code review and QA
|
|
729
|
+
- `tester` - Comprehensive testing
|
|
730
|
+
- `planner` - Strategic planning
|
|
731
|
+
- `researcher` - Research and analysis
|
|
732
|
+
|
|
733
|
+
### Specialized Development (8 agents)
|
|
734
|
+
- `backend-dev` - REST/GraphQL APIs
|
|
735
|
+
- `mobile-dev` - React Native
|
|
736
|
+
- `ml-developer` - Machine learning
|
|
737
|
+
- `system-architect` - Architecture design
|
|
738
|
+
- `cicd-engineer` - CI/CD pipelines
|
|
739
|
+
- `api-docs` - API documentation
|
|
740
|
+
- `production-validator` - Deployment checks
|
|
741
|
+
- `base-template-generator` - Boilerplate generation
|
|
742
|
+
|
|
743
|
+
### GitHub Integration (10 agents)
|
|
744
|
+
- `pr-manager` - PR lifecycle
|
|
745
|
+
- `code-review-swarm` - Multi-agent review
|
|
746
|
+
- `issue-tracker` - Issue management
|
|
747
|
+
- `release-manager` - Release coordination
|
|
748
|
+
- `workflow-automation` - GitHub Actions
|
|
749
|
+
- `repo-architect` - Repository structure
|
|
750
|
+
- `multi-repo-swarm` - Multi-repo coordination
|
|
751
|
+
- `sync-coordinator` - Cross-repo sync
|
|
752
|
+
- `project-board-sync` - Project boards
|
|
753
|
+
- `swarm-pr`, `swarm-issue` - Issue/PR swarms
|
|
754
|
+
|
|
755
|
+
### Performance & Analysis (3 agents)
|
|
756
|
+
- `perf-analyzer` - Bottleneck detection
|
|
757
|
+
- `performance-benchmarker` - Benchmarking
|
|
758
|
+
- `code-analyzer` - Code quality
|
|
759
|
+
|
|
760
|
+
### Swarm Coordinators (5 agents)
|
|
761
|
+
- `hierarchical-coordinator` - Tree structure
|
|
762
|
+
- `mesh-coordinator` - Peer-to-peer
|
|
763
|
+
- `adaptive-coordinator` - Dynamic topology
|
|
764
|
+
- `swarm-memory-manager` - Memory sync
|
|
765
|
+
- `collective-intelligence-coordinator` - Hive mind
|
|
766
|
+
|
|
767
|
+
### Consensus & Distributed (6 agents)
|
|
768
|
+
- `byzantine-coordinator` - Byzantine fault tolerance
|
|
769
|
+
- `raft-manager` - Raft consensus
|
|
770
|
+
- `gossip-coordinator` - Gossip protocol
|
|
771
|
+
- `crdt-synchronizer` - CRDT sync
|
|
772
|
+
- `quorum-manager` - Quorum management
|
|
773
|
+
- `security-manager` - Security protocols
|
|
774
|
+
|
|
775
|
+
### SPARC Methodology (6 agents)
|
|
776
|
+
- `sparc-coord` - SPARC orchestration
|
|
777
|
+
- `sparc-coder` - TDD implementation
|
|
778
|
+
- `specification` - Requirements analysis
|
|
779
|
+
- `pseudocode` - Algorithm design
|
|
780
|
+
- `architecture` - System design
|
|
781
|
+
- `refinement` - Iterative improvement
|
|
782
|
+
|
|
783
|
+
### Testing (2 agents)
|
|
784
|
+
- `tdd-london-swarm` - Mock-driven TDD
|
|
785
|
+
- `production-validator` - Deployment validation
|
|
786
|
+
|
|
787
|
+
### Planning (4 agents)
|
|
788
|
+
- `goal-planner` - GOAP planning
|
|
789
|
+
- `code-goal-planner` - Code-centric planning
|
|
790
|
+
- `task-orchestrator` - Task coordination
|
|
791
|
+
- `smart-agent` - Intelligent spawning
|
|
792
|
+
|
|
793
|
+
### Specialized (7+ agents)
|
|
794
|
+
- `migration-planner` - Code migration
|
|
795
|
+
- `swarm-init` - Topology optimization
|
|
796
|
+
- `memory-coordinator` - Cross-session memory
|
|
797
|
+
- And 20+ more...
|
|
798
|
+
|
|
799
|
+
**Total: 66+ agents** | Use `npx agentic-flow --list` to see all
|
|
1486
800
|
|
|
1487
801
|
---
|
|
1488
802
|
|
|
1489
|
-
##
|
|
1490
|
-
|
|
1491
|
-
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
803
|
+
## π Links & Resources
|
|
1492
804
|
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
7. Open Pull Request
|
|
805
|
+
- **π¦ NPM Package**: [npmjs.com/package/agentic-flow](https://www.npmjs.com/package/agentic-flow)
|
|
806
|
+
- **π GitHub**: [github.com/ruvnet/agentic-flow](https://github.com/ruvnet/agentic-flow)
|
|
807
|
+
- **π Documentation**: [docs/](docs/)
|
|
808
|
+
- **π€ Claude Agent SDK**: [docs.claude.com/en/api/agent-sdk](https://docs.claude.com/en/api/agent-sdk)
|
|
809
|
+
- **β‘ Claude Flow**: [github.com/ruvnet/claude-flow](https://github.com/ruvnet/claude-flow)
|
|
810
|
+
- **βοΈ Flow Nexus**: [github.com/ruvnet/flow-nexus](https://github.com/ruvnet/flow-nexus)
|
|
811
|
+
- **π OpenRouter**: [openrouter.ai](https://openrouter.ai)
|
|
1501
812
|
|
|
1502
813
|
---
|
|
1503
814
|
|
|
@@ -1517,16 +828,8 @@ Built with:
|
|
|
1517
828
|
|
|
1518
829
|
---
|
|
1519
830
|
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
- **Documentation**: See [docs/](docs/) folder
|
|
1523
|
-
- **Issues**: [GitHub Issues](https://github.com/ruvnet/agentic-flow/issues)
|
|
1524
|
-
- **Discussions**: [GitHub Discussions](https://github.com/ruvnet/agentic-flow/discussions)
|
|
1525
|
-
|
|
1526
|
-
---
|
|
1527
|
-
|
|
1528
|
-
**Deploy ephemeral AI agents in seconds. Scale to thousands. Pay only for what you use.** π
|
|
831
|
+
**Deploy AI agents in seconds. Scale to thousands. Pay only for what you use.** π
|
|
1529
832
|
|
|
1530
833
|
```bash
|
|
1531
|
-
npx agentic-flow --agent
|
|
834
|
+
npx agentic-flow --agent coder --task "Your task here"
|
|
1532
835
|
```
|