Implementation:23blocks OS Ai maestro Create Cloud Agent
| Knowledge Sources | |
|---|---|
| Domains | Agent_Orchestration, Cloud_Deployment |
| Last Updated | 2026-10-26 10:00 GMT |
Overview
Concrete tool for creating agents on AWS cloud infrastructure (EC2 instances or ECS clusters), provided by AI Maestro's `services/agents-cloud-service.ts`.
Description
The createCloudAgent service function provisions a cloud agent. It shells out to the `aws` CLI (via `execAsync`) to create either an EC2 instance running the AI Maestro agent container, or an ECS task, selected by the `body.provider` field. The created instance registers itself back to the mesh. Note: there are no separate `createEC2Agent`/`createECSAgent` functions — one function handles both providers.
Usage
Import this service function when an agent needs to run on dedicated cloud hardware — e.g. for heavy workloads, GPUs, or running outside the operator's machines.
Code Reference
Source Location
- Repository: ai-maestro
- File: services/agents-cloud-service.ts (L335-550)
Signature
export async function createCloudAgent(
body: CloudCreateRequest
): Promise<ServiceResult<Record<string, unknown>>>
interface CloudCreateRequest {
name: string // agent name
provider: 'ec2' | 'ecs' // cloud provider selection
awsProfile?: string // AWS CLI profile to use
awsRegion?: string // AWS region
instanceType?: string // EC2 instance type (e.g. 't3.medium')
image?: string
workingDirectory?: string
permissionMode?: string
}
Import
import { createCloudAgent } from '@/services/agents-cloud-service'
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| body.name | string | Yes | Agent name |
| body.provider | 'ecs' | Yes | Cloud provider |
| body.awsProfile | string | No | AWS CLI profile |
| body.awsRegion | string | No | AWS region |
| body.instanceType | string | No | EC2 instance type |
Outputs
| Name | Type | Description |
|---|---|---|
| returns | ServiceResult<Record<string, unknown>> | Cloud instance/cluster creation status; error on validation or aws CLI failure |
Usage Examples
Create an EC2 agent
import { createCloudAgent } from '@/services/agents-cloud-service'
const result = await createCloudAgent({
name: 'heavy-builds',
provider: 'ec2',
awsProfile: 'default',
awsRegion: 'us-east-1',
instanceType: 't3.medium',
})
if (result.error) {
console.error('Cloud agent creation failed:', result.error)
}