crewx 0.2.4-dev.7 → 0.2.4-dev.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,555 @@
1
+ # Remote Agents
2
+
3
+ Connect CrewX to other CrewX instances for distributed collaboration and resource sharing.
4
+
5
+ ## Overview
6
+
7
+ Remote agents allow you to:
8
+ - **Delegate tasks** to CrewX instances running in different projects
9
+ - **Share resources** across teams and servers
10
+ - **Isolate contexts** for different codebases
11
+ - **Scale workloads** by distributing to remote servers
12
+
13
+ ## Quick Start
14
+
15
+ ### 1. Start a Remote MCP Server
16
+
17
+ ```bash
18
+ # Start CrewX as an MCP server with HTTP and authentication
19
+ crewx mcp server --http --host localhost --port 9001 --key "sk-secret-key" --log
20
+ ```
21
+
22
+ **Options:**
23
+ - `--http` - Enable HTTP transport (in addition to stdio)
24
+ - `--host` - Server hostname (default: localhost)
25
+ - `--port` - Server port (default: 3000)
26
+ - `--key` - API key for bearer authentication
27
+ - `--log` - Enable request logging
28
+
29
+ ### 2. Configure Remote Provider
30
+
31
+ Add to your local `crewx.yaml`:
32
+
33
+ ```yaml
34
+ providers:
35
+ - id: remote_server
36
+ type: remote
37
+ location: "http://localhost:9001"
38
+ external_agent_id: "backend_team"
39
+ display_name: "Backend Server"
40
+ description: "Remote CrewX instance for backend tasks"
41
+ auth:
42
+ type: bearer
43
+ token: "sk-secret-key"
44
+ timeout:
45
+ query: 300000 # 5 minutes
46
+ execute: 600000 # 10 minutes
47
+
48
+ agents:
49
+ - id: "remote_backend"
50
+ name: "Backend Team"
51
+ provider: "remote/remote_server"
52
+ description: "Backend development team on remote server"
53
+ ```
54
+
55
+ ### 3. Use Remote Agent
56
+
57
+ ```bash
58
+ # Query remote agent
59
+ crewx query "@remote_backend check API status"
60
+
61
+ # Execute tasks on remote agent
62
+ crewx execute "@remote_backend implement new endpoint"
63
+
64
+ # Combine with local agents
65
+ crewx query "@claude @remote_backend compare approaches"
66
+ ```
67
+
68
+ ## Configuration
69
+
70
+ ### Provider Configuration
71
+
72
+ ```yaml
73
+ providers:
74
+ - id: unique_provider_id
75
+ type: remote
76
+ location: "http://hostname:port" or "file:///absolute/path/to/config.yaml"
77
+ external_agent_id: "target_agent_id_on_remote"
78
+ display_name: "Human Readable Name"
79
+ description: "Provider description"
80
+ auth: # Optional
81
+ type: bearer
82
+ token: "your-token"
83
+ headers: # Optional custom headers
84
+ "User-Agent": "CrewX/1.0"
85
+ "X-Client-ID": "client-123"
86
+ timeout:
87
+ query: 300000 # Milliseconds (default: 5 min)
88
+ execute: 600000 # Milliseconds (default: 10 min)
89
+ ```
90
+
91
+ ### Agent Configuration
92
+
93
+ ```yaml
94
+ agents:
95
+ - id: "local_agent_id"
96
+ name: "Display Name"
97
+ provider: "remote/provider_id"
98
+ description: "Agent description"
99
+ working_directory: "/path/to/workdir" # Optional
100
+ ```
101
+
102
+ ## Connection Types
103
+
104
+ ### HTTP-based Remote Server
105
+
106
+ Most common for network-based remote connections.
107
+
108
+ **Remote server setup:**
109
+ ```bash
110
+ # On the remote server (192.168.1.100)
111
+ cd /path/to/project
112
+ crewx mcp server --http --host 0.0.0.0 --port 3000 --key "production-key"
113
+ ```
114
+
115
+ **Local configuration:**
116
+ ```yaml
117
+ providers:
118
+ - id: production_server
119
+ type: remote
120
+ location: "http://192.168.1.100:3000"
121
+ external_agent_id: "prod_backend"
122
+ auth:
123
+ type: bearer
124
+ token: "production-key"
125
+ timeout:
126
+ query: 180000
127
+ execute: 600000
128
+ ```
129
+
130
+ ### File-based Local Remote
131
+
132
+ Access another local CrewX configuration without starting a server.
133
+
134
+ **Use case:** Multi-project coordination on the same machine.
135
+
136
+ ```yaml
137
+ providers:
138
+ - id: other_project
139
+ type: remote
140
+ location: "file:///Users/username/projects/other-project/crewx.yaml"
141
+ external_agent_id: "specialist_agent"
142
+ timeout:
143
+ query: 300000
144
+ execute: 600000
145
+
146
+ agents:
147
+ - id: "other_project_team"
148
+ provider: "remote/other_project"
149
+ ```
150
+
151
+ **Example usage:**
152
+ ```bash
153
+ # Current project: main application
154
+ # Remote project: data processing pipeline
155
+
156
+ crewx execute "@other_project_team process new dataset"
157
+ ```
158
+
159
+ ## Use Cases
160
+
161
+ ### Multi-Project Coordination
162
+
163
+ Coordinate work across multiple repositories:
164
+
165
+ ```yaml
166
+ # In main project's crewx.yaml
167
+ providers:
168
+ - id: frontend_project
169
+ type: remote
170
+ location: "file:///workspace/frontend-app/crewx.yaml"
171
+ external_agent_id: "react_specialist"
172
+
173
+ - id: backend_project
174
+ type: remote
175
+ location: "file:///workspace/backend-api/crewx.yaml"
176
+ external_agent_id: "api_specialist"
177
+
178
+ agents:
179
+ - id: "frontend_team"
180
+ provider: "remote/frontend_project"
181
+
182
+ - id: "backend_team"
183
+ provider: "remote/backend_project"
184
+
185
+ - id: "coordinator"
186
+ provider: "cli/claude"
187
+ inline:
188
+ system_prompt: |
189
+ You coordinate between frontend and backend teams.
190
+ Use @frontend_team for React/UI tasks.
191
+ Use @backend_team for API/database tasks.
192
+ ```
193
+
194
+ **Usage:**
195
+ ```bash
196
+ # Coordinate full-stack feature
197
+ crewx query "@coordinator plan user authentication feature"
198
+ crewx execute "@frontend_team create login UI" "@backend_team create auth API"
199
+ ```
200
+
201
+ ### Distributed Team Setup
202
+
203
+ Each team member runs their own CrewX with specialized configurations:
204
+
205
+ **Team Lead's configuration:**
206
+ ```yaml
207
+ providers:
208
+ - id: alice_workstation
209
+ type: remote
210
+ location: "http://alice.local:3000"
211
+ external_agent_id: "alice_specialist"
212
+ auth:
213
+ type: bearer
214
+ token: "alice-key"
215
+
216
+ - id: bob_workstation
217
+ type: remote
218
+ location: "http://bob.local:3000"
219
+ external_agent_id: "bob_specialist"
220
+ auth:
221
+ type: bearer
222
+ token: "bob-key"
223
+
224
+ agents:
225
+ - id: "alice"
226
+ provider: "remote/alice_workstation"
227
+ description: "Alice's specialized AI setup (ML focus)"
228
+
229
+ - id: "bob"
230
+ provider: "remote/bob_workstation"
231
+ description: "Bob's specialized AI setup (DevOps focus)"
232
+ ```
233
+
234
+ ### Resource Sharing
235
+
236
+ Access powerful compute resources from lightweight clients:
237
+
238
+ ```yaml
239
+ # Laptop configuration
240
+ providers:
241
+ - id: gpu_server
242
+ type: remote
243
+ location: "http://gpu-server.company.com:3000"
244
+ external_agent_id: "ml_trainer"
245
+ auth:
246
+ type: bearer
247
+ token: "${ML_SERVER_TOKEN}" # Use environment variable
248
+ timeout:
249
+ query: 600000 # 10 min for ML tasks
250
+ execute: 1800000 # 30 min for training
251
+
252
+ agents:
253
+ - id: "ml_server"
254
+ provider: "remote/gpu_server"
255
+ description: "High-performance ML agent on GPU server"
256
+ ```
257
+
258
+ ## Environment Variables
259
+
260
+ Use environment variables for sensitive configuration:
261
+
262
+ ```yaml
263
+ providers:
264
+ - id: prod_server
265
+ type: remote
266
+ location: "${CREWX_REMOTE_URL}"
267
+ external_agent_id: "${CREWX_REMOTE_AGENT}"
268
+ auth:
269
+ type: bearer
270
+ token: "${CREWX_REMOTE_TOKEN}"
271
+ ```
272
+
273
+ **.env file:**
274
+ ```bash
275
+ CREWX_REMOTE_URL=http://production.example.com:3000
276
+ CREWX_REMOTE_AGENT=backend_prod
277
+ CREWX_REMOTE_TOKEN=sk-prod-secret-key
278
+ ```
279
+
280
+ ## Authentication
281
+
282
+ ### Bearer Token Authentication
283
+
284
+ Most common method for HTTP remote servers.
285
+
286
+ **Server side:**
287
+ ```bash
288
+ crewx mcp server --http --port 3000 --key "sk-production-key-123"
289
+ ```
290
+
291
+ **Client side:**
292
+ ```yaml
293
+ providers:
294
+ - id: secure_server
295
+ type: remote
296
+ location: "http://server:3000"
297
+ external_agent_id: "agent"
298
+ auth:
299
+ type: bearer
300
+ token: "sk-production-key-123"
301
+ ```
302
+
303
+ The token is sent as: `Authorization: Bearer sk-production-key-123`
304
+
305
+ ### Custom Headers
306
+
307
+ Add additional headers for advanced authentication or routing:
308
+
309
+ ```yaml
310
+ providers:
311
+ - id: enterprise_server
312
+ type: remote
313
+ location: "http://api.company.com:3000"
314
+ external_agent_id: "agent"
315
+ auth:
316
+ type: bearer
317
+ token: "jwt-token-here"
318
+ headers:
319
+ "X-Tenant-ID": "company-123"
320
+ "X-Environment": "production"
321
+ "User-Agent": "CrewX/1.0"
322
+ ```
323
+
324
+ ## Timeouts
325
+
326
+ Configure appropriate timeouts based on task complexity and network conditions:
327
+
328
+ ```yaml
329
+ providers:
330
+ - id: slow_network
331
+ type: remote
332
+ location: "http://remote:3000"
333
+ external_agent_id: "agent"
334
+ timeout:
335
+ query: 600000 # 10 minutes (slow network + complex query)
336
+ execute: 1800000 # 30 minutes (network + file operations)
337
+ ```
338
+
339
+ **Recommended timeouts:**
340
+ - **Local network**: query 60-120s, execute 180-300s
341
+ - **Internet**: query 180-300s, execute 600-900s
342
+ - **Complex tasks**: query 300-600s, execute 900-1800s
343
+
344
+ ## Limitations
345
+
346
+ ### Current Limitations
347
+
348
+ 1. **Stateless calls**
349
+ - `--thread` conversation history is NOT forwarded to remote server
350
+ - Each remote call is independent
351
+ - Solution: Use remote server's own thread management
352
+
353
+ 2. **MCP tool requirements**
354
+ - Remote server must expose `crewx_queryAgent` and `crewx_executeAgent` tools
355
+ - Standard CrewX MCP server includes these automatically
356
+
357
+ 3. **Network considerations**
358
+ - Higher latency than local agents
359
+ - Configure timeouts appropriately
360
+ - Consider task granularity
361
+
362
+ ### Workarounds
363
+
364
+ **For conversation continuity:**
365
+ ```bash
366
+ # Don't use --thread across remote boundaries
367
+ # Instead, use remote server's thread locally
368
+
369
+ # On remote server
370
+ crewx query "@agent design API" --thread "project"
371
+ crewx execute "@agent implement it" --thread "project"
372
+
373
+ # From client (each call is independent)
374
+ crewx query "@remote_agent task description with full context"
375
+ ```
376
+
377
+ **For long-running tasks:**
378
+ ```yaml
379
+ # Increase timeout for complex operations
380
+ providers:
381
+ - id: slow_tasks
382
+ type: remote
383
+ location: "http://server:3000"
384
+ external_agent_id: "agent"
385
+ timeout:
386
+ execute: 3600000 # 1 hour
387
+ ```
388
+
389
+ ## Troubleshooting
390
+
391
+ ### Connection Issues
392
+
393
+ **Problem:** Cannot connect to remote server
394
+
395
+ ```bash
396
+ # Test network connectivity
397
+ curl http://remote-host:3000/health
398
+
399
+ # Check server logs
400
+ crewx mcp server --http --port 3000 --log
401
+ ```
402
+
403
+ **Solution:**
404
+ - Verify server is running: `crewx mcp server --http`
405
+ - Check firewall rules
406
+ - Verify hostname/port in configuration
407
+ - Test with curl first
408
+
409
+ ### Authentication Failures
410
+
411
+ **Problem:** 401 Unauthorized
412
+
413
+ **Solution:**
414
+ - Verify token matches between client and server
415
+ - Check token is correctly set in config
416
+ - Ensure `auth.type` is set to `bearer`
417
+
418
+ ### Timeout Errors
419
+
420
+ **Problem:** Task times out
421
+
422
+ **Solution:**
423
+ - Increase timeout values in provider config
424
+ - Check network latency: `ping remote-host`
425
+ - Split large tasks into smaller chunks
426
+
427
+ ### Agent Not Found
428
+
429
+ **Problem:** Remote agent ID doesn't exist
430
+
431
+ **Solution:**
432
+ - List available agents on remote: `crewx mcp server --list`
433
+ - Verify `external_agent_id` matches remote agent ID
434
+ - Check remote server's `crewx.yaml` configuration
435
+
436
+ ## Best Practices
437
+
438
+ 1. **Security**
439
+ - Use strong API keys (min 16 characters)
440
+ - Store tokens in environment variables, not in config files
441
+ - Use HTTPS for remote connections in production
442
+ - Rotate tokens regularly
443
+
444
+ 2. **Performance**
445
+ - Use remote agents for specialized tasks, not everything
446
+ - Consider network latency in workflow design
447
+ - Set realistic timeouts
448
+ - Monitor remote server resource usage
449
+
450
+ 3. **Organization**
451
+ - Use clear, descriptive agent IDs
452
+ - Document what each remote agent does
453
+ - Version control your remote configurations
454
+ - Keep remote server configs synchronized
455
+
456
+ 4. **Reliability**
457
+ - Implement health checks
458
+ - Have fallback local agents
459
+ - Log remote calls for debugging
460
+ - Monitor remote server availability
461
+
462
+ ## Examples
463
+
464
+ ### Example 1: Development → Staging → Production
465
+
466
+ ```yaml
467
+ # development.crewx.yaml
468
+ providers:
469
+ - id: staging_server
470
+ type: remote
471
+ location: "http://staging.company.com:3000"
472
+ external_agent_id: "staging_tester"
473
+ auth:
474
+ type: bearer
475
+ token: "${STAGING_TOKEN}"
476
+
477
+ - id: prod_server
478
+ type: remote
479
+ location: "http://prod.company.com:3000"
480
+ external_agent_id: "prod_deployer"
481
+ auth:
482
+ type: bearer
483
+ token: "${PROD_TOKEN}"
484
+
485
+ agents:
486
+ - id: "dev_agent"
487
+ provider: "cli/claude"
488
+ working_directory: "./src"
489
+
490
+ - id: "staging_agent"
491
+ provider: "remote/staging_server"
492
+
493
+ - id: "prod_agent"
494
+ provider: "remote/prod_server"
495
+ ```
496
+
497
+ **Workflow:**
498
+ ```bash
499
+ # Develop locally
500
+ crewx execute "@dev_agent implement feature"
501
+
502
+ # Test on staging
503
+ crewx query "@staging_agent run integration tests"
504
+
505
+ # Deploy to production
506
+ crewx execute "@prod_agent deploy version 1.2.3"
507
+ ```
508
+
509
+ ### Example 2: Specialized Domain Experts
510
+
511
+ ```yaml
512
+ providers:
513
+ - id: ml_server
514
+ type: remote
515
+ location: "http://ml-gpu.local:3000"
516
+ external_agent_id: "ml_expert"
517
+
518
+ - id: security_server
519
+ type: remote
520
+ location: "http://security.local:3000"
521
+ external_agent_id: "security_expert"
522
+
523
+ agents:
524
+ - id: "ml_specialist"
525
+ provider: "remote/ml_server"
526
+ description: "ML/AI expert with GPU access"
527
+
528
+ - id: "security_specialist"
529
+ provider: "remote/security_server"
530
+ description: "Security analysis expert"
531
+
532
+ - id: "architect"
533
+ provider: "cli/claude"
534
+ inline:
535
+ system_prompt: |
536
+ You're the system architect. Coordinate with specialists:
537
+ - @ml_specialist for ML/AI questions
538
+ - @security_specialist for security reviews
539
+ ```
540
+
541
+ **Usage:**
542
+ ```bash
543
+ # Architect coordinates specialists
544
+ crewx query "@architect design user recommendation system"
545
+ # → Architect consults @ml_specialist for ML design
546
+
547
+ crewx query "@architect review authentication code"
548
+ # → Architect consults @security_specialist for security review
549
+ ```
550
+
551
+ ## See Also
552
+
553
+ - [Agent Configuration](./agent-configuration.md) - General agent setup
554
+ - [MCP Integration](./mcp-integration.md) - MCP server configuration
555
+ - [CLI Guide](./cli-guide.md) - Command-line reference
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "crewx",
3
- "version": "0.2.4-dev.7",
3
+ "version": "0.2.4-dev.8",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Bring Your Own AI(BYOA) team in Slack/IDE(MCP) with your existing subscriptions",
6
6
  "main": "dist/main.js",