Deployment Guide
This guide covers deploying AI agents to the Internet Computer using AgentVault.
Overview
AgentVault supports two deployment modes:
- Local Deployment - Deploy to local ICP replica (development/testing)
- Production Deployment - Deploy to main ICP network
Configuration Files
agent.yaml
Main agent configuration file located at project root:
name: My Agent
description: Description of your agent
entry: src/index.ts
memory: 256
compute: medium
cycles: 1000000000000
routing:
- canister-a-id
- canister-b-id
icp.yaml
ICP network configuration for deployment settings:
environments:
local:
network:
type: local
replicaCount: 4
cycles:
initial: 100T
production:
network:
type: ic
replicaCount: 20
cycles:
initial: 500T
refillThreshold: 100T
optimization:
level: 3
shrink: true
removeDebug: true
Local Deployment
Deploy to local ICP for development and testing:
# Deploy to local network
agentvault deploy --network local
Local Deployment Process
- Validation - Checks project structure and dependencies
- Compilation - Compiles TypeScript to WASM
- Optimization - Applies WASM optimizations (size, debug removal)
- Canister Creation - Creates canister on local network
- Code Installation - Installs WASM on canister
- Verification - Verifies deployment success
Local Development Workflow
# 1. Start local replica
dfx start --background
# 2. Deploy agent
agentvault deploy --network local
# 3. Test with canister ID
agentvault exec <canister-id> "test input"
# 4. View logs
agentvault logs <canister-id>
Production Deployment
Deploy to main ICP network for public access:
# Deploy to production
agentvault deploy --network ic
Production Deployment Process
- Pre-deployment Check - Verifies cycles balance, network connectivity
- Compilation - Full production build with optimizations
- Canister Creation - Creates new canister on mainnet
- Code Installation - Installs WASM with initial cycles allocation
- Controller Setup - Configures your identity as controller
- Post-deployment - Verifies canister health and connectivity
Cycles Management
# Add cycles to canister
agentvault cycles top-up <canister-id> --amount 1000000000000
# Check canister cycles
agentvault cycles balance <canister-id>
# View cycles history
agentvault cycles history <canister-id>
Upgrades
Upgrade an existing deployed canister:
# Upgrade canister with new code
agentvault deploy --canister-id <existing-id> --upgrade
Upgrade Strategies
Zero-downtime Upgrade:
- Deploy new code with same canister ID
- ICP handles code upgrade atomically
- Minimal downtime (typically
<30 seconds)
Blue-Green Deployment:
- Deploy new canister
- Switch DNS after verification
- Remove old canister after stabilization
Environment Variables
Configure deployment behavior with environment variables:
# ICP network
export ICP_NETWORK=ic
# Custom host
export ICP_HOST=https://custom.icp.host
# Wallet identity
export ICP_IDENTITY=my-wallet
Environment File (.env)
ICP_NETWORK=ic
ICP_HOST=https://ic0.app
AGENT_VAULT_DEBUG=false
Troubleshooting Deployments
Compilation Errors
TypeScript compilation failed:
# Check TypeScript version
npx tsc --version
# Check for type errors
npx tsc --noEmit
WASM build failed:
# Verify Rust toolchain
rustc --version
wasm-pack --version
# Clean build cache
rm -rf .agentvault/wasm-cache
Canister Errors
Insufficient cycles:
# Check balance
agentvault cycles balance
# Add more cycles
agentvault cycles top-up <canister-id> --amount 5000000000000
Controller permission denied:
# Verify identity
dfx identity whoami
# Set controller
agentvault canister set-controller <canister-id> --principal <your-principal>
Network Issues
Connection timeout:
# Check network status
agentvault network status
# Test connectivity
curl -I https://ic0.app
# Use custom network endpoint
agentvault deploy --network ic --host https://alternate.icp.host
Deployment stuck:
# Cancel stuck deployment
agentvault cancel <deployment-id>
# Check deployment logs
agentvault logs <deployment-id>
Verification
After deployment, verify your canister:
# Check canister status
agentvault status <canister-id>
# Run health check
agentvault health <canister-id>
# View recent logs
agentvault logs <canister-id> --last 100
Rollback
Rollback to previous deployment if issues occur:
# List available rollbacks
agentvault rollback list <canister-id>
# Perform rollback
agentvault rollback <canister-id> --version 2
Rollback Process
- Select previous deployment version
- Download backup if available
- Reinstall backup code
- Verify canister health
- Update routing if needed
Best Practices
Before Deployment
- Test agent locally with
agentvault test - Ensure sufficient cycles (minimum 1T recommended)
- Review and optimize agent code size
- Backup existing canister if upgrading
- Verify network connectivity
During Deployment
- Use verbose mode for debugging:
--verbose - Monitor deployment progress:
agentvault logs <deployment-id> - Verify canister health post-deployment
- Record deployment ID for rollback reference
After Deployment
- Set up monitoring with
agentvault monitor - Configure alerts for canister health
- Create initial backup
- Document canister ID and access methods
Advanced Topics
Batched Deployments
Deploy multiple canisters in dependency order:
agentvault deploy --batch canisters.json
Multi-network Deployment
Deploy to multiple networks simultaneously:
agentvault deploy --networks local,ic
Custom Deployment Scripts
Create deployment scripts for complex workflows:
# deploy-all.sh
#!/bin/bash
agentvault deploy --network local --config staging.yaml
agentvault deploy --network ic --config production.yaml
Next Steps
- Read Wallet Guide for cycles management
- Read Backup Guide for backup strategies
- Explore Web Dashboard for UI-based management
- Review Security Best Practices