riglr
extends the rig
framework with production-ready blockchain capabilities.
With 23 specialized crates, 50+ verified blockchain tools, and the innovative SignerContext pattern
for secure multi-tenant operations, riglr seamlessly adds cross-chain automation to rig agents.
use riglr_solana_tools::{GetJupiterQuote, PerformJupiterSwap, DeployPumpToken};
use riglr_web_tools::{GetTokenInfo, AnalyzeCryptoSentiment};
use riglr_graph_memory::GraphMemory;
use rig::agent::AgentBuilder;
// Multi-chain trading agent with graph memory
let trading_agent = AgentBuilder::new(model)
.preamble("Expert DeFi trader with cross-chain capabilities")
.tool(GetJupiterQuote) // Routes through 30+ Solana DEXs
.tool(PerformJupiterSwap) // Optimal swap execution
.tool(GetTokenInfo) // Real-time market data from DexScreener
.dynamic_context(GraphMemory::new().await?) // Neo4j knowledge graph
.build();
// Pump.fun token launcher with sentiment analysis
let meme_launcher = AgentBuilder::new(model)
.preamble("Analyzes social sentiment and launches trending tokens")
.tool(AnalyzeCryptoSentiment) // Twitter/X sentiment via LunarCrush
.tool(DeployPumpToken) // Full token deployment on Pump.fun
.build();
// Example: AI-driven token analysis and potential launch
let sentiment = trading_agent
.prompt("Analyze current sentiment for dog-themed memecoins")
.await?;
// SignerContext automatically isolates user operations
// No manual key management - production-ready security
Building AI agents that can safely and reliably interact with blockchains is hard. riglr provides the foundational toolkit to do it right.
Alternatives give you a restrictive application. riglr gives you a powerful, unopinionated library.
Our core philosophy is to empower, not constrain. riglr is architected as a collection of modular crates.
Need only Solana tools? Just import riglr-solana-tools
. Building an EVM-only agent?
Use riglr-evm-tools
. This modularity ensures your application remains lean, flexible,
and free from the technical debt of monolithic frameworks.
Stop worrying about private key management and race conditions. Start building secure, multi-tenant services from day one.
riglr is built around the SignerContext, a battle-tested pattern for secure, multi-tenant blockchain operations. It uses thread-local storage to ensure that every user request is handled in a cryptographically isolated context. This makes building complex, concurrent applications that handle multiple user wallets simultaneously not just possible, but simple and safe.
riglr extends the rig framework, it doesn't replace it. Leverage the full power of rig's reasoning, not a custom-built alternative.
We believe in the power of the rig agent model. riglr is designed to be a pure extension, providing the blockchain tools and context that rig agents need to operate. We don't reinvent the reasoning loop or the agent lifecycle. This means your riglr-powered agent benefits directly from every improvement and feature added to the core rig framework.
Write business logic, not boilerplate. The #[tool] macro is your superpower.
Defining a new blockchain tool in riglr is as simple as writing a single async function. Our powerful #[tool]
macro handles everything else:
automatic Tool trait implementation, JSON schema generation, structured error handling, and seamless SignerContext access.
riglr is designed from the ground up to extend rig's powerful agent framework with blockchain superpowers
LLM orchestration, agent framework, and reasoning capabilities
use rig::agent::AgentBuilder;
use riglr_solana_tools::{TransferSol, GetSolBalance};
use riglr_evm_tools::{UniswapV3Swap};
// rig's AgentBuilder + riglr's blockchain tools
let defi_agent = AgentBuilder::new(model)
.preamble("You are a DeFi expert")
.tool(TransferSol) // riglr adds Solana
.tool(GetSolBalance) // riglr adds queries
.tool(UniswapV3Swap) // riglr adds EVM
.build();
// Natural language -> Blockchain actions
let result = defi_agent
.prompt("Send 1 SOL to alice.sol")
.await?;
riglr isn't just a collection of functions; it's a thoughtfully designed system for building robust blockchain applications.
At the heart of riglr is the SignerContext. It provides a secure, thread-local container for the current user's cryptographic signer. This allows your tools to be completely stateless—they simply ask the context for the current signer when they need to perform a transaction.
riglr is organized into a workspace of independent crates. This design means you only compile and depend on the functionality you need. Building a Solana-only agent? You don't need to pull in any EVM dependencies.
Network calls fail. Transactions get reverted. riglr is built for the real world. Our ToolError enum classifies failures into Permanent, Retriable, and RateLimited, allowing intelligent decisions about whether to retry failed operations.
Traditional blockchain applications struggle with secure multi-tenant operations. Managing multiple user wallets safely while preventing cross-user access is complex and error-prone.
The SignerContext pattern uses thread-local storage to ensure cryptographic isolation. Every blockchain operation automatically uses the correct user's credentials without manual key management.
// Tools are completely stateless
#[tool]
async fn transfer_sol(
to: String,
amount: f64,
) -> Result {
// SignerContext automatically provides
// the correct user's signer
let signer = get_signer_from_context()?;
let tx = create_transfer(&signer, &to, amount).await?;
Ok(tx.signature.to_string())
}
// No manual key management needed!
// Each user request runs in isolated context
Entities: Wallets, Tokens, Protocols, Transactions, Blocks
Relationships: PERFORMED, INVOLVED, USED, HOLDS
Queries: "Find wallets that traded BONK and also hold SOL"
Discovery and lifecycle management
Load balancing and routing
Message passing system
Priority queues and tracking
riglr provides 50+ production-ready tools across multiple blockchains, with new integrations added weekly.
We believe developers should spend their time on what makes their application unique.
// Manual, verbose, and error-prone implementation
pub struct GetSolBalance;
#[async_trait]
impl Tool for GetSolBalance {
fn name(&self) -> &str { "get_sol_balance" }
fn description(&self) -> &str {
"Get the SOL balance for a wallet."
}
fn parameters(&self) -> serde_json::Value {
json!({
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "The wallet address."
}
},
"required": ["address"]
})
}
async fn call(&self, params: serde_json::Value)
-> Result<serde_json::Value, ToolError> {
let address = params["address"]
.as_str()
.ok_or(...)?
.to_string();
// ... actual logic ...
// ... manual error conversion ...
// ... manual result serialization ...
}
}
/// Get the SOL balance for a given wallet address.
#[tool]
async fn get_sol_balance(
/// The Solana wallet address (base58 encoded).
address: String,
) -> Result<f64, ToolError> {
// Your logic here. That's it.
// The macro handles the rest.
let client = get_client_from_context()?;
let lamports = client.get_balance(&address).await?;
Ok(lamports as f64 / 1_000_000_000.0)
}
Production-grade event streaming with riglr-streams and high-performance indexing with riglr-indexer
Real-time transaction streaming
Multi-chain event monitoring
Binance, mempool services
Use our official CLI to scaffold a production-ready riglr agent instantly.
Our official project generator helps you start with best practices from day one.
cargo install create-riglr-app
Interactive CLI guides you through selecting templates, blockchains, and features.
# Create a new trading bot, web API server, or custom agent
create-riglr-app my-agent
# Or use a specific template directly
create-riglr-app my-bot --template trading-bot
Set your API keys and you're ready to go!
cd my-agent
cp .env.example .env
# Edit .env with your API keys and RPC URLs
cargo run
Production-ready layout with proper separation of concerns
Blockchain tools ready to use based on your selection
SignerContext pattern and secure key management built-in
Working examples showing how to use riglr effectively
Want more control? You can also add riglr to an existing project:
# Add to your Cargo.toml
[dependencies]
rig-core = "0.17.1"
riglr-core = "0.2.0"
riglr-macros = "0.2.0"
riglr-solana-tools = "0.2.0" # Or riglr-evm-tools, riglr-web-tools, etc.
riglr is evolving rapidly with continuous enhancements and new features
Added comprehensive security testing suite with SonarCloud integration, improved authentication patterns, and secure environment variable handling with PrivyConfig updates.
Streamlined GitHub Actions workflow with Rust caching, automated security scanning with DeepSource, and dependency management through Renovate.
Updated to Rust 1.82 MSRV, improved error messages, better documentation with mdBook deployment, and enhanced create-riglr-app scaffolding tool.
Production-ready riglr-agents crate for building complex multi-agent coordination with dispatch patterns and registry management.
High-performance riglr-indexer with custom event parsing, multi-protocol support, and seamless integration with riglr-streams for real-time data processing.
Added Hyperliquid perpetuals trading, enhanced cross-chain bridging with Li.Fi, and expanded web tools for market data and sentiment analysis.
Everything you need to create powerful blockchain-enabled AI agents with riglr.