docs
Get startedTroubleshootingPaymentsWebhooksAgent paymentsSwop MCPOviIdentity (swop.id)SwivyRPC (preview)API reference

Agent session grants

Let an AI agent or a backend job act on a wallet inside limits you set, without ever holding the wallet's key.

Preview: Swivy is not generally available

Swivy is in staging. It is not in production and Swop's own apps don't run on it yet. The SDK packages aren't published to npm; preview partners get access along with their credentials. Everything on this page can change. Request early access.

An AI agent that trades or pays for a user needs to sign. Giving it the wallet's key would be dangerous. A session grant gives it a narrow, expiring permission instead:

  • tied to one user and one wallet;
  • limited to the signing kinds you allow (for example messages and transactions);
  • limited to the networks you allow;
  • optionally capped at a maximum transaction value in USD;
  • time-bounded and use-limited, and revocable.

The agent gets its own key pair. Swivy checks every request it signs against the grant, so a leaked agent key can only do what the grant allows, until the grant expires.

This is the same job delegated signing does for Ovi and the Swop MCP today.

Issue a grant

The user approves the grant with their passkey first; pass that challengeId.

import { SwivyNodeClient, generateSessionKeyPair } from '@swivy/node';

const sessionKeys = generateSessionKeyPair(); // the agent's own key pair

const grant = await swivy.createSessionGrant({
  accountId: 'acct_...',
  publicKey: sessionKeys.publicKeyPem,
  challengeId: 'challenge_...',
  scope: {
    allowedNetworks: ['base-mainnet'],
    allowTransactionExecution: true,
    allowedSigningKinds: ['sign_message', 'sign_typed_data', 'sign_transaction'],
    maxTransactionValueUsd: 500,
  },
});

Act with the grant

const intent = await swivy.createTransactionIntentWithSessionGrant(
  grant.sessionGrant,
  sessionKeys.privateKeyPem, // the agent's key, never the wallet's
  {
    network: 'base-mainnet',
    transaction: { to: '0x1111111111111111111111111111111111111111', value: '0x0', data: '0x' },
  },
);

Good practice

  • Grant the smallest scope that does the job: one network, the signing kinds you need, a value cap.
  • Keep grants short-lived and re-issue them.
  • Store the agent's private key like any secret, and revoke the grant the moment you stop the agent.
  • Your operators can see each user's grants, with their state, in the Swivy console's user directory.

On this page