Complete API reference for the ICPAgent class and core functionality
ICPAgent
class is the main entry point for the ICP Agent Kit, providing access to all plugins and LangChain integration.
new ICPAgent(config)
config
(optional): Configuration object
network
: 'mainnet' | 'local'
- Network to connect to (default: ‘local’)identity
: Identity | string
- Identity instance or seed phrasehost
: string
- Custom RPC hostplugins
: string[]
- Plugins to enable (default: all)openai
: OpenAI configuration for natural language processing
apiKey
: string
- OpenAI API keymodel
: string
- Model to use (default: ‘gpt-4-turbo-preview’)identityPlugin
IdentityPlugin
tokenPlugin
TokenPlugin
canisterPlugin
CanisterPlugin
cyclesPlugin
CyclesPlugin
config
IICPAgentConfig
identity
Identity
createAgent(type)
type
: 'developer' | 'defi' | 'governance' | 'general'
- Type of specialized agentICPSpecializedAgent
Example:
processNaturalLanguage(command)
command
: string
- Natural language command to executePromise<string>
- Execution result
Example:
getActor(canisterId, idlFactory)
canisterId
: Principal | string
- Canister IDidlFactory
: IDL.InterfaceFactory
- Candid interface factoryActorSubclass<T>
- Typed actor instance
Example:
getPrincipal()
Principal
- Current principal
getIdentity()
Identity
- Current identity
destroy()
Promise<void>