Environments
Managing deployment environments in SwiftClaw
Environments
Environments separate development, staging, and production deployments.
Environment Types
Development
For local development and testing:
swiftclaw deploy my-agent --env developmentCharacteristics:
- Debug logging enabled
- Lower rate limits
- Test API keys
- Faster deployment
Staging
For pre-production testing:
swiftclaw deploy my-agent --env stagingCharacteristics:
- Production-like configuration
- Isolated from production data
- Full testing capabilities
- Separate API keys
Production
For live deployments:
swiftclaw deploy my-agent --env productionCharacteristics:
- Optimized performance
- High availability
- Production API keys
- Monitoring and alerts
Environment Configuration
Environment Variables
# Development
export SWIFTCLAW_ENV=development
export SWIFTCLAW_API_KEY=sk_test_abc123...
# Production
export SWIFTCLAW_ENV=production
export SWIFTCLAW_API_KEY=sk_live_xyz789...Configuration Files
// config/development.json
{
"model": "gpt-3.5-turbo",
"debug": true,
"log_level": "debug"
}
// config/production.json
{
"model": "gpt-4",
"debug": false,
"log_level": "info"
}Environment Isolation
Each environment has:
- Separate Instances: Independent agent deployments
- Isolated Data: No cross-environment data access
- Different API Keys: Environment-specific authentication
- Independent Scaling: Per-environment resource allocation
Promoting Between Environments
Manual Promotion
# Deploy to staging
swiftclaw deploy my-agent --env staging
# Test in staging
swiftclaw test my-agent --env staging
# Promote to production
swiftclaw deploy my-agent --env production --version staging-v1.2.0Automated Promotion
# .github/workflows/deploy.yml
name: Deploy
on:
push:
branches: [main]
jobs:
deploy-staging:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy to Staging
run: swiftclaw deploy my-agent --env staging
deploy-production:
needs: deploy-staging
runs-on: ubuntu-latest
steps:
- name: Deploy to Production
run: swiftclaw deploy my-agent --env productionEnvironment-Specific Settings
Model Configuration
# Development: Use faster, cheaper model
swiftclaw config set model gpt-3.5-turbo --env development
# Production: Use powerful model
swiftclaw config set model gpt-4 --env productionScaling Configuration
# Development: Minimal resources
swiftclaw config set min-instances 1 --env development
# Production: High availability
swiftclaw config set min-instances 3 --env productionMemory Configuration
# Development: Short TTL
swiftclaw config set memory-ttl 1h --env development
# Production: Long TTL
swiftclaw config set memory-ttl 30d --env productionEnvironment Variables
Required Variables
SWIFTCLAW_ENV=production
SWIFTCLAW_API_KEY=sk_live_abc123...
SWIFTCLAW_WORKSPACE=my-workspaceOptional Variables
SWIFTCLAW_BASE_URL=https://api.swiftclaw.io
SWIFTCLAW_TIMEOUT=30
SWIFTCLAW_MAX_RETRIES=3Best Practices
1. Use Separate API Keys
# Development
SWIFTCLAW_API_KEY=sk_test_dev123...
# Production
SWIFTCLAW_API_KEY=sk_live_prod456...2. Test in Staging First
# Always test in staging
swiftclaw deploy my-agent --env staging
swiftclaw test my-agent --env staging
# Then deploy to production
swiftclaw deploy my-agent --env production3. Monitor Each Environment
# Set up environment-specific alerts
swiftclaw alerts create \
--agent my-agent \
--env production \
--metric error-rate \
--threshold 14. Use Environment-Specific Configurations
# Load environment-specific config
swiftclaw deploy my-agent \
--env production \
--config config/production.jsonNever use production keys in development: Always use test keys for development and staging.
Environment Status
Check environment status:
# View all environments
swiftclaw envs list my-agent
# View specific environment
swiftclaw envs status my-agent --env productionNext Steps
How is this guide ?
Last updated on