Skip to main content

Quickstart

This guide walks you through creating your first agent with an encrypted wallet, setting policies, and signing a transaction — all using the @stwd/sdk.

1. Install the SDK

npm install @stwd/sdk

2. Initialize the Client

import { StewardClient } from "@stwd/sdk";

const steward = new StewardClient({
  baseUrl: "https://api.steward.fi",
  apiKey: "your-tenant-api-key",
});
You’ll receive your tenant API key when your tenant is created. This key authenticates all tenant-level operations (agent CRUD, policy management). See API Overview for authentication details.

3. Create an Agent with a Wallet

const agent = await steward.createWallet("my-first-agent", "My First Agent");

console.log(agent);
// {
//   id: "my-first-agent",
//   name: "My First Agent",
//   tenantId: "your-tenant-id",
//   walletAddresses: {
//     evm: "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD18",
//     solana: "7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU"
//   },
//   createdAt: "2026-03-26T12:00:00.000Z"
// }
Steward automatically generates encrypted EVM and Solana keypairs. The private keys are encrypted with AES-256-GCM and never leave the vault.

4. Set Policies

Before an agent can sign transactions, it needs policies. Steward uses default deny — without policies, all operations are rejected.
await steward.setPolicies("my-first-agent", [
  {
    id: "spending-limit",
    type: "spending-limit",
    enabled: true,
    config: {
      maxPerTransaction: "100000000000000000",  // 0.1 ETH
      maxPerDay: "500000000000000000",          // 0.5 ETH
    },
  },
  {
    id: "approved-addresses",
    type: "approved-addresses",
    enabled: true,
    config: {
      addresses: ["0xDEX_ROUTER_ADDRESS"],
    },
  },
  {
    id: "auto-approve",
    type: "auto-approve-threshold",
    enabled: true,
    config: {
      maxValue: "50000000000000000", // 0.05 ETH — auto-approve below this
    },
  },
]);

5. Sign a Transaction

const result = await steward.signTransaction("my-first-agent", {
  to: "0xDEX_ROUTER_ADDRESS",
  value: "10000000000000000", // 0.01 ETH
  chainId: 8453,             // Base mainnet
});

if ("txHash" in result) {
  console.log(`Transaction broadcast! Hash: ${result.txHash}`);
} else if ("status" in result && result.status === "pending_approval") {
  console.log("Transaction requires manual approval:", result.results);
}
If the transaction exceeds the auto-approve threshold but is within spending limits, it enters the approval queue. A tenant admin must call POST /vault/:agentId/approve/:txId to release it. See Vault API for details.

6. Check Balance

const balance = await steward.getBalance("my-first-agent", 8453);

console.log(balance);
// {
//   agentId: "my-first-agent",
//   walletAddress: "0x742d35Cc...",
//   balances: {
//     native: "1000000000000000000",
//     nativeFormatted: "1.0",
//     chainId: 8453,
//     symbol: "ETH"
//   }
// }

What’s Next?

Architecture

Understand Steward’s three-pillar design.

Policy Guide

Learn about all policy types and configurations.

ElizaOS Plugin

Integrate Steward into an ElizaOS agent.

Self-Hosting

Deploy your own Steward instance.