riglr-web-tools
Comprehensive web data tools for riglr agents, bridging on-chain and off-chain intelligence with production-grade integrations for social media, market data, news, and web search.
Features
- 🐦 Twitter/X Integration: Real-time social sentiment analysis and trend monitoring
- 📊 DexScreener Market Data: Token metrics, trading pairs, and market analysis
- 🔍 Intelligent Web Search: Semantic search using Exa API for contextual results
- 📰 News Aggregation: Cryptocurrency news monitoring and sentiment analysis
- ⚡ High Performance: Async/await with built-in rate limiting and caching
- 🛡️ Error Resilience: Distinguishes between retriable and permanent failures
- 🔐 Secure API Management: Environment-based configuration for API keys
Architecture
riglr-web-tools provides off-chain data integration for riglr agents, bridging web2 and web3 data sources with structured tools for market intelligence.
Design Principles
- API Abstraction: Uniform interface across different data providers
- Rate Limit Aware: Built-in rate limiting and backoff strategies
- Caching First: In-memory caching to reduce API calls and costs
- Error Classification: Distinguishes retriable, permanent, and rate-limited errors
- Type-Safe Responses: Strongly typed data models for all API responses
- Tool-Ready: All functions use
#[tool]macro for agent integration
Core Components
- Twitter Module: Social media monitoring and sentiment analysis
- DexScreener Module: DEX market data and token analytics
- Exa Search Module: Semantic web search with AI-powered relevance
- News Module: Crypto news aggregation and analysis
- Common Utilities: Shared HTTP client, rate limiting, error handling
Data Flow
External API → Rate Limiter → HTTP Client → Response Parser → Cache → Tool Result
↓ ↓ ↓
Retry Logic Error Mapping Type Validation
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
Quick Start
Setting up API Keys
All API keys are now centrally managed through the ApplicationContext provided by riglr-core.
Set the following environment variables, and they will be automatically loaded into the configuration:
# Twitter/X API access
# Exa web search API
# Security analysis tools
# Market analytics
# Optional: DexScreener (no auth required by default)
# Optional: News API endpoints
Note: API keys are no longer passed as function parameters. They are automatically retrieved from the ApplicationContext.
Basic Usage
use ApplicationContext;
use ;
async
Available Tools
Twitter/X Tools
search_tweets
Search for tweets with advanced filtering and sentiment analysis.
let result = search_tweets.await?;
println!;
get_user_tweets
Fetch recent tweets from a specific user.
let tweets = get_user_tweets.await?;
analyze_crypto_sentiment
Comprehensive sentiment analysis for cryptocurrency tokens.
let sentiment = analyze_crypto_sentiment.await?;
println!;
DexScreener Tools
get_token_info
Get detailed token information and metrics.
let token = get_token_info.await?;
println!;
search_tokens
Search for tokens by name or symbol.
let results = search_tokens.await?;
get_trending_tokens
Get currently trending tokens across chains.
let trending = get_trending_tokens.await?;
analyze_token_market
Deep market analysis for a specific token.
let analysis = analyze_token_market.await?;
get_top_pairs
Get top trading pairs by volume or liquidity.
let pairs = get_top_pairs.await?;
News Tools
get_crypto_news
Fetch latest cryptocurrency news.
let news = get_crypto_news.await?;
for article in news.articles
get_trending_news
Get currently trending news articles.
let trending = get_trending_news.await?;
monitor_breaking_news
Monitor for breaking news with alerts.
let breaking = monitor_breaking_news.await?;
if !breaking.alerts.is_empty
analyze_market_sentiment
Aggregate sentiment analysis across news sources.
let sentiment = analyze_market_sentiment.await?;
println!;
Web Search Tools
search_web
Intelligent semantic web search using Exa API.
let results = search_web.await?;
for result in results.results
find_similar_pages
Find pages similar to a given URL.
let similar = find_similar_pages.await?;
summarize_web_content
Get AI-powered summaries of web pages.
let summary = summarize_web_content.await?;
println!;
search_recent_news
Search for recent news articles.
let news = search_recent_news.await?;
Advanced Usage
Combining Tools for Market Intelligence
use *;
async
Integration with rig
All tools are compatible with the rig agent framework:
use Agent;
use ;
let market_analyst = builder
.preamble
.tool
.tool
.tool
.tool
.tool
.build;
let analysis = market_analyst
.prompt
.await?;
Error Handling
All tools use ToolError to distinguish between retriable and permanent errors:
use ToolError;
match get_token_info.await
Rate Limiting
The tools automatically handle rate limiting:
- DexScreener: 300 requests/minute (no auth required)
- Twitter/X: Based on your API tier
- NewsAPI: Based on your subscription
- Exa: Based on your plan
Testing
# Run all tests
# Run with integration tests (requires API keys)
# Run specific test suite
Security
- API keys are never exposed to the agent's reasoning context
- All URLs and parameters are validated
- Automatic retry logic for transient failures
- Rate limit compliance to prevent API bans
License
MIT
Contributing
Contributions are welcome! Please ensure all tests pass and add new tests for any new functionality.