DEV Community

Cover image for Building an AI Agent with Rig and Rust in 10 Minutes
Rina
Rina

Posted on

Building an AI Agent with Rig and Rust in 10 Minutes

Rina: A Simple, Fast, and Lightweight AI Agent Framework

Rina is an open-source, lightweight AI agent framework built with Rig. It's designed for developers who want to create flexible and scalable AI agents.

In this post, we'll guide you through the installation process and demonstrate how to get started with Rina.

Features

  • Twitter Integration
    • Cookie-based login (no API costs)
    • AI-generated tweet images (Heuris API)
  • Telegram Integration
    • Telegram bot integration
  • Heuris Image Generator
    • AI-powered image generation for tweets
  • Discord Integration
    • Discord bot integration
  • Character
    • Pre-defined message examples
    • Customizable topics
    • Configurable communication styles

Prerequisites

  • Rust programming language
  • Cargo package manager
  • Git

Installation Guide

Prerequisites

Before installing Rina, ensure you have the following installed on your system:

  • Rust and Cargo: If you haven't installed Rust yet, follow the Rust installation guide
  • Git: Required to clone the repository

Steps to Install Rina

git clone https://github.com/cornip/Rina.git
cd Rina
cargo build
Enter fullscreen mode Exit fullscreen mode

To get the TWITTER_COOKIE_STRING:

  1. Open Chrome DevTools (F12)
  2. Go to the Network tab
  3. Select Fetch/XHR
  4. Choose any request that starts with https://x.com/i/api/graphql/
  5. Refresh page (F5)
  6. In Request Headers, copy the cookie value

Image description

This will make the AI Agent run only on Discord and Twitter.

Edit and customize your character at rina/src/characters/rina.toml

Image description

Configure your environment variables:

# Get TELEGRAM_BOT_TOKEN: https://core.telegram.org/bots/tutorial
# Get DISCORD_API_TOKEN: https://discord.com/developers/applications

# Twitter Configuration
TWITTER_USERNAME=your_username
TWITTER_PASSWORD=your_password
TWITTER_EMAIL=your_email
TWITTER_2FA_SECRET=your_2fa_secret
TWITTER_COOKIE_STRING=your_cookie_string

# Bot Tokens
TELEGRAM_BOT_TOKEN=your_telegram_token
DISCORD_API_TOKEN=your_discord_token

# API Keys
OPENAI_API_KEY=your_openai_key
HEURIST_API_KEY=your_heurist_key
Enter fullscreen mode Exit fullscreen mode

Usage

Start the service:

cargo run
Enter fullscreen mode Exit fullscreen mode

Contributing

Rina is open to contributions! If you have ideas or improvements, feel free to:

  • Submit issues
  • Create pull requests

Top comments (0)