Skip to content

Agent Kit Adapter

`prova-agent-kit` plugs Prova into Solana Agent Kit v2 with two lines. Every action your agent executes is captured, hashed, batched, and sealed on-chain — without touching your agent logic.

How it captures actions

  • attachProva(agent) wraps each registered action handler: after the handler resolves, the adapter builds a payload from the action name, input, and result, hashes it, and queues the attestation. Rich semantics, zero changes to your code.
  • ProvaWallet decorates the SAK BaseWallet: it captures the real on-chain transaction signature at signing time — proof of the exact transaction, not just the intent.

Attestation is fire-and-forget: a Prova failure never breaks or slows down the agent action. Errors go to onError (default: console warning).

Install

npm install prova-agent-kit prova-agent-sdk

The adapter never imports solana-agent-kit — it relies on TypeScript structural typing, so it stays a lightweight dependency validated against SAK v2.

Quick start

import { attachProva, attesterFromProvaClient } from 'prova-agent-kit';
import { ProvaClient } from 'prova-agent-sdk';

const prova = new ProvaClient({ rpcUrl, agentKeypair });
const attester = attesterFromProvaClient(
  prova,
  ProvaClient.hashAction,
  operatorKeypair,
);

// Call AFTER registering all your Solana Agent Kit plugins:
const handle = attachProva(agent, { attester });

// ... your agent runs normally; every action is attested automatically ...

await handle.stop(); // final flush — call when shutting the agent down

Options

const handle = attachProva(agent, {
  attester,
  // Only attest specific actions:
  rules: (actionName) => actionName.startsWith('trade_'),
  // Tune batching:
  batch: {
    maxSize: 25,        // flush immediately at N items (1–100)
    flushDelayMs: 1000, // debounce: flush N ms after the LAST action
  },
  // Custom error handling (attestation never breaks the action):
  onError: (error, { action }) => log.warn({ action, error }),
});
OptionDefaultDescription
attesterBridge to Prova. Build it with attesterFromProvaClient(client, hashAction, operatorKeypair).
rulesattest allPredicate by action name — return false to skip an action.
batch.maxSize25Immediate flush at N queued items (1–100 per transaction).
batch.flushDelayMs1000Debounce: flush N ms after the last action, so a burst of tool calls lands in ONE transaction. 0 = attest each action immediately.
onErrorconsole warnCalled on attestation failure; the agent action itself is never affected.

Batching semantics

Multi-tool-calling agents fire actions in bursts. The batcher groups a burst by debounce: it waits flushDelayMs after the last action, then sends everything in one record_attestations transaction (up to 100). Reaching maxSize flushes immediately. handle.flush() forces a send; handle.stop() does a final guaranteed flush — always call it on shutdown.

Wallet-level capture

import { ProvaWallet } from 'prova-agent-kit';

// Wraps any SAK BaseWallet: captures the REAL on-chain signature
// of every transaction the agent signs and attests it.
const wallet = new ProvaWallet(innerWallet, { attester });

const agent = new SolanaAgentKit(wallet, rpcUrl, config);

What gets attested

SourcePayloadAction type
Action handlerAction name + input + result (hashed, never on-chain).Mapped from the action name (ToolCall, Transaction, …).
ProvaWalletThe real transaction signature.Transaction.