Project Overview & Structure
This document provides a comprehensive overview of the ICP Agent Kit project structure, current status, and technical architecture.Project Overview
Production-Ready ICP Development Kit ✅ Core Infrastructure: Complete plugin system with 4 specialized modules✅ AI Integration: LangChain tools and specialized agents for natural language interaction
✅ Sample Applications: Real-world examples demonstrating best practices
✅ Live Infrastructure: Deployed canisters for production-ready functionality
✅ Documentation: Comprehensive API reference and developer guides
✅ Quality Assurance: Extensive testing and type safety throughout
Technical Architecture
Core Components
Plugin System Details
1. Identity Plugin (IdentityPlugin
)
Features:
- BIP39 seed phrase generation (12/24 words)
- Anonymous identity creation for testing
- Identity switching and management
- Principal and Account ID derivation
- Secure in-memory storage
generateSeedPhrase(wordCount?)
- Generate BIP39 mnemoniccreateFromSeedPhrase(phrase, key)
- Create secp256k1 identitycreateAnonymous(key)
- Create anonymous identityswitch(key)
- Switch active identitygetPrincipal()
- Get current principalgetAccountId()
- Get ICP account identifier
2. Token Plugin (TokenPlugin
)
Features:
- ICP transfers with memo support
- ICRC-1/ICRC-2 token operations
- Balance queries and formatting
- Account management with subaccounts
- Transaction utilities and validation
getBalance(account?)
- Get ICP balancetransfer(to, amount, options?)
- Transfer ICPicrc1Transfer(canisterId, to, amount)
- Transfer ICRC-1 tokensicrc1Balance(canisterId, account?)
- Get token balanceicrc1Approve(canisterId, spender, amount)
- Approve spendinggetTokenMetadata(canisterId?)
- Get token info
3. Canister Plugin (CanisterPlugin
)
Features:
- Complete lifecycle management
- WASM deployment with chunked upload
- Query and update method calls
- Actor creation with IDL support
- Controller management
- Metrics tracking
create(options?)
- Create new canisterdeploy(options)
- Deploy WASM codecall(options)
- Execute update callquery(options)
- Execute query callcreateActor(canisterId, idlFactory)
- Create typed actorgetStatus(canisterId)
- Get canister status
4. Cycles Plugin (CyclesPlugin
)
Features:
- Balance monitoring and health checks
- Top-up operations via management canister
- ICP to cycles conversion with XDR rates
- Automated monitoring and alerts
- Forecasting and analytics
- Batch operations
getBalance(canisterId)
- Get cycles balancetopUp(canisterId, amount)
- Add cyclesconvertIcpToCycles(amount, options?)
- Convert ICPgetForecast(canisterId)
- Get depletion forecaststartMonitoring(config)
- Start auto-monitoringgetBatchBalances(canisterIds)
- Bulk balance check
LangChain Integration
10 Specialized Tools
Identity Tools (2):get-current-identity
- Show current identity infocreate-identity
- Create new identity (seed/anonymous)
get-balance
- Check ICP balance
4. transfer-icp
- Transfer ICP tokens
5. icrc1-transfer
- Transfer ICRC-1 tokens
Canister Tools (3):
6. create-canister
- Create new canister
7. deploy-wasm
- Deploy WASM to canister
8. get-canister-status
- Check canister status
Cycles Tools (2):
9. get-cycles-balance
- Check cycles balance
10. top-up-cycles
- Add cycles to canister
4 Specialized Agents
1. Developer Agent (DeveloperAgent
)
- Focus: Canister development and deployment
- Tools: Canister lifecycle, WASM deployment, cycles management
- Use Cases: dApp development, testing, debugging
DefiAgent
)
- Focus: Token operations and financial transactions
- Tools: Token transfers, balance queries, multi-token management
- Use Cases: Trading, portfolio management, payments
GovernanceAgent
)
- Focus: NNS participation and voting operations
- Tools: Proposal voting, neuron management, staking
- Use Cases: DAO participation, governance automation
GeneralAgent
)
- Focus: All-purpose ICP operations
- Tools: All 10 tools available
- Use Cases: Complex workflows, multi-step operations
Sample Applications
1. Decentralized Trading Bot
Location:/sample-applications/decentralized-trading-bot/
Features:
- AI-powered market analysis using OpenAI GPT-4
- On-chain trade data storage via Agent Connector canister
- Natural language processing for trading commands
- Real-time market data integration
- Risk management and position sizing
- TypeScript + Node.js
- ICP Agent Kit for blockchain operations
- OpenAI GPT-4 for analysis
- LangChain for natural language processing
- Deployed canisters for data persistence
2. DAO Voting System
Location:/sample-applications/dao-voting-system/
Features:
- Secure vote recording with cryptographic verification
- Member management and access control
- Proposal creation and execution system
- Multi-signature governance support
- Immutable audit trail
- TypeScript + Node.js
- ICP Agent Kit for identity and storage
- Cryptographic libraries for vote verification
- Governance CrossChain canister for execution
- React frontend for user interface
Deployed Infrastructure
Production Canisters
1. Agent Connector (rrkah-fqaaa-aaaaa-aaaaq-cai
)
- Purpose: Communication and coordination hub
- Features: Agent message routing, command processing
- Used by: Trading bot, natural language processing
ryjl3-tyaaa-aaaaa-aaaba-cai
)
- Purpose: Data persistence and retrieval
- Features: Trade data storage, user preferences, analytics
- Used by: Trading bot data storage, application state
rdmx6-jaaaa-aaaaa-aaadq-cai
)
- Purpose: Governance and cross-chain operations
- Features: Vote execution, proposal management, token bridging
- Used by: DAO voting system, governance automation
Network Configuration
Supported Networks:- Internet Computer Mainnet (production)
- Local dfx replica (development)
- Custom RPC endpoints (enterprise)
- Automatic network detection
- Connection pooling and optimization
- Retry mechanisms with exponential backoff
- Certificate verification for security
Documentation Structure
API Reference (/docs/agent-api-reference/
)
Complete API Documentation:
icp-agent.mdx
- Main ICPAgent classidentity-plugin.mdx
- Identity management APItoken-plugin.mdx
- Token operations APIcanister-plugin.mdx
- Canister management APIcycles-plugin.mdx
- Cycles management APIlangchain-tools.mdx
- Natural language tools API
Plugin Guides (/docs/plugins/
)
Comprehensive Plugin Documentation:
identity.mdx
- Identity plugin guidetoken.mdx
- Token plugin guidecanister.mdx
- Canister plugin guidecycles.mdx
- Cycles plugin guide
LangChain Integration (/docs/langchain/
)
Natural Language Processing Guides:
overview.mdx
- LangChain integration overviewtools.mdx
- Tool usage and configurationnatural-language.mdx
- Natural language processing
Testing Strategy
Unit Tests (/tests/unit/
)
Comprehensive Plugin Coverage:
plugins/identity.plugin.unit.test.ts
- Identity plugin testsplugins/token.plugin.unit.test.ts
- Token plugin testsplugins/canister.plugin.unit.test.ts
- Canister plugin testsplugins/cycles.plugin.unit.test.ts
- Cycles plugin tests
- Mock-based testing for isolated unit tests
- Type safety validation
- Error handling verification
- Plugin lifecycle testing
Integration Tests (/tests/integration/
)
End-to-End Testing:
- Real network interactions
- Multi-plugin workflows
- Sample application testing
- Canister deployment verification
Development Workflow
Build System
Code Quality
Standards:- TypeScript strict mode enabled
- ESLint with comprehensive rules
- Prettier for code formatting
- 100% type safety target
- Comprehensive error handling
- Private keys never logged or exposed
- Input validation for all parameters
- Certificate verification for queries
- Secure identity storage patterns
Performance Characteristics
Optimization Features
Caching:- Actor instance caching for repeated calls
- Status information caching with TTL
- Principal and account ID calculation caching
- Multi-canister balance queries
- Bulk cycles top-up operations
- Parallel transaction processing
- Connection pooling for HTTP agents
- Request deduplication
- Automatic retry with backoff
Memory Management
Resource Cleanup:- Proper agent destruction
- Identity storage cleanup
- Cache eviction policies
- Memory leak prevention
Next Steps & Roadmap
Immediate Priorities
-
NPM Package Publishing
- Official package release
- Version management
- Distribution optimization
-
Enhanced Documentation
- Video tutorials
- Interactive examples
- Migration guides
-
Performance Optimization
- Advanced caching strategies
- Batch operation improvements
- Memory usage optimization
Future Enhancements
-
Governance Plugin
- NNS integration
- Neuron management
- Proposal voting automation
-
Advanced Features
- Internet Identity integration
- Multi-signature support
- Cross-chain capabilities
-
Developer Tools
- CLI utilities
- Development plugins
- Testing frameworks