Repolode
activeagents

activeagents/activeagent

A Ruby on Rails framework for building AI-powered apps where agents are implemented as controllers with actions and views.

Stars
986
Forks
93
Open issues
45
Last commit
33 minutes ago

What is it?

Active Agent adds an AI layer to Rails. Agents are written as Ruby classes that inherit from ApplicationAgent, with actions that behave like controller methods and ERB templates used to build prompts in text, JSON, or HTML form.

The framework supports several generation providers, including OpenAI, Anthropic, Ollama, DeepSeek, OpenRouter, and RubyLLM, which gives access to many models through one interface. Configuration lives in a YAML file, and a generator sets up the base agent class and config. Agents can call tools, stream responses over ActionCable, keep conversation context, and return structured output defined by JSON schemas.

A separate gem, actionagent, provides a mountable dashboard with traces, token usage metrics, and evaluations. The activeagent command line can run evaluations and fail a CI build below a set pass rate.

Key features

  • 01Agents are defined as Rails-style classes with actions and ERB prompt templates.
  • 02Supports OpenAI, Anthropic, Ollama, DeepSeek, OpenRouter, and RubyLLM providers.
  • 03Streams responses in real time through ActionCable.
  • 04Lets agents call tools and delegate work to sub-agents with declared schemas.
  • 05Produces structured output from JSON schemas.
  • 06Provides a command line for running evaluations in CI.

Use cases

  • Adding a chat or assistant feature to an existing Rails application.
  • Extracting structured data from images, PDFs, or text inside a Rails app.
  • Building multi-step agent workflows where one agent delegates to another.
  • Running evaluation suites on agent behavior as part of a CI pipeline.

Quick start

  1. 1

    Add the activeagent gem to your Gemfile

    bundle add activeagent
  2. 2

    Add a generation provider gem, such as OpenAI

    bundle add openai
  3. 3

    Run the install generator to create configuration files

    rails generate active_agent:install
  4. 4

    Generate your first agent with actions

    rails generate active_agent:agent TravelAgent search book confirm

Things to know

  • Requires Ruby 3.1 or newer and a supported Rails version (7.2, 8.0 or 8.1).
  • Most providers need an API key or a separately running service such as Ollama.
  • The dashboard is a separate gem, actionagent, that requires extra setup and database migrations.

In collections

Topics

FAQ

What is activeagent?
A Ruby on Rails framework for building AI-powered apps where agents are implemented as controllers with actions and views. Active Agent adds an AI layer to Rails. Agents are written as Ruby classes that inherit from ApplicationAgent, with actions that behave like controller methods and ERB templates used to build prompts in text, JSON, or HTML form.
Is activeagent free to use? What license does it have?
activeagent is open source under the MIT license. Check the license terms before using it in commercial products.
Is activeagent still maintained?
Actively maintained. The last commit to activeagent was on Nov 6, 2026.
What can I use activeagent for?
Adding a chat or assistant feature to an existing Rails application. Extracting structured data from images, PDFs, or text inside a Rails app. Building multi-step agent workflows where one agent delegates to another. Running evaluation suites on agent behavior as part of a CI pipeline.
How do I install activeagent?
Add the activeagent gem to your Gemfile: bundle add activeagent Add a generation provider gem, such as OpenAI: bundle add openai Run the install generator to create configuration files: rails generate active_agent:install Generate your first agent with actions: rails generate active_agent:agent TravelAgent search book confirm
Where can I get activeagent?
The source code and installation instructions are on GitHub: https://github.com/activeagents/activeagent

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects