The ICP Agent Kit provides four specialized agents, each optimized for specific use cases. These agents have access to all tools but provide focused expertise and context-aware responses.

Available Agents

Creating Agents

// Initialize the main agent first
const agent = new ICPAgent({
  network: 'mainnet',
  openai: { apiKey: process.env.OPENAI_API_KEY }
});
await agent.initialize();

// Create specialized agents
const generalAgent = agent.createAgent('general');
const developerAgent = agent.createAgent('developer');
const defiAgent = agent.createAgent('defi');
const governanceAgent = agent.createAgent('governance');

General Agent

The General Agent is your all-purpose assistant for any ICP blockchain operation.

Capabilities

  • Access to all 10 tools
  • No specialization bias
  • Good for mixed operations
  • Helpful for exploration

Best Use Cases

  • Learning about ICP
  • Mixed workflows
  • General queries
  • Exploring features

Example Usage

const generalAgent = agent.createAgent('general');

// Ask about capabilities
const capabilities = generalAgent.getCapabilities();
console.log(capabilities);

// Mixed operations
await generalAgent.chat("Check my balance and list my canisters");
await generalAgent.chat("Create an identity and deploy a canister");
await generalAgent.chat("Help me understand cycles management");

Sample Conversations

// Information gathering
User: "What can you help me with?"
Agent: "I can help with token operations, canister management, 
        cycles monitoring, and identity management..."

// Multi-domain task
User: "I need to set up a new project"
Agent: "I'll help you set up a new project. Let's start by:
        1. Creating a dedicated identity
        2. Setting up a canister with cycles
        3. Preparing for token operations..."

Developer Agent

The Developer Agent specializes in canister development and deployment workflows.

Enhanced Context

  • Focuses on development best practices
  • Provides deployment guidance
  • Suggests appropriate cycles amounts
  • Helps with debugging

Best Use Cases

  • Canister deployment
  • WASM module management
  • Controller configuration
  • Development workflows

Example Usage

const devAgent = agent.createAgent('developer');

// Development queries
await devAgent.chat("What's the best practice for canister upgrades?");
await devAgent.chat("Help me deploy my WASM module");
await devAgent.chat("I'm getting an error during deployment");

// Get suggestions
const suggestions = devAgent.getSuggestions();
// Returns developer-focused suggestions

Sample Conversations

// Deployment workflow
User: "I need to deploy my dapp"
Agent: "I'll help you deploy your dapp. For development, I recommend:
        - Using 5T cycles for initial deployment
        - Setting up proper controller permissions
        - Testing with small cycles amounts first
        Let's start by creating a canister..."

// Debugging help
User: "My canister deployment failed"
Agent: "Let me help debug the deployment. Common issues include:
        - Insufficient cycles (need at least 1T)
        - WASM module size (max 2MB without chunking)
        - Controller permissions
        Let's check your canister status first..."

Developer-Specific Features

DeFi Agent

The DeFi Agent specializes in token operations and financial transactions.

Enhanced Context

  • Token transfer optimization
  • Fee calculation assistance
  • Balance management
  • Risk warnings

Best Use Cases

  • Token transfers
  • Portfolio management
  • Fee optimization
  • Multi-token operations

Example Usage

const defiAgent = agent.createAgent('defi');

// Token operations
await defiAgent.chat("I want to transfer tokens efficiently");
await defiAgent.chat("Help me manage my token portfolio");
await defiAgent.chat("What are the current transfer fees?");

// Get DeFi suggestions
const suggestions = defiAgent.getSuggestions();
// Returns finance-focused suggestions

Sample Conversations

// Transfer guidance
User: "I need to send ICP to multiple recipients"
Agent: "I'll help you with batch transfers. For multiple recipients:
        - Each transfer has a 0.0001 ICP fee
        - I'll validate all addresses first
        - You can include custom memos
        Who are the recipients and amounts?"

// Portfolio check
User: "Show me all my token balances"
Agent: "I'll check your complete token portfolio:
        - ICP balance: 25.5 ICP
        - ICRC-1 tokens: Checking registered tokens...
        - Total portfolio value: ..."

DeFi-Specific Features

Governance Agent

The Governance Agent is specialized for governance operations, including DAO management and proposal analysis.
Fully Implemented: Governance agent is operational with AI-powered proposal analysis and vote casting capabilities, as demonstrated in the DAO voting sample application.

Current Capabilities

  • AI-powered proposal analysis and recommendations
  • Automated vote casting with reasoning
  • DAO governance operations and management
  • Governance metrics and analytics
  • Cross-chain governance protocols
  • Cryptographic verification of votes

Extended Capabilities

  • Direct NNS (Network Nervous System) integration
  • Advanced neuron management
  • Staking and reward optimization

Example Usage

const govAgent = agent.createAgent('governance');

// AI-powered proposal analysis
const analysis = await govAgent.chat(
  "Analyze governance proposal PROP-2024-007 for community fund allocation"
);
// Returns: Detailed analysis with recommendation and confidence score

// Vote casting with AI reasoning
const vote = await govAgent.chat(
  "Cast YES vote on proposal PROP-2024-007 based on analysis"
);
// Returns: Vote confirmation with cryptographic proof

// Governance metrics
const metrics = await govAgent.chat(
  "Show current DAO voting statistics and participation rates"  
);
// Returns: Real-time governance analytics and insights

// DAO management operations
const management = await govAgent.chat(
  "Create new proposal for protocol upgrade with proper documentation"
);
// Returns: Structured proposal creation with validation
See it in Action: Try the DAO Voting System sample application to see the Governance Agent working with real proposal analysis and vote casting.

Future Features

Neuron Management

Create, dissolve, and manage neurons

Voting

Participate in governance proposals

Staking

Stake ICP for rewards

Analytics

Governance metrics and history

Agent Comparison

FeatureGeneralDeveloperDeFiGovernance
FocusAll operationsCanister mgmtTokensNNS (future)
Best ForMixed tasksDevelopmentTradingVoting
ContextNeutralDev-focusedFinanceGovernance
SuggestionsBroadTechnicalFinancialPolitical

Switching Between Agents

You can create and use multiple agents in the same session:
// Start with general exploration
const general = agent.createAgent('general');
await general.chat("What do I need to know about ICP?");

// Switch to development
const dev = agent.createAgent('developer');
await dev.chat("Now help me deploy a canister");

// Move to finance
const defi = agent.createAgent('defi');
await defi.chat("After deployment, help me manage tokens");

Context Management

Each agent maintains its own conversation context:
const devAgent = agent.createAgent('developer');

// First conversation
await devAgent.chat("I'm building a social dapp");
await devAgent.chat("What canister architecture do you recommend?");
// Agent remembers you're building a social dapp

// Clear context for new conversation
devAgent.clearContext();
await devAgent.chat("I need help with a DeFi project");
// Fresh context, no memory of social dapp

Best Practices

1

Choose the Right Agent

Select the agent that matches your primary task for better responses.
2

Use Agent Suggestions

Call getSuggestions() to see agent-specific command examples.
3

Maintain Context

Keep related operations in the same conversation for better flow.
4

Switch When Needed

Don’t hesitate to switch agents when changing domains.

Advanced Usage

Custom Agent Behavior

While you can’t modify the built-in agents, you can:
// Wrap agent with custom logic
class CustomDeFiAgent {
  constructor(private agent: ISpecializedAgent) {}
  
  async safeTransfer(amount: string, to: string) {
    // Add custom validation
    if (parseFloat(amount) > 100) {
      const confirm = await this.confirmLargeTransfer(amount);
      if (!confirm) return;
    }
    
    return this.agent.chat(`Transfer ${amount} ICP to ${to}`);
  }
}

const defi = new CustomDeFiAgent(agent.createAgent('defi'));

Agent Chaining

Chain different agents for complex workflows:
// Development → DeFi workflow
const dev = agent.createAgent('developer');
const defi = agent.createAgent('defi');

// Step 1: Deploy with developer agent
const deployment = await dev.chat("Deploy my token canister");

// Step 2: Manage tokens with DeFi agent  
const tokenMgmt = await defi.chat("Set up initial token distribution");

Troubleshooting

What’s Next?