Skip to main content

Overview

Cambrian Agent Kit is a developer SDK to build autonomous AI agents and agentic chatbots on Sei. It lets you interact with DeFi protocols (Takara, Silo, Citrex, Symphony), manage SEI tokens and NFTs, and integrate AI workflows. This tutorial shows how to set up the kit, run your first agent, and adapt it to real DeFi use cases. For details about how the kit works internally, see the Cambrian Agent Kit documentation.

Supported features

For blockchain agent development, you can use the kit to:
  • Manage ERC-20 and ERC-721 tokens on Sei
  • Interact with the Sei DeFi ecosystem
  • Swap tokens through the Symphony aggregator
  • Add and remove liquidity with DragonSwap
  • Lend and borrow with the Takara protocol
  • Stake and unstake SEI tokens with Silo
  • Build AI agents with LangChain and LangGraph

What this guide teaches you:

  • Install and configure the kit, and connect your wallet and API keys.
  • Understand the core concepts: agents, supported protocols, and how these components fit together.
  • Run end-to-end code examples to:
    • Check your token and NFT balances.
    • Swap tokens with Symphony.
    • Stake and unstake SEI in Silo.
    • Lend and borrow with Takara.
    • Trade perpetuals with Citrex.
  • Adapt the kit for your own protocol or workflow.
Example use cases:
  • Autonomous DeFi agents: Agents that can automatically manage token positions, provide liquidity, or take part in lending
  • AI-assisted wallets: Conversational interfaces for blockchain operations
  • Financial assistant agents: AI agents that can analyze market conditions and execute trades
  • Portfolio management agents: Agents that manage crypto asset portfolios automatically

Hands-on tutorial

1. Prerequisites

  • Node.js and npm installed
  • A private key for your Sei wallet
  • An OpenAI API key (for AI integrations)
  • Enough SEI in your wallet to pay for gas

2. Project setup

Edit .env:
Never share your private key. Your private key controls your funds.

3. Running your first agent

This is the command output and a sample chat with the Cambrian Agent:
About the transaction:
  • SEI address: 0x0 represents the native SEI token in the agent kit.
  • Transaction hash: You can verify it on Seiscan.
  • Transaction fees: Fees are calculated automatically and deducted from your balance.

4. Explore core features & protocols

a) Check token balance with error handling

b) Safe token swapping with Symphony

Swap safety tips:
  • In the agent kit, use 0x0 as the address for the native SEI token.
  • Always set an appropriate slippage tolerance.
  • Monitor the price impact before large swaps.

c) Liquid staking with Silo protocol

d) Lending/borrowing with Takara protocol

e) Perpetual trading with Citrex Markets

For more advanced protocol integrations, see /tools/.

Error handling & troubleshooting

Common error types

Error handling examples:

Transaction monitoring

Troubleshooting guide

Debug commands:

5. Advanced features & customization

Multi-protocol strategy example

Monitoring & alerts:

Custom protocol integration

To extend the Cambrian Agent Kit for your own protocol, follow the Cambrian Agents Plugin Guide. This repository explains how to add plugins to the agent kit so that it can support your protocol.