A multi-language Farcaster plugin for elizaOS, providing full integration with the Farcaster decentralized social network via the Neynar API.
This plugin is implemented in three languages with full feature parity:
- TypeScript - Primary implementation for Node.js and browser
- Python - Python implementation for ML/AI pipelines
- Rust - High-performance implementation with WASM support
- Cast Management: Send casts, reply to casts, and manage your timeline
- Profile Management: Fetch and cache user profiles
- Mentions & Notifications: Monitor and respond to mentions
- Timeline Provider: Access your Farcaster feed
- Thread Support: Navigate and respond within cast threads
- Embed Processing: Handle images, videos, and embedded casts
- Webhook Support: Real-time updates via webhooks
- Polling Mode: Periodic fetching for simple deployments
npm install @elizaos/plugin-farcaster
# or
bun add @elizaos/plugin-farcasterpip install elizaos-plugin-farcasterAdd to your Cargo.toml:
[dependencies]
elizaos-plugin-farcaster = "1.0"The plugin requires the following environment variables:
| Variable | Required | Description |
|---|---|---|
FARCASTER_FID |
Yes | Your Farcaster ID (FID) |
FARCASTER_SIGNER_UUID |
Yes | Neynar signer UUID for signing casts |
FARCASTER_NEYNAR_API_KEY |
Yes | Neynar API key for API access |
FARCASTER_DRY_RUN |
No | Enable dry run mode (default: false) |
FARCASTER_MODE |
No | Operation mode: 'polling' or 'webhook' (default: polling) |
MAX_CAST_LENGTH |
No | Maximum cast length (default: 320) |
FARCASTER_POLL_INTERVAL |
No | Polling interval in seconds (default: 120) |
ENABLE_CAST |
No | Enable auto-casting (default: true) |
CAST_INTERVAL_MIN |
No | Min cast interval in minutes (default: 90) |
CAST_INTERVAL_MAX |
No | Max cast interval in minutes (default: 180) |
import farcasterPlugin from "@elizaos/plugin-farcaster";
// Register with agent runtime
const agent = new AgentRuntime({
plugins: [farcasterPlugin],
// ... other config
});from elizaos_plugin_farcaster import FarcasterClient, FarcasterConfig
# Load configuration from environment
config = FarcasterConfig.from_env()
# Create client
async with FarcasterClient(config) as client:
# Send a cast
casts = await client.send_cast("Hello from elizaOS! π€")
print(f"Cast sent: {casts[0].hash}")use elizaos_plugin_farcaster::{FarcasterClient, FarcasterConfig};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = FarcasterConfig::from_env()?;
let client = FarcasterClient::new(config)?;
let casts = client.send_cast("Hello from elizaOS! π€", None).await?;
println!("Cast sent: {}", casts[0].hash);
Ok(())
}Posts a new cast to Farcaster.
// Triggered by messages containing: post, cast, share, announce, farcaster, post
"Please post about the new ElizaOS features on Farcaster";Replies to an existing cast.
// Triggered by messages containing: reply, respond, answer, comment
"Reply to that cast and thank them for the feedback";Provides the agent's Farcaster profile information for context.
Provides the agent's recent timeline for context about recent activity.
Provides thread context for understanding conversation flow.
# TypeScript
bun run build
# Python
cd python && python -m build
# Rust
cd rust && cargo build --release# All languages
bun run test
# TypeScript only
bun run test:ts
# Python only
bun run test:python
# Rust only
bun run test:rust# TypeScript
bun run lint
# Python
bun run lint:python
# Rust
bun run lint:rustplugin-farcaster/
βββ typescript/ # TypeScript implementation
β βββ index.ts # Main plugin entry
β βββ client/ # Neynar API client
β βββ services/ # Service layer
β βββ actions/ # SEND_CAST, REPLY_TO_CAST
β βββ providers/ # Context providers
β βββ types/ # Type definitions
βββ python/ # Python implementation
β βββ elizaos_plugin_farcaster/
β β βββ __init__.py
β β βββ client.py # Neynar API client
β β βββ service.py # Service layer
β β βββ types.py # Type definitions
β βββ tests/
βββ rust/ # Rust implementation
βββ src/
β βββ lib.rs # Library entry
β βββ client.rs # Neynar API client
β βββ service.rs # Service layer
β βββ actions/ # Action implementations
β βββ providers/ # Provider implementations
βββ tests/
FarcasterService- Main service managing client lifecycleFarcasterClient- Low-level API clientsendCastAction- Action for posting castsreplyCastAction- Action for replying to castsfarcasterProfileProvider- Profile context providerfarcasterTimelineProvider- Timeline context provider
FarcasterService- Main service classFarcasterClient- Async API clientFarcasterConfig- Configuration dataclassSendCastAction- Cast actionReplyCastAction- Reply actionProfileProvider- Profile providerTimelineProvider- Timeline provider
FarcasterService- Main service structFarcasterClient- API clientFarcasterConfig- Configuration structSendCastAction- Cast actionReplyCastAction- Reply actionProfileProvider- Profile providerTimelineProvider- Timeline provider
MIT License - see LICENSE file for details.
Contributions are welcome! Please ensure that any changes maintain feature parity across all three language implementations.