Skip to content

About

Production-grade AI Agent toolkit and SDK for Stellar blockchain & Soroban smart contracts. Connects LLMs & autonomous agents to Soroban.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

🦀 Soroban AgentKit

CI License: MIT Node.js Stellar

Soroban AgentKit is a production-grade, modular TypeScript toolkit and SDK that connects autonomous AI agents (ElizaOS, LangChain, CrewAI, AutoGen, and OpenAI function calling) directly to the Stellar blockchain and Soroban smart contracts.

Empower your LLMs to query balances, transfer native XLM or SAC tokens, simulate and invoke Soroban contracts, and interact with the decentralized financial ecosystem in natural language.


🏛️ System Architecture

graph TD
    User([User Prompt / Autonomous Goal]) --> AgentRuntime[AI Agent: ElizaOS / LangChain / OpenAI]
    AgentRuntime -->|Structured Tool Call| AgentKit[🦀 Soroban AgentKit SDK]
    
    subgraph "Soroban AgentKit Core"
        AgentKit --> ToolRegistry[Tool Registry: Balance, Transfer, Contract Call]
        AgentKit --> Signer[🔐 Secure Ed25519 Keypair Signer]
        AgentKit --> XDRSerializer[XDR Type Parser & Soroban Serializer]
    end
    
    Signer --> RPCClient[Stellar Horizon & Soroban RPC]
    XDRSerializer --> RPCClient
    
    RPCClient --> SorobanHost[📜 Soroban Smart Contracts WASM]
    RPCClient --> StellarLedger[⛓️ Stellar Ledger Settlement XLM / USDC]
Loading

🌟 Key Features

  • ⚡ Lightweight & Modular: Zero unnecessary bloat. Pure TypeScript with first-class @stellar/stellar-sdk support.
  • 🤖 Universal Framework Adapters: Out-of-the-box adapters for OpenAI / Anthropic Function Calling, LangChain Structured Tools, and ElizaOS Actions.
  • 🔐 Secure Key Management: Client-side transaction signing with Stellar Keypairs. Private keys never leave your runtime environment.
  • 📦 Smart Contract Support: Seamlessly simulate and execute invocations on any deployed Soroban smart contract with automatic type serializations.
  • 🌐 Multi-Network Ready: First-class support for testnet, mainnet, and local standalone networks.

📦 Installation

npm install soroban-agentkit

🚀 Quickstart

1. Initialize the Agent Kit

import { SorobanAgentKit, toOpenAITools } from 'soroban-agentkit';

// Initialize with your Stellar secret key
const agent = new SorobanAgentKit({
  secretKey: process.env.STELLAR_SECRET_KEY!,
  network: 'testnet' // 'testnet' | 'mainnet' | 'standalone'
});

console.log('Agent Public Key:', agent.getPublicKey());
console.log('Network:', agent.getNetwork());

2. Use with OpenAI Function Calling

import OpenAI from 'openai';
import { SorobanAgentKit, toOpenAITools } from 'soroban-agentkit';

const agent = new SorobanAgentKit({ secretKey: process.env.STELLAR_SECRET_KEY! });
const tools = agent.getTools();
const openaiTools = toOpenAITools(tools);

const openai = new OpenAI();
const response = await openai.chat.completions.create({
  model: 'gpt-4o-mini',
  messages: [{ role: 'user', content: 'What is my current XLM balance?' }],
  tools: openaiTools
});

3. Use with LangChain

import { SorobanAgentKit, toLangChainTools } from 'soroban-agentkit';

const agent = new SorobanAgentKit({ secretKey: process.env.STELLAR_SECRET_KEY! });
const langchainTools = toLangChainTools(agent.getTools());

🛠️ Built-in Agent Tools

Tool Name Description
stellar_get_balance Queries native XLM and issued asset balances for any Stellar address.
stellar_transfer_token Sends native XLM or assets to a recipient with an optional memo.
stellar_get_account_info Retrieves account sequence, thresholds, subentry count, and active signers.
soroban_call_contract Simulates and executes smart contract function calls with arguments.

🧪 Development & Testing

# Clone the repository
git clone https://github.com/Ranjeet2063/soroban-agentkit.git
cd soroban-agentkit

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run unit tests
npm test

💼 Author, Commercial Consulting & Hiring

Need to integrate autonomous AI agents into your Web3 protocol, build custom Soroban tool plugins, or audit your smart contracts?


🤝 Contributing

Contributions are warmly welcome! Please see CONTRIBUTING.md for details on submitting pull requests and reporting issues.


📄 License

This project is licensed under the MIT License.

About

Production-grade AI Agent toolkit and SDK for Stellar blockchain & Soroban smart contracts. Connects LLMs & autonomous agents to Soroban.

Topics

Resources

Contributing

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages