Skip to main content

Deployment & Management

Deploy, sync, and manage your Erdo agents across different environments with powerful CLI tools.

erdo sync

Synchronize your local agent code with the Erdo platform.

Basic Sync

# Sync all changes
erdo sync

# Sync specific agent
erdo sync --agent my-agent

# Sync to specific environment
erdo sync --env production

# Dry run (preview changes)
erdo sync --dry-run

Sync Options

OptionDescriptionExample
--agentSync specific agenterdo sync --agent data-processor
--envTarget environmenterdo sync --env staging
--forceForce overwrite conflictserdo sync --force
--dry-runPreview changes onlyerdo sync --dry-run
--excludeExclude file patternserdo sync --exclude "*.log,temp/*"
--compressCompress before uploaderdo sync --compress
--timeoutUpload timeouterdo sync --timeout 300

Conflict Resolution

# Auto-merge compatible changes
erdo sync --auto-merge

# Keep local version
erdo sync --prefer-local

# Keep remote version
erdo sync --prefer-remote

erdo deploy

Deploy agents to production environments with advanced configuration options.

Basic Deployment

# Deploy agent to default environment
erdo deploy my-agent

# Deploy to specific environment
erdo deploy my-agent --env production

# Deploy with custom configuration
erdo deploy my-agent --config production.yaml

Deployment Strategies

# Deploy to blue environment
erdo deploy my-agent --strategy blue-green --slot blue

# Test blue environment
erdo test --env blue --agent my-agent

# Switch traffic to blue
erdo deploy my-agent --switch-to blue

# Rollback if needed
erdo deploy my-agent --rollback
# Deploy canary version (5% traffic)
erdo deploy my-agent --strategy canary --traffic 5

# Monitor canary performance
erdo monitor my-agent --env canary

# Increase canary traffic
erdo deploy my-agent --strategy canary --traffic 50

# Promote to full deployment
erdo deploy my-agent --promote-canary
# Rolling deployment with 3 instances
erdo deploy my-agent --strategy rolling --instances 3

# Rolling with health checks
erdo deploy my-agent --strategy rolling --health-check

# Rolling with custom batch size
erdo deploy my-agent --strategy rolling --batch-size 2

Environment Configuration

# Set environment variables
erdo deploy my-agent --set API_KEY=prod123 --set DEBUG=false

# Load from file
erdo deploy my-agent --env-file .env.production

# Use secrets manager
erdo deploy my-agent --secrets-from vault://production/my-agent

# Resource limits
erdo deploy my-agent --memory 2GB --cpu 1000m --timeout 300

Deployment Validation

# Validate before deployment
erdo deploy my-agent --validate-only

# Security scan
erdo deploy my-agent --security-scan

# Dependency check
erdo deploy my-agent --check-deps

# Performance test
erdo deploy my-agent --perf-test

erdo list-bots

List and manage agents across all environments.

Basic Listing

# List all agents
erdo list-bots

# List for specific environment
erdo list-bots --env production

# Show detailed information
erdo list-bots --verbose

# Filter by status
erdo list-bots --status active

Filtering and Sorting

# Filter by tags
erdo list-bots --tags "data-analysis,automation"

# Filter by owner
erdo list-bots --owner "team-data"

# Sort by various fields
erdo list-bots --sort name
erdo list-bots --sort created_at --order desc
erdo list-bots --sort usage --order desc

# Search by name pattern
erdo list-bots --search "*processor*"

Output Formats

# Default table view
erdo list-bots

# Custom columns
erdo list-bots --columns name,status,version,last_run

# Wide format
erdo list-bots --wide

erdo export-bot

Export agents for backup, sharing, or migration.

Basic Export

# Export single agent
erdo export-bot my-agent --output ./my-agent.py

# Export with dependencies
erdo export-bot my-agent --include-deps --output ./my-agent-complete.zip

# Export multiple agents
erdo export-bot agent1,agent2,agent3 --output ./agents/

Export Modes

# Creates a single Python file ready for syncing
erdo export-bot "file analyzer" > standalone-agent.py

# Or save to file
erdo export-bot "file analyzer" --output standalone-agent.py
Features:
  • Single file contains complete agent definition
  • All embedded Python code has imports fixed for standalone execution
  • Classes from common.py are moved to the top of the file
  • Relative imports are commented out with explanatory notes
  • Ready to sync back with erdo sync standalone-agent.py
Use Cases:
  • Backup and restore
  • Sharing agents between environments
  • Version control of complete agent definitions
  • Quick agent duplication

Export Workflow Examples

# 1. Export agent for local development
erdo export-bot "data-processor" -o local-dev.py

# 2. Work with individual files
cd data_processor_process_data_files/

# 3. Test individual components
python common.py          # Test shared utilities
python process_data.py    # Test main processing logic

# 4. Modify code as needed
vim process_data_fn.py

# 5. Sync back when ready (use main file)
cd ..
erdo sync local-dev.py --name-suffix="_updated"
# 1. Export all agents for backup
mkdir backup-$(date +%Y%m%d)
for agent in $(erdo list-bots --format plain | cut -f1); do
  erdo export-bot "$agent" > "backup-$(date +%Y%m%d)/${agent// /-}.py"
done

# 2. Migrate to new environment
erdo configure --server https://new-environment.erdo.ai
erdo login

# 3. Import agents
for file in backup-*/*.py; do
  erdo sync "$file" --name-suffix="_migrated"
done
# 1. Export agent with package structure for review
erdo export-bot "security-scanner" -o review-agent.py

# 2. Review individual files
cd security_scanner_scan_code_files/
ls -la                    # See all code files
cat scan_code.py         # Review main logic
cat security_utils.py   # Review utility functions

# 3. Check for issues
python -m py_compile *.py  # Syntax check
pylint *.py               # Code quality check

# 4. Test locally if needed
python scan_code.py       # Run main script

Export Options

OptionDescriptionExample
--include-depsInclude dependencies--include-deps
--include-dataInclude sample data--include-data
--include-testsInclude test files--include-tests
--minifyMinimize output size--minify
--encryptEncrypt sensitive data--encrypt --key mykey
--versionSpecific version--version 1.2.0

Advanced Export

# Export for specific environment
erdo export-bot my-agent --env production --output ./prod-agent.py

# Export with custom metadata
erdo export-bot my-agent --metadata '{"team": "data", "project": "analytics"}'

# Export with transformation
erdo export-bot my-agent --transform remove-secrets --output ./clean-agent.py

# Batch export
erdo export-bot --all --env production --output ./backup/

erdo logs

View and analyze agent execution logs and metrics.

Basic Logging

# View recent logs for agent
erdo logs my-agent

# Follow logs in real-time
erdo logs my-agent --follow

# Show logs from last hour
erdo logs my-agent --since 1h

# Show specific number of lines
erdo logs my-agent --lines 100

Log Filtering

# Error logs only
erdo logs my-agent --level error

# Debug and above
erdo logs my-agent --level debug

# Multiple levels
erdo logs my-agent --level error,warn

Log Analysis

# Aggregate error patterns
erdo logs my-agent --analyze-errors

# Performance metrics
erdo logs my-agent --metrics --since 7d

# Export logs for analysis
erdo logs my-agent --format json --output ./logs.json

# Generate log report
erdo logs my-agent --report --since 30d --output ./report.html

erdo monitor

Monitor agent performance and health in real-time.

Real-time Monitoring

# Monitor specific agent
erdo monitor my-agent

# Monitor all agents
erdo monitor --all

# Dashboard mode
erdo monitor --dashboard

# Monitor with alerts
erdo monitor my-agent --alerts

Metrics and KPIs

# Execution time metrics
erdo monitor my-agent --metrics execution_time

# Memory usage
erdo monitor my-agent --metrics memory

# Success rate
erdo monitor my-agent --metrics success_rate

# Throughput
erdo monitor my-agent --metrics throughput
# Custom business metrics
erdo monitor my-agent --metrics custom:processed_documents

# Cost tracking
erdo monitor my-agent --metrics cost

# Usage patterns
erdo monitor my-agent --metrics usage_patterns
# System resource usage
erdo monitor my-agent --metrics system

# Dependency health
erdo monitor my-agent --metrics dependencies

# Error rates
erdo monitor my-agent --metrics error_rate

Alerting

# Set up alerts
erdo monitor my-agent --alert-on error_rate:>5%
erdo monitor my-agent --alert-on execution_time:>30s
erdo monitor my-agent --alert-on memory:>1GB

# Alert channels
erdo monitor my-agent --alerts --email [email protected]
erdo monitor my-agent --alerts --slack #alerts-channel
erdo monitor my-agent --alerts --webhook https://hooks.slack.com/...

Production Management

Health Checks

# Check agent health
erdo health my-agent

# System-wide health check
erdo health --all

# Deep health check
erdo health my-agent --deep

# Generate health report
erdo health --report --output ./health-report.html

Maintenance Operations

# Scale agent instances
erdo scale my-agent --replicas 5

# Auto-scaling
erdo scale my-agent --auto --min 2 --max 10

# Scale based on metrics
erdo scale my-agent --metric cpu:70% --metric memory:80%

Troubleshooting

Deployment Issues

  • Check deployment logs: erdo logs my-agent --level error - Validate configuration: erdo deploy my-agent --validate-only - Test connectivity: erdo health my-agent --deep - Review resource limits: erdo monitor my-agent --metrics system

Performance Problems

  • Monitor execution times: erdo monitor my-agent --metrics execution_time
  • Check memory usage: erdo logs my-agent --metrics memory - Analyze bottlenecks: erdo introspect my-agent --bottlenecks - Scale if needed: erdo scale my-agent --replicas 3

Sync Conflicts

  • Preview changes: erdo sync --dry-run - Backup first: erdo sync --backup - Resolve interactively: erdo sync --interactive - Force if necessary: erdo sync --force

Monitoring Alerts

  • Check recent logs: erdo logs my-agent --since 1h --level error - View metrics: erdo monitor my-agent --dashboard - Analyze trends: erdo logs my-agent --report --since 7d - Update thresholds: erdo monitor my-agent --alert-on error_rate:>10%

Best Practices

Deployment Pipeline

# 1. Local testing
erdo test --agent my-agent --type integration

# 2. Sync to staging
erdo sync --env staging
erdo deploy my-agent --env staging

# 3. Staging validation
erdo test --env staging --agent my-agent --type e2e

# 4. Production deployment
erdo deploy my-agent --env production --strategy canary

# 5. Monitor and verify
erdo monitor my-agent --env production --alerts

Monitoring Strategy

  • Set up comprehensive alerts for key metrics
  • Monitor both technical and business KPIs
  • Use dashboards for real-time visibility
  • Regular health checks and maintenance windows
  • Log retention and analysis for troubleshooting