Skip to content

Treasury Management Agent ​

An autonomous treasury agent powered by Claude (Anthropic) that performs atomic batch rebalancing within weekly spending limits.

What It Demonstrates ​

  • Claude (Anthropic) as LLM -- showing vendor diversity beyond OpenAI
  • Atomic batch rebalancing with executeBatch()
  • Weekly spending limits for treasury operations
  • Portfolio allocation reasoning

Quick Start ​

bash
cd apps/examples/treasury-management-agent

# Mock mode (no API keys needed)
pnpm start:mock

# Testnet mode
cp .env.example .env
# Fill in: ANTHROPIC_API_KEY, RPC_URL, BUNDLER_URL, OWNER_PRIVATE_KEY
pnpm start

Configuration ​

VariableDescriptionRequired
ANTHROPIC_API_KEYAnthropic API keyTestnet only
RPC_URLBase Sepolia RPCTestnet only
BUNDLER_URLPimlico bundler URLTestnet only
OWNER_PRIVATE_KEYWallet owner keyTestnet only

Preset: treasury-agent ​

This example uses the treasury-agent preset, which configures:

  • Spending limit: 5 ETH per week (rolling window)
  • No allowlist: Treasury operations need flexibility to interact with various protocols
  • Emergency pause: Manual unpause only (no auto-unpause) for maximum security

Key Features ​

Batch Rebalancing ​

Uses executeBatch() for atomic multi-call rebalancing. All calls in a batch execute together or not at all, preventing partial portfolio states:

typescript
await client.executeBatch(wallet, {
  calls: [
    { target: tokenA, data: sellCalldata },
    { target: tokenB, data: buyCalldata },
    { target: tokenC, data: buyCalldata },
  ],
});

Budget Tracking ​

The agent tracks spending across the weekly window and reasons about remaining budget before executing trades.

Claude Integration ​

Demonstrates that SmartAgentKit works with any LLM provider. Claude reasons about portfolio allocation, risk assessment, and rebalancing strategy before executing transactions.

Source Code ​

See apps/examples/treasury-management-agent/ in the repository.

Released under the MIT License.