Skip to content

Custom Action Providers

You can extend the agent wallet with custom actions by implementing the ActionProvider abstract class.

import { ActionProvider, type Action } from '@akta/agent-wallet'
import { z } from 'zod'
class MyCustomProvider extends ActionProvider {
readonly name = 'my-custom-provider'
getActions(): Action[] {
return [
{
name: 'my_action',
description: 'Does something custom',
inputSchema: z.object({
param: z.string().describe('A required parameter'),
amount: z.number().optional().describe('An optional amount'),
}),
execute: async (args) => {
const { param, amount } = args as { param: string; amount?: number }
// Access the AgentKit via this.agentKit
const { walletSdk, algorand, escrowName } = this.agentKit
// Use the wallet SDK to perform operations
// ...
return JSON.stringify({
summary: `Did something with ${param}`,
txIds: [],
})
},
},
]
}
}

Pass custom providers to AgentKit.from():

const agentKit = await AgentKit.from({
walletAppId: BigInt(process.env.WALLET_APP_ID!),
escrowName: process.env.ESCROW_NAME!,
walletProvider,
algorand,
actionProviders: [
new WalletInfoActionProvider(),
new PayActionProvider(),
new MyCustomProvider(), // Your custom provider
],
})

Inside execute(), you have access to this.agentKit which provides:

PropertyTypeDescription
walletSdkWalletSDKThe ARC-58 wallet SDK instance
algorandAlgorandClientAlgorand client for direct operations
escrowNamestringThe agent’s escrow name
walletProviderWalletProviderThe signing provider (Intermezzo or Local)

Each action defines:

FieldTypeDescription
namestringUnique action identifier
descriptionstringHuman-readable description (shown to the AI)
inputSchemaZodSchemaZod schema defining input parameters
executefunctionAsync function that performs the action

The inputSchema is automatically converted to JSON Schema for MCP tools and displayed to the AI agent.

Actions should return a JSON string with:

{
summary: string // Human-readable result description
txIds: string[] // Transaction IDs (if any)
}

Two wallet providers are available:

Signs transactions via HashiCorp Vault. The agent’s private key never leaves Vault.

import { IntermezzoWalletProvider } from '@akta/agent-wallet'
const provider = new IntermezzoWalletProvider({
apiUrl: 'http://localhost:3100',
vaultUrl: 'http://localhost:8200',
roleId: '...',
secretId: '...',
keyName: '...',
})

Signs with a local mnemonic. Only for development and testing.

import { LocalWalletProvider } from '@akta/agent-wallet'
const provider = new LocalWalletProvider({
mnemonic: 'your mnemonic ...',
})