@datnpq/layla-cli
v1.0.2
Published
Automated Multi-Agent Team Deployment CLI - Setup OpenClaw, 9Router, and manage intelligent worker teams
Maintainers
Readme
🤖 Layla CLI
Automated Multi-Agent Team Deployment CLI - Setup OpenClaw, 9Router, and manage intelligent worker teams
✨ Features
- 🚀 One-command deployment of multi-agent teams
- 🧠 Intelligent routing with 9Router (3-tier AI model routing)
- 👥 Role-based workers (Strategist, Engineer, Operator, etc.)
- 💰 Cost optimization with auto-scaling
- 💾 Backup/Restore entire teams to Google Drive
- 🔒 Secure - API keys never stored in backups
- 📊 Monitoring - Track usage and costs
📦 Installation
# Install globally
npm install -g layla-cli
# Or use npx
npx layla-cli --help🚀 Quick Start
1. Initialize configuration
layla config --init2. Deploy your team
# Deploy 10 workers with mixed tiers
layla deploy --name my-team --count 10 --region ap-southeast-2
# Deploy with API keys
layla deploy \
--name production-team \
--count 5 \
--claude-key sk-ant-... \
--openai-key sk-...3. Check status
layla status4. Backup your team
layla backup --upload📚 Commands
layla deploy [options]
Deploy a new multi-agent team
Options:
-n, --name <name>- Team name (default: layla-team)-c, --count <count>- Number of workers (default: 10)-r, --region <region>- AWS region (default: ap-southeast-2)-t, --tier <tier>- Instance tier: micro/small/medium (default: small)-k, --key <key>- SSH key name (default: macair)--claude-key <key>- Claude API key--openai-key <key>- OpenAI API key--dry-run- Show deployment plan without deploying
Example:
layla deploy -n my-team -c 10 -r us-east-1 -t mediumlayla setup <instances...>
Setup OpenClaw and 9Router on existing instances
Example:
layla setup 3.25.111.149 3.106.206.127 --user ubuntu -i ~/.ssh/mykey.pemlayla team <subcommand>
Manage your worker team
Subcommands:
list- List all workersadd <count>- Add workersremove <ids...>- Remove workersssh <worker-id>- SSH into worker
Example:
layla team list
layla team add 3 --role engineer --tier 2
layla team ssh worker-02layla backup [options]
Backup entire team to Google Drive
Options:
-o, --output <path>- Backup directory (default: ~/layla-backups)-u, --upload- Upload to Google Drive (default: true)-c, --compress- Compress backup (default: true)
Example:
layla backup --uploadlayla restore <backup-file>
Restore team from backup
Options:
-n, --new-instances- Create new AWS instances--from-gdrive <fileId>- Restore from Google Drive
Example:
layla restore ~/backups/layla-backup-20260211.tar.gz
layla restore --from-gdrive 1ABC123XYZlayla scale [options]
Auto-scale team based on usage or cost
Options:
-m, --mode <mode>- Scale mode: up/down/auto (default: auto)-t, --target <target>- Target monthly cost in USD--economy- Scale to economy mode (all micro)--performance- Scale to performance mode (all medium)
Example:
layla scale --target 100
layla scale --economylayla status [options]
Check status of all workers
Options:
-w, --watch- Watch mode (continuous)--cost- Show cost breakdown
Example:
layla status
layla status --watchlayla config [options]
Manage configuration
Options:
--init- Initialize configuration interactively-s, --set <key=value>- Set config value-g, --get <key>- Get config value
Example:
layla config --init
layla config --set aws.region=ap-southeast-2🏗️ Architecture
Layla CLI (Governor)
│
├──► 9Router (Intelligent Routing)
│ ├── Tier 1: Claude/OpenAI/Google ($$$)
│ ├── Tier 2: GLM/MiniMax/Kimi ($)
│ └── Tier 3: iFlow/Qwen/Kiro (FREE)
│
└──► Worker Team (10 workers)
├── Tier 1: Strategist, Architect, Red Team
├── Tier 2: Engineer, Researcher, DevOps, Prompt, Critic
└── Tier 3: Operator, Synthesizer💰 Cost Optimization
| Mode | Workers | Cost/Month | Use Case | |------|---------|------------|----------| | Economy | All micro | ~$80 | Development, testing | | Balanced | Mixed | ~$160 | Production | | Performance | All medium | ~$330 | High-load tasks |
🔐 Security
- API keys stored in
~/.layla/config.json(chmod 600) - Keys never included in backups
- SSH keys used for worker authentication
- Support for AWS IAM roles
📁 Backup Structure
layla-backup-20260211/
├── layla-workspace-20260211.tar.gz # Local workspace
├── worker-01-20260211.tar.gz # Worker configs
├── worker-02-20260211.tar.gz
├── ...
└── worker-10-20260211.tar.gz🔄 Restore Process
- From backup file:
layla restore backup-file.tar.gz- From Google Drive:
layla restore --from-gdrive <file-id>- With new instances:
layla restore backup.tar.gz --new-instances🛠️ Installation Troubleshooting
Issue: Native module compilation fails
If you encounter errors during installation related to ssh2 or native modules:
Option 1: Install without native SSH (Recommended)
npm install -g @datnpq/layla-cliThe CLI will work with manual SSH commands as fallback.
Option 2: Install with native modules
npm install -g @datnpq/layla-cli --unsafe-permOption 3: Use npx (no installation)
npx @datnpq/layla-cli --helpIssue: Permission denied
sudo npm install -g @datnpq/layla-cli
# or
npm install -g @datnpq/layla-cli --prefix ~/.local🔄 Version History
- v1.0.1 - Fixed native module dependencies, made SSH optional
- v1.0.0 - Initial release with multi-agent deployment
🛠️ Development
# Clone repository
git clone https://github.com/datnpq/layla-cli.git
cd layla-cli
# Install dependencies
npm install
# Run in development
npm link
layla --help
# Run tests
npm test
# Build binary
npm run build🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
📝 License
MIT © datnpq
🙏 Acknowledgments
- Inspired by OpenClaw multi-agent architecture
- 9Router for intelligent model routing
- AWS for cloud infrastructure
