Built on Sui · Powered by Walrus

Decentralized storage
for AI agents.

Let your AI agents store outputs on Walrus decentralized storage via Skills. Generate images, text, or JSON, auto-upload to Walrus, and get permanent shareable URLs.

image-agent.ts
import { WalrusAgent, createSkill } from "walgent";

// 1. Define an "image generation" Skill
const imageSkill = createSkill(
  { name: "image-gen", title: "Image Generator", version: "0.1.0" },
  async (ctx) => ({
    ok: true,
    message: `Generated image for "${ctx.input}"`,
    outputs: [{ filename: "cat.svg", contentType: "image/svg+xml", data }],
  }),
);

// 2. Run — the agent auto-uploads the image to Walrus
const agent = new WalrusAgent({ walrus: { network: "testnet" } });
agent.register(imageSkill);

const result = await agent.run("image-gen", { input: "a cat on blockchain" });
console.log(result.stored[0].url);
// → https://aggregator.walrus-testnet.../v1/blobs/CW8p1U4...

Why Walgent

A lightweight TypeScript toolkit that connects AI agents to Walrus storage

🧩

Skill Abstraction

Define agent capabilities with a unified interface, fully decoupling business logic from storage. One createSkill does it all.

🗃️

Auto Upload

After an agent runs, outputs are automatically stored on Walrus — zero boilerplate. Returns decentralized access URLs.

🌐

Multi-Network

Supports mainnet / testnet / devnet with custom endpoints. Full Mainnet private key management built in.

🔁

Retry & Timeout

Built-in exponential backoff retries and request timeout control. Stable uploads even under network fluctuations.

🛡️

Type Safe

Complete TypeScript type definitions. IDE autocompletion and compile-time error checking out of the box.

🧪

Testable

Supports custom fetch mocking for easy unit testing. 25 built-in tests all passing.

How it works

Four steps to decentralized storage for agent outputs

1

Define Skill

Use createSkill to define agent capabilities (image generation, text processing, etc.)

2

Run Skill

WalrusAgent invokes the Skill and produces outputs

3

Auto Upload

Each output is automatically uploaded to the Walrus Publisher

4

Get URL

Returns blobId and decentralized access URL, readable by anyone

Code Examples

Connect your agent to Walrus in minutes

Install
Image Agent
Mainnet Keys
# Install with npm npm install walgent # or with yarn yarn add walgent # or with pnpm pnpm add walgent # Local development git clone https://github.com/yourname/walgent cd walgent npm install npm test
import { WalrusAgent, createSkill, toBytes } from "walgent"; const skill = createSkill( { name: "image-gen", title: "Image Generator", description: "Generate an image from a prompt", version: "0.1.0", }, async (ctx) => { const imageBytes = await generateImage(ctx.input); return { ok: true, message: `Generated image for "${ctx.input}"`, outputs: [ { filename: `image-${Date.now()}.png`, contentType: "image/png", data: imageBytes, }, ], }; }, ); const agent = new WalrusAgent({ walrus: { network: "testnet" }, uploadDefaults: { epochs: 5 }, }); agent.register(skill); const result = await agent.run("image-gen", { input: "a cat sitting on a blockchain", }); console.log(result.stored[0].url); console.log(result.stored[0].blobId);
// Mainnet requires WAL tokens to pay for storage // Three strategies: self-hosted Publisher / Upload Relay / on-chain signing import { WalrusAgent, createWalletFromEnv } from "walgent"; const agent = new WalrusAgent({ walrus: { network: "mainnet", publisherUrl: process.env.WALRUS_PUBLISHER_URL, }, // Wallet config: load private key from env wallet: { source: "env", envVar: "WALRUS_SUI_PRIVATE_KEY", }, // Check SUI balance before upload checkBalanceBeforeUpload: true, uploadDefaults: { epochs: 10 }, }); // Query wallet balance const balance = await agent.wallet.getBalance(); console.log(`Balance: ${Number(balance) / 1e9} SUI`);

Start building your agent

Give your AI outputs permanent, decentralized storage