Skip to main content

Module Reference

Detailed documentation for AgentVault modules.

src/deployment/​

ICP deployment and canister management.

icpClient.ts​

Primary ICP client for canister operations.

import { ICPClient } from 'agentvault';

const client = new ICPClient({
network: 'local',
identity: myIdentity
});

await client.createCanister();
await client.installCode(wasm, canisterId);

Key Functions:

FunctionDescription
createCanister()Create new canister
installCode()Install WASM code
canisterStatus()Get canister status
startCanister()Start stopped canister
stopCanister()Stop running canister

deployer.ts​

Deployment orchestration.

import { deployAgent } from 'agentvault';

const result = await deployAgent({
projectPath: './my-agent',
network: 'ic',
cycles: 1000000000000n
});

promotion.ts​

Environment promotion.

import { promoteCanister } from 'agentvault';

await promoteCanister({
from: 'staging',
to: 'production',
canisterId: 'abcde-aaaab'
});

src/packaging/​

WASM compilation and packaging.

compiler.ts​

TypeScript to WASM compilation.

import { compileToWasm } from 'agentvault';

const wasm = await compileToWasm({
entryPoint: './src/index.ts',
outputPath: './dist/agent.wasm'
});

packager.ts​

Package creation.

import { createPackage } from 'agentvault';

const pkg = await createPackage({
projectPath: './my-agent',
outputDir: './dist'
});

src/canister/​

Canister bindings and state management.

actor.ts​

Actor creation and management.

import { createActor, createAnonymousAgent } from 'agentvault';

const agent = createAnonymousAgent('http://localhost:4943');
const actor = createActor(canisterId, agent);

state.ts​

State query and fetch.

import { fetchCanisterState, queryState } from 'agentvault';

const state = await fetchCanisterState(canisterId, actor);
const query = await queryState(canisterId, 'getValue');

encryption.ts​

AES-256-GCM and ChaCha20-Poly1305 encryption.

import { encrypt, decrypt, deriveKey } from 'agentvault';

const key = deriveKey(password, salt);
const encrypted = encrypt(plaintext, key);
const decrypted = decrypt(encrypted, key);

src/wallet/​

Multi-chain wallet management.

index.ts​

Wallet manager entry point.

import { WalletManager } from 'agentvault';

const manager = new WalletManager();
const wallet = await manager.createWallet('ethereum');

providers/​

Chain-specific providers:

ProviderChainFeatures
icp-provider.tsICPIdentity, cycles, tokens
ethereum-provider.tsEthereumEOA, transactions
cketh-provider.tsckETHckETH, Etherscan
solana-provider.tsSolanaSPL tokens
polkadot-provider.tsPolkadotDOT, staking

wallet-storage.ts​

Persistent wallet storage.

import { saveWallet, loadWallet, listWallets } from 'agentvault';

await saveWallet(wallet);
const loaded = await loadWallet(walletId);
const all = await listWallets(agentId);

src/security/​

Security primitives: encryption, secret sharing, TOTP and approval tracking. The package root does not export this module, so the examples below import it from a checkout of this repository.

vetkeys.ts​

Splits a seed phrase into t-of-n Shamir shares and derives a local key from it. The module is named after VetKeys, but the ICP vetKD integration is not wired yet.

import { VetKeysClient } from './src/security/index.js';

const client = new VetKeysClient({ threshold: 2, totalParties: 3 });
const derived = await client.deriveThresholdKey(seedPhrase);
// derived.shares: 3 Shamir shares of the seed phrase, any 2 rebuild it
// derived.key: a PBKDF2 key derived locally from the seed phrase

multisig.ts​

Approval requests with a signer quorum (tracked locally; not cryptographic multisig).

import {
createApprovalRequest,
signApprovalRequest,
isApproved,
} from './src/security/multisig.js';

const request = createApprovalRequest('deploy', 'my-agent', 'Deploy v1.2', 'alice', {
policy: 'majority',
allowedSigners: ['alice', 'bob', 'carol'],
});
signApprovalRequest(request.id, 'bob'); // records the name; no key is involved
isApproved(request.id); // false until a second approval is recorded

allowedSigners only sets the quorum size: signApprovalRequest accepts any signer name. Nothing else in AgentVault reads an approval, so no deploy waits for one.


src/monitoring/​

Health checks and metrics.

health.ts​

Health check implementation.

import { runHealthCheck } from 'agentvault';

const result = await runHealthCheck(canisterId, {
checks: ['status', 'cycles', 'memory']
});

metrics.ts​

Metrics collection.

import { collectMetrics, getMetricsFilePath } from 'agentvault';

const metrics = await collectMetrics(canisterId);
// Returns: requests, errors, latency, memory, cycles

src/backup/​

Backup and restore.

backup.ts​

Backup creation.

import { createBackup, restoreBackup } from 'agentvault';

const backup = await createBackup(agentName, {
canisterId: 'abcde-aaaab',
includeState: true
});

await restoreBackup(backup.id, targetCanisterId);

src/archival/​

Arweave archival storage.

arweave-client.ts​

Arweave integration.

import { ArweaveClient } from 'agentvault';

const client = new ArweaveClient();
await client.upload(backup);
const tx = await client.getStatus(transactionId);

src/inference/​

AI inference integration.

bittensor-client.ts​

Bittensor network client.

import { BittensorClient } from 'agentvault';

const client = new BittensorClient();
const response = await client.query({ prompt: 'Hello' });

cli/commands/​

CLI command implementations.

Structure​

Each command file exports a Commander.js command:

// cli/commands/example.ts
import { Command } from 'commander';

export const exampleCommand = new Command('example')
.description('Example command')
.option('-v, --verbose', 'Verbose output')
.action((options) => {
// Command implementation
});

Available Commands​

FileCommandDescription
init.tsinitInitialize project
package.tspackagePackage agent
deploy.tsdeployDeploy to canister
exec.tsexecExecute task
show.tsshowShow state
fetch.tsfetchDownload state
status.tsstatusProject status
list.tslistList agents
wallet.tswalletWallet operations
backup.tsbackupBackup operations
promote.tspromotePromote environment
rollback.tsrollbackRollback deployment
monitor.tsmonitorMonitor health
health.tshealthHealth checks
info.tsinfoCanister info
stats.tsstatsStatistics
logs.tslogsView logs
cycles.tscyclesCycles management
tokens.tstokensToken balances
identity.tsidentityICP identity
inference.tsinferenceAI inference
archive.tsarchiveLocal archive records
approve.tsapproveApproval quorums (tracked locally)
profile.tsprofilePerformance profiling
trace.tstraceExecution traces
rebuild.tsrebuildRebuild from state