Project

regent

0.01
The project is in a healthy, maintained state
Regent is a library for building AI Agents that utilize tools to accomplish tasks. Current implementation is based on the ReAct Agent architecture.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

~> 0.8.0
~> 0.9.3
~> 2.7
 Project Readme

regent_light

Regent

Gem Version Build License: MIT

Regent is a small and elegant Ruby framework for building AI agents that can think, reason, and take actions through tools. It provides a clean, intuitive interface for creating agents that can solve complex problems by breaking them down into logical steps.

Warning

Regent is currently an experiment intended to explore patterns for building easily traceable and debuggable AI agents of different architectures. It is not yet intended to be used in production and is currently in development.

Read more about Regent in a Medium article: Building AI Agent from scratch with Ruby

Key Features

  • ReAct Pattern Implementation: Agents follow the Reasoning-Action pattern, making decisions through a clear thought process before taking actions
  • Multi-LLM Support: Seamlessly works with:
    • OpenAI (GPT models)
    • Anthropic (Claude models)
    • Google (Gemini models)
  • Extensible Tool System: Create custom tools that agents can use to interact with external services, APIs, or perform specific tasks
  • Built-in Tracing: Every agent interaction is traced and can be replayed, making debugging and monitoring straightforward
  • Clean Ruby Interface: Designed to feel natural to Ruby developers while maintaining powerful capabilities

Showcase

A basic Regnt Agent extended with a price_tool that allows for retrieving cryptocurrency prices from coingecko.com.

Screen_gif

Quick Start

gem install regent

or add regent to the Gemfile:

gem 'regent'

and run

bundle install

Usage

Create your first agent:

# Initialize the LLM
model = Regent::LLM.new("gpt-4o")

# Create a custom tool
class WeatherTool < Regent::Tool
  def call(location)
    # Implement weather lookup logic
    "Currently 72°F and sunny in #{location}"
  end
end

# Create and configure the agent
agent = Regent::Agent.new(
  "You are a helpful weather assistant",
  model: model,
  tools: [WeatherTool.new(
    name: "weather_tool",
    description: "Get current weather for a location"
  )]
)

# Execute a query
agent.run("What's the weather like in Tokyo?") # => "It is currently 72°F and sunny in Tokyo."

Why Regent?

  • Transparent Decision Making: Watch your agent's thought process as it reasons through problems
  • Flexible Architecture: Easy to extend with custom tools and adapt to different use cases
  • Production Ready: Built with tracing, error handling, and clean abstractions
  • Ruby-First Design: Takes advantage of Ruby's elegant syntax and conventions

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/alchaplinsky/regent. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

Code of Conduct

Everyone interacting in the Regent project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.