Skip to main content

Farcaster plugin for elizaOS - Python implementation for casting and receiving messages

Project description

elizaOS Farcaster Plugin - Python

A Python implementation of the Farcaster plugin for elizaOS, providing full integration with the Farcaster decentralized social network via the Neynar API.

Features

  • 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

Installation

pip install elizaos-plugin-farcaster

Or with development dependencies:

pip install elizaos-plugin-farcaster[dev]

Configuration

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)

Usage

Basic Usage

from elizaos_plugin_farcaster import FarcasterClient, FarcasterConfig

# Load configuration from environment
config = FarcasterConfig.from_env()

# Create client
client = FarcasterClient(config)

# Send a cast
async def main():
    cast = await client.send_cast("Hello from elizaOS! 🤖")
    print(f"Cast sent: {cast.hash}")

    # Get your profile
    profile = await client.get_profile(config.fid)
    print(f"Username: {profile.username}")

# Run
import asyncio
asyncio.run(main())

With elizaOS Runtime

from elizaos_plugin_farcaster import farcaster_plugin

# Register with agent runtime
runtime.register_plugin(farcaster_plugin)

Development

Running Tests

cd python
pytest

Type Checking

mypy elizaos_plugin_farcaster

Linting

ruff check .
ruff format .

API Reference

FarcasterClient

The main client for interacting with Farcaster via Neynar.

  • send_cast(text, reply_to=None) - Send a new cast
  • get_cast(hash) - Get a cast by hash
  • get_profile(fid) - Get a user profile by FID
  • get_mentions(limit=20) - Get mentions for the configured FID
  • get_timeline(limit=50) - Get the user's timeline

Types

  • Cast - Represents a Farcaster cast
  • Profile - Represents a Farcaster user profile
  • CastEmbed - Represents embedded content in a cast
  • FarcasterConfig - Configuration for the Farcaster client

License

MIT License - see LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elizaos_plugin_farcaster-2.0.0a5.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elizaos_plugin_farcaster-2.0.0a5-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_farcaster-2.0.0a5.tar.gz.

File metadata

File hashes

Hashes for elizaos_plugin_farcaster-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 88f734cdc4318f0290194ae254c0a7417876adeb1ba345591fc14438a6b4ee3d
MD5 c65e43253d9b613f121ed53316e67d10
BLAKE2b-256 b3adea1b4770beaf2577bb3d5fc12232f344586a921091690dd25346870d4c7b

See more details on using hashes here.

File details

Details for the file elizaos_plugin_farcaster-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_farcaster-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 b08bd9f29e3ecc61e4ce62ffb2408cb5030c76a06af7ed63efbec2fa5998d621
MD5 5e82ff9898bb5f1933e9369c4cbd743e
BLAKE2b-256 6a91ec176401581d4e1b1c4f5dd6dab43a7e6878c72cee5deaa67af3170f9738

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page