@chandshantanu/agentbuilder-mcp-server 0.2.0

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,509 @@
1
+ # AgentBuilder MCP - Agent Deployment Guide
2
+
3
+ **Version**: 0.2.0
4
+ **Date**: 2026-01-27
5
+ **Status**: Production Ready
6
+
7
+ ---
8
+
9
+ ## 📋 Overview
10
+
11
+ The AgentBuilder MCP server now supports deploying marketplace agents directly to Kubernetes production environment via the `deploy_agent` tool. Deployed agents automatically appear in the seller/admin/creator dashboard and use the configuration created during agent setup.
12
+
13
+ ---
14
+
15
+ ## 🚀 Agent Deployment Workflow
16
+
17
+ ### Complete Flow
18
+
19
+ ```
20
+ 1. Create/Configure Agent in Dashboard
21
+
22
+ 2. Deploy via MCP (uses stored configuration)
23
+
24
+ 3. Agent deploys to Kubernetes (AKS)
25
+
26
+ 4. Deployment appears in Seller/Admin Dashboard
27
+
28
+ 5. Monitor deployment status
29
+
30
+ 6. Access deployed agent endpoint
31
+ ```
32
+
33
+ ### Architecture
34
+
35
+ - **Agent Creation**: Agents are created via web dashboard with full configuration
36
+ - **Configuration Storage**: Agent configuration is stored in MongoDB during creation
37
+ - **MCP Deployment**: MCP `deploy_agent` tool triggers deployment using stored config
38
+ - **Kubernetes**: Agent deployed as pods on Azure Kubernetes Service (AKS)
39
+ - **Dashboard Visibility**: Deployed agents visible in seller/admin/creator dashboard
40
+ - **Access Control**: Only agent owner or admin/seller can deploy and manage
41
+
42
+ ---
43
+
44
+ ## 🔧 Using the deploy_agent Tool
45
+
46
+ ### Basic Deployment
47
+
48
+ ```typescript
49
+ // In Claude Code, ask:
50
+ "Deploy agent <agent_id>"
51
+
52
+ // Or more specifically:
53
+ "Deploy agent 65abc123def456789 to production"
54
+ ```
55
+
56
+ ### With Custom Configuration
57
+
58
+ ```typescript
59
+ // Deploy with specific resource allocation
60
+ "Deploy agent 65abc123def456789 with 3 replicas and 1GB memory"
61
+
62
+ // Deploy with full configuration
63
+ Deploy agent 65abc123def456789 with configuration:
64
+ {
65
+ "replicas": 2,
66
+ "cpu_request": "500m",
67
+ "cpu_limit": "1000m",
68
+ "memory_request": "512Mi",
69
+ "memory_limit": "1Gi"
70
+ }
71
+ ```
72
+
73
+ ### MCP Tool Parameters
74
+
75
+ ```typescript
76
+ deploy_agent({
77
+ agent_id: string, // Required: Agent ID to deploy
78
+ deployment_config?: { // Optional: Deployment configuration
79
+ replicas?: number, // Number of pod replicas (default: 1)
80
+ cpu_request?: string, // CPU request per pod (default: "100m")
81
+ cpu_limit?: string, // CPU limit per pod (default: "500m")
82
+ memory_request?: string, // Memory request per pod (default: "128Mi")
83
+ memory_limit?: string, // Memory limit per pod (default: "512Mi")
84
+ image?: string // Container image (auto-selected if not provided)
85
+ }
86
+ })
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🔐 Permissions & Access Control
92
+
93
+ ### Who Can Deploy Agents?
94
+
95
+ - **Agent Owner**: The user who created the agent
96
+ - **Sellers**: Users with SELLER or CREATOR_ADMIN role
97
+ - **Admins**: Users with ADMIN or SUPER_ADMIN role
98
+
99
+ ### Required Permissions
100
+
101
+ - Agent must exist and be owned by user OR user must have seller/admin role
102
+ - User must be authenticated via OAuth 2.0 (production) or JWT (dev/test)
103
+ - Agent configuration must be valid and complete
104
+
105
+ ---
106
+
107
+ ## 📊 Deployment Response
108
+
109
+ ### Successful Deployment
110
+
111
+ ```json
112
+ {
113
+ "success": true,
114
+ "deployment_id": "agent-65abc123-a1b2c3d4",
115
+ "agent_id": "65abc123def456789",
116
+ "agent_name": "Instagram DM Sales Agent",
117
+ "status": "pending",
118
+ "namespace": "agent-deployments",
119
+ "replicas": 1,
120
+ "endpoint_url": null,
121
+ "created_at": "2026-01-27T01:15:30Z",
122
+ "message": "Agent deployment initiated successfully. Deployment will be ready in 2-3 minutes."
123
+ }
124
+ ```
125
+
126
+ ### MCP Tool Response (Formatted)
127
+
128
+ ```
129
+ ✅ Agent Deployment Initiated
130
+
131
+ 📋 Deployment Details:
132
+ Agent: Instagram DM Sales Agent
133
+ Deployment ID: agent-65abc123-a1b2c3d4
134
+ Status: pending
135
+ Namespace: agent-deployments
136
+ Replicas: 1
137
+ Created: 2026-01-27T01:15:30Z
138
+
139
+ ⏱️ Agent deployment initiated successfully. Deployment will be ready in 2-3 minutes.
140
+
141
+ 📊 Next Steps:
142
+ 1. Monitor deployment status in seller/admin dashboard
143
+ 2. Wait 2-3 minutes for pods to become ready
144
+ 3. Check endpoint health once deployed
145
+ 4. Configure custom domain (optional)
146
+
147
+ 💡 View deployment in dashboard:
148
+ https://agents.chatslytics.com/seller/instances
149
+ ```
150
+
151
+ ---
152
+
153
+ ## 🎯 Dashboard Integration
154
+
155
+ ### Where Deployed Agents Appear
156
+
157
+ **For Sellers/Creators:**
158
+ ```
159
+ Dashboard → Seller Area → Deployed Instances
160
+ URL: https://agents.chatslytics.com/seller/instances
161
+ ```
162
+
163
+ **For Admins:**
164
+ ```
165
+ Dashboard → Admin Panel → Agent Deployments
166
+ URL: https://agents.chatslytics.com/admin/deployments
167
+ ```
168
+
169
+ ### Dashboard Features
170
+
171
+ - **Deployment List**: View all your deployed agent instances
172
+ - **Status Monitoring**: Real-time deployment status (pending, running, failed)
173
+ - **Resource Metrics**: CPU, memory, replica count
174
+ - **Endpoint Access**: Direct link to agent API endpoint
175
+ - **Management Actions**:
176
+ - Scale replicas up/down
177
+ - View logs
178
+ - Restart deployment
179
+ - Terminate deployment
180
+
181
+ ---
182
+
183
+ ## 🐳 Container Images
184
+
185
+ ### Available Agent Images
186
+
187
+ Agents are automatically deployed with the appropriate container image based on agent type:
188
+
189
+ | Agent Type | Container Image | Registry |
190
+ |-----------|----------------|----------|
191
+ | Instagram DM | `instagram-dm-agent:latest` | acragentbuilder.azurecr.io |
192
+ | Patient Follow-up | `patient-followup-agent:latest` | acragentbuilder.azurecr.io |
193
+ | Custom Agent | `agent-base:latest` | acragentbuilder.azurecr.io |
194
+
195
+ ### Image Selection Logic
196
+
197
+ ```typescript
198
+ // Auto-selection based on agent type
199
+ agent_type === "instagram_dm" → instagram-dm-agent:latest
200
+ agent_type === "patient_followup" → patient-followup-agent:latest
201
+ agent_type === "custom" → agent-base:latest
202
+ ```
203
+
204
+ ### Using Custom Images
205
+
206
+ ```typescript
207
+ // Override with specific image
208
+ Deploy agent 65abc123def456789 with configuration:
209
+ {
210
+ "image": "acragentbuilder.azurecr.io/my-custom-agent:v2.0.0"
211
+ }
212
+ ```
213
+
214
+ ---
215
+
216
+ ## 🔄 Deployment Lifecycle
217
+
218
+ ### Status Flow
219
+
220
+ ```
221
+ PENDING → CREATING → RUNNING
222
+
223
+ FAILED
224
+ ```
225
+
226
+ ### Status Descriptions
227
+
228
+ - **PENDING**: Deployment request received, queued for processing
229
+ - **CREATING**: Kubernetes resources being created (pods, services, ingress)
230
+ - **RUNNING**: Agent pods running and healthy, endpoint accessible
231
+ - **FAILED**: Deployment failed (check logs for details)
232
+
233
+ ### Typical Timeline
234
+
235
+ ```
236
+ 0:00 - Deployment initiated (status: PENDING)
237
+ 0:10 - Namespace & resources created (status: CREATING)
238
+ 0:30 - Pods starting up
239
+ 1:00 - Health checks passing
240
+ 2:00 - Deployment ready (status: RUNNING)
241
+ ```
242
+
243
+ ---
244
+
245
+ ## 🏗️ Infrastructure Details
246
+
247
+ ### Kubernetes Resources Created
248
+
249
+ For each agent deployment:
250
+
251
+ 1. **ConfigMap**: Agent configuration (`agent-config-{deployment-id}`)
252
+ 2. **Secret**: API credentials (`agent-secret-{deployment-id}`)
253
+ 3. **Deployment**: Pod orchestration (`agent-deployment-{deployment-id}`)
254
+ 4. **Service**: Internal networking (`agent-service-{deployment-id}`)
255
+ 5. **Ingress**: External access (`agent-ingress-{deployment-id}`)
256
+
257
+ ### Default Resource Allocation
258
+
259
+ ```yaml
260
+ Resources per Pod:
261
+ CPU Request: 100m (0.1 cores)
262
+ CPU Limit: 500m (0.5 cores)
263
+ Memory Request: 128Mi
264
+ Memory Limit: 512Mi
265
+
266
+ Replicas: 1 (scalable)
267
+
268
+ Namespace: agent-deployments
269
+ ```
270
+
271
+ ### Scaling
272
+
273
+ ```typescript
274
+ // Scale via dashboard or API
275
+ Scale to 3 replicas for high availability
276
+ Scale to 5 replicas for peak traffic
277
+ Scale down to 1 replica for cost savings
278
+ ```
279
+
280
+ ---
281
+
282
+ ## 🌐 Accessing Deployed Agents
283
+
284
+ ### Endpoint Format
285
+
286
+ ```
287
+ https://agent-{deployment-id}.agents.agentbuilder.ai
288
+ ```
289
+
290
+ ### Example Endpoint
291
+
292
+ ```bash
293
+ # Deployment ID: agent-65abc123-a1b2c3d4
294
+ # Endpoint: https://agent-agent-65abc123-a1b2c3d4.agents.agentbuilder.ai
295
+
296
+ # Health check
297
+ curl https://agent-agent-65abc123-a1b2c3d4.agents.agentbuilder.ai/health
298
+
299
+ # Execute agent
300
+ curl -X POST https://agent-agent-65abc123-a1b2c3d4.agents.agentbuilder.ai/execute \
301
+ -H "Content-Type: application/json" \
302
+ -d '{"input": {"message": "Hello"}}'
303
+ ```
304
+
305
+ ---
306
+
307
+ ## 🔍 Monitoring Deployments
308
+
309
+ ### Via MCP (Future Enhancement)
310
+
311
+ ```typescript
312
+ // Check deployment status
313
+ Get deployment status for agent-65abc123-a1b2c3d4
314
+
315
+ // View deployment logs
316
+ Get logs for deployment agent-65abc123-a1b2c3d4
317
+
318
+ // List all deployments
319
+ List all my agent deployments
320
+ ```
321
+
322
+ ### Via Dashboard
323
+
324
+ 1. Navigate to Seller/Admin area
325
+ 2. Click on deployment to view details
326
+ 3. View real-time metrics:
327
+ - Pod status (running/pending/failed)
328
+ - CPU & memory usage
329
+ - Request count
330
+ - Error rate
331
+ - Uptime
332
+
333
+ ### Via kubectl (For Admins)
334
+
335
+ ```bash
336
+ # Get all agent deployments
337
+ kubectl get deployments -n agent-deployments -l app=agentbuilder
338
+
339
+ # Get specific deployment
340
+ kubectl get deployment agent-deployment-{deployment-id} -n agent-deployments
341
+
342
+ # View pod status
343
+ kubectl get pods -n agent-deployments -l deployment-id={deployment-id}
344
+
345
+ # View logs
346
+ kubectl logs -f deployment/agent-deployment-{deployment-id} -n agent-deployments
347
+
348
+ # Describe deployment
349
+ kubectl describe deployment agent-deployment-{deployment-id} -n agent-deployments
350
+ ```
351
+
352
+ ---
353
+
354
+ ## ⚠️ Troubleshooting
355
+
356
+ ### Deployment Stuck in PENDING
357
+
358
+ **Symptoms**: Deployment status remains "pending" for >5 minutes
359
+
360
+ **Possible Causes**:
361
+ - Kubernetes cluster at capacity
362
+ - Image pull issues
363
+ - Invalid configuration
364
+
365
+ **Solutions**:
366
+ ```bash
367
+ # Check pod events
368
+ kubectl describe pod -n agent-deployments -l deployment-id={deployment-id}
369
+
370
+ # Check image pull status
371
+ kubectl get events -n agent-deployments --sort-by='.lastTimestamp'
372
+
373
+ # View pod logs
374
+ kubectl logs -n agent-deployments -l deployment-id={deployment-id}
375
+ ```
376
+
377
+ ### Deployment FAILED
378
+
379
+ **Symptoms**: Deployment status shows "failed"
380
+
381
+ **Possible Causes**:
382
+ - Invalid agent configuration
383
+ - Missing API credentials
384
+ - Resource quota exceeded
385
+ - Image not found
386
+
387
+ **Solutions**:
388
+ 1. Check deployment logs in dashboard
389
+ 2. Verify agent configuration is valid
390
+ 3. Ensure API credentials are correct
391
+ 4. Check cluster resource availability
392
+ 5. Re-deploy with corrected configuration
393
+
394
+ ### Endpoint Not Accessible
395
+
396
+ **Symptoms**: Deployment shows "running" but endpoint returns errors
397
+
398
+ **Possible Causes**:
399
+ - Pods not healthy yet (wait 2-3 minutes)
400
+ - Health checks failing
401
+ - Ingress configuration issues
402
+ - DNS not propagated
403
+
404
+ **Solutions**:
405
+ ```bash
406
+ # Check pod health
407
+ kubectl get pods -n agent-deployments -l deployment-id={deployment-id}
408
+
409
+ # Check service
410
+ kubectl get service agent-service-{deployment-id} -n agent-deployments
411
+
412
+ # Check ingress
413
+ kubectl get ingress agent-ingress-{deployment-id} -n agent-deployments
414
+
415
+ # Test internal service
416
+ kubectl port-forward -n agent-deployments service/agent-service-{deployment-id} 8080:80
417
+ curl http://localhost:8080/health
418
+ ```
419
+
420
+ ---
421
+
422
+ ## 🎓 Examples
423
+
424
+ ### Example 1: Deploy Instagram DM Agent
425
+
426
+ ```typescript
427
+ // In Claude Code:
428
+ "List my agents and deploy the Instagram DM Sales Agent"
429
+
430
+ // Claude will:
431
+ 1. List available agents
432
+ 2. Find Instagram DM agent (ID: 65abc123def456789)
433
+ 3. Deploy with default configuration
434
+ 4. Return deployment details
435
+ ```
436
+
437
+ ### Example 2: Deploy with High Availability
438
+
439
+ ```typescript
440
+ // In Claude Code:
441
+ "Deploy agent 65abc123def456789 with 3 replicas for high availability"
442
+
443
+ // Deployment config:
444
+ {
445
+ "replicas": 3,
446
+ "cpu_request": "500m",
447
+ "cpu_limit": "1000m",
448
+ "memory_request": "512Mi",
449
+ "memory_limit": "1Gi"
450
+ }
451
+ ```
452
+
453
+ ### Example 3: Deploy Custom Agent with Specific Image
454
+
455
+ ```typescript
456
+ // In Claude Code:
457
+ "Deploy custom agent 65abc987xyz with image acragentbuilder.azurecr.io/my-custom-agent:v2.1.0"
458
+
459
+ // Deployment config:
460
+ {
461
+ "image": "acragentbuilder.azurecr.io/my-custom-agent:v2.1.0",
462
+ "replicas": 2
463
+ }
464
+ ```
465
+
466
+ ---
467
+
468
+ ## 📚 Related Documentation
469
+
470
+ - **MCP Production Setup**: [MCP_PRODUCTION_SETUP_COMPLETE.md](../MCP_PRODUCTION_SETUP_COMPLETE.md)
471
+ - **Agent Deployment Gap Analysis**: [AGENT_DEPLOYMENT_GAP_ANALYSIS.md](../AGENT_DEPLOYMENT_GAP_ANALYSIS.md)
472
+ - **Build & Push Script**: [scripts/build-and-push-agents.sh](../scripts/build-and-push-agents.sh)
473
+ - **Kubernetes Manifests**: [infrastructure/agent-memory/](../infrastructure/agent-memory/)
474
+
475
+ ---
476
+
477
+ ## 🔄 Next Steps
478
+
479
+ After deploying an agent:
480
+
481
+ 1. ✅ **Monitor Status**: Watch deployment progress in dashboard
482
+ 2. ✅ **Test Endpoint**: Send test requests to agent endpoint
483
+ 3. ✅ **Configure Domain** (Optional): Set up custom domain
484
+ 4. ✅ **Enable Monitoring**: Set up alerts for deployment health
485
+ 5. ✅ **Scale as Needed**: Adjust replicas based on traffic
486
+ 6. ✅ **Generate API Keys**: Create customer API keys if needed
487
+ 7. ✅ **Update Documentation**: Add agent-specific usage docs
488
+
489
+ ---
490
+
491
+ ## 🎉 Success Criteria
492
+
493
+ Your agent deployment is successful when:
494
+
495
+ - ✅ Deployment status shows "RUNNING"
496
+ - ✅ All pods are healthy (ready_replicas matches desired replicas)
497
+ - ✅ Endpoint URL is accessible
498
+ - ✅ Health check returns 200 OK
499
+ - ✅ Deployment visible in dashboard
500
+ - ✅ Test execution succeeds
501
+ - ✅ Logs show no errors
502
+
503
+ ---
504
+
505
+ **Deployment Guide Version**: 1.0.0
506
+ **Last Updated**: 2026-01-27
507
+ **Maintainer**: AgentBuilder Platform Team
508
+
509
+ **🎊 Happy Deploying!**