Skip to main content

Overview

Cambrian Agent Kit is a developer SDK for building powerful, autonomous AI agents and agentic chatbots on the SEI blockchain. It lets you interact with DeFi protocols (Takara, Silo, Citrex, Symphony), manage SEI tokens and NFTs, and seamlessly integrate AI workflows. In this tutorial, you’ll learn how to set up the kit, run your first agent, and use it for real DeFi use cases—customized for your needs. To understand more and deep dive into how it works under the hood, please refer to the Cambrian Agent Kit Documentation.

Supported Features

The SEI Agent Kit supports a comprehensive set of features for blockchain agent development:
  • Token Operations: Complete SEI ERC-20 and ERC-721 token management
  • DeFi Protocol Integration: Seamless interaction with SEI’s DeFi ecosystem
  • Swap Functionality: Token swapping through Symphony aggregator
  • Liquidity Management: Add and remove liquidity with DragonSwap
  • Lending & Borrowing: Interact with Takara protocol for lending operations
  • Staking Operations: Stake and unstake SEI tokens with Silo
  • LangChain Integration: Build AI agents with LangChain and LangGraph

What this guide teaches you:

This tutorial guides you through:
  • Setup: Install and configure the Agent Kit, connect your wallet and API keys.
  • Core Concepts: Understand agents, supported protocols, and how these components fit together.
  • End-to-End Examples: You’ll run practical code to:
    • Check your token/NFT balances.
    • Swap tokens using Symphony.
    • Stake/unstake SEI in Silo.
    • Lend/borrow with Takara.
    • Trade perps with Citrex.
  • Customization: Learn to adapt the kit for your own protocol or workflow.
Some Use Cases:
  • Autonomous DeFi Agents: Agents that can automatically manage token positions, provide liquidity, or engage in lending activities
  • AI-Assisted Wallets: Conversational interfaces for blockchain operations
  • Financial Assistant Agents: AI agents that can analyze market conditions and execute trades
  • Portfolio Management Agents: Automated management of crypto asset portfolios

Hands-on Tutorial

1. Prerequisites

  • Node.js & npm installed
  • SEI wallet private key
  • OpenAI API key (for AI integrations)
  • Minimum SEI balance: Ensure you have sufficient SEI for gas

2. Project Setup

Edit .env:
Important Security Notes:
  • Never share your private key: Your private key controls your funds

3. Running Your First Agent

The following is the output and interaction with the Cambrian Agent:
Understanding the Transaction:
  • SEI Address: 0x0 represents native SEI token in the agent kit
  • Transaction Hash: Can be verified on Seiscan
  • Gas Fees: Automatically calculated 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:
  • SEI Native Token: Use “0x0” as the address for native SEI token while using the agent kit
  • Slippage Protection: Always set appropriate slippage tolerance
  • Price Impact: Monitor price impact before large swaps

c) Liquid Staking with Silo Protocol

d) Lending/Borrowing with Takara Protocol

e) Perpetual Trading with Citrex Markets

See /tools/ for more advanced protocol integrations!

Error Handling & Troubleshooting

Common Error Types

Comprehensive 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, please follow this repository which explains how to add plugins to the agent kit so that it can support your protocol: Cambrian Agents Plugin Guide