Active Agent
Build AI in Rails
The open-source framework for AI agents in Rails — agents, actions, and prompts that feel like the Rails you already know. MIT licensed, provider-agnostic, free forever.
Running agents in production? Monitor them at activeagents.ai
What's in the Box
Everything to build agents in Rails. Free forever.
Agents are Controllers
Actions, callbacks, views. Your agents speak Rails.
hover for code tap for codeclass TranslationAgent < ApplicationAgent
generate_with :openai, model: "gpt-4o"
def translate
prompt message: "Translate '#{params[:text]}' to #{params[:target_lang]}"
end
end
TranslationAgent.with(text: "Hello", target_lang: "es").translate.generate_now
docs/agents →
hover to flip back
tap to flip back
Action Prompt
Composable prompts. Like Action Mailer, but for AI.
hover for code tap for codedef summarize
prompt(
instructions: "Summarize in 2-3 sentences",
message: params[:text],
temperature: 0.3
)
end
SummaryAgent.with(text:).summarize.generate_now
docs/actions →
hover to flip back
tap to flip back
Any LLM
OpenAI, Anthropic, Gemini, Bedrock, Ollama. Switch with one line.
hover for code tap for code# OpenAI
generate_with :open_ai, model: "gpt-4o"
# Anthropic
generate_with :anthropic, model: "claude-sonnet-4-5-20250929"
# Google Gemini
generate_with :gemini, model: "gemini-2.0-flash"
# Ollama (local)
generate_with :ollama, model: "llama3"
docs/providers →
hover to flip back
tap to flip back
Resilient by Default
Automatic retries on provider errors. Configure once, apply everywhere.
hover for code tap for code# config/active_agent.yml
production:
openai:
service: "OpenAI"
model: "gpt-4o"
retries: true
retries_count: 3
docs/framework →
hover to flip back
tap to flip back
Streaming
Real-time responses. Your agents think out loud.
hover for code tap for codeclass ChatAgent < ApplicationAgent
generate_with :openai, model: "gpt-4o", stream: true
on_stream :handle_chunk
def chat
prompt message: params[:message]
end
private
def handle_chunk(chunk)
print chunk.delta if chunk.delta
end
end
docs/streaming →
hover to flip back
tap to flip back
Structured Output
JSON schemas, typed data. Agents that follow instructions.
hover for code tap for codedef parse_resume
prompt(
message: "Extract: #{params[:data]}",
response_format: :json_schema
)
end
# Loads schema from views/agents/*/parse_resume.json
docs/structured_output →
hover to flip back
tap to flip back
Tool Calling
AI calls Ruby methods. Fetch data, take actions, make decisions.
hover for code tap for codedef weather_update
prompt(
message: params[:query],
tools: [{
name: "get_weather",
description: "Get weather for a location",
parameters: { type: "object", properties: {
location: { type: "string" }
}, required: ["location"] }
}]
)
end
def get_weather(location:)
# AI calls this method automatically
end
docs/tools →
hover to flip back
tap to flip back
MCP Support
Model Context Protocol. Connect agents to remote MCP servers.
hover for code tap for codegenerate_with :anthropic,
model: "claude-sonnet-4-5-20250929",
mcp_servers: [
{
type: "url",
name: "stripe",
url: "https://mcp.stripe.com"
}
]
docs/mcp →
hover to flip back
tap to flip back
Background Jobs
ActiveJob integration. Run agents async, at scale.
hover for code tap for code# Queue for later
ApplicationAgent.prompt(message: "Analyze").generate_later
# With options
ApplicationAgent.prompt(message: "Report").generate_later(
queue: :reports,
wait: 5.minutes
)
# Configure queue at class level
self.generate_later_queue_name = :ai_tasks
docs/generation →
hover to flip back
tap to flip back
See your agents while you build
The gem ships a local dev console — every generation recorded as a trace with a span waterfall, token usage, and per-agent metrics, entirely in your development database.
One command
Install the console and its migrations, then flip local telemetry on.
$ rails generate active_agent:dashboard:install
$ rails db:migrate
# config/active_agent.yml
telemetry:
enabled: true
local_storage: true
Everything a generation did
Open /active_agent and every prompt shows up as a
trace: prompt → LLM → tool spans with timings, token
counts (input / output / thinking), provider and model. Metrics
roll up per agent over the last 24 hours.
For production — retention, evaluations, cost estimates, team workspaces — point the same telemetry at activeagents.ai with one YAML change.
Free, and free forever
The core framework is MIT licensed — every provider, streaming, structured outputs, persistence via solid_agent, and the local dev console included.
Ship your first agent today
Need more than the framework?
The commercial side lives at activeagents.ai:
- Hosted monitoring — production traces, evaluations, cost estimates, retention, and team workspaces (free low-volume trial included)
- ActiveAgent.PRO — versioned agents & prompts, pausable multi-agent workflows, generative UI
- Enterprise — SSO, SOC 2, HIPAA, private VPC, org-wide licensing
Compare gem editions
| activeagent | activeagent-pro | enterprise | |
|---|---|---|---|
| Core Framework | |||
| Active Agent | |||
| Action Prompt | |||
| Generation Providers (OpenAI, Anthropic, Gemini, Bedrock, Ollama, RubyLLM…) | |||
| Instrumentation, Error Handling, Retries | |||
| Streaming & Structured Output | |||
| Dev console (local traces & metrics) | |||
| Active Agent Pro | |||
| Versioned agents, prompts & contexts | |||
| Generative UI components | |||
| Parallel tasks & advanced retries | |||
| HITL generative UI | |||
| Agentic workflows (pausable multi-agent) | |||
| Async tasks with external triggers | |||
| Agent rate limiting | |||
| Licensing | |||
| License type | MIT | Commercial | Commercial |
| Multi-app / embedded licensing | |||
| Custom terms | |||
| Support | |||
| Community (Discord, GitHub) | |||
| Email support | |||
| Priority support | |||
FAQ
Common questions about Active Agent
How do I install Active Agent?
Add gem 'activeagent' to your Gemfile and run bundle install. Then run rails generate active_agent:install to set up the initial configuration.
Is it really free?
Yes — the framework, every provider, solid_agent persistence, and the local dev console are MIT licensed with no usage limits. Commercial products (hosted monitoring, PRO gem extensions, enterprise licensing) are separate and live at activeagents.ai.
Which providers are supported?
OpenAI, Anthropic, Google Gemini, AWS Bedrock, Azure OpenAI, Ollama, OpenRouter, Requesty, and RubyLLM (which unlocks 15+ more). Switch providers with one line of code.
Can I use Active Agent with existing Rails apps?
Yes! Active Agent is designed to integrate seamlessly with existing Rails applications. It works alongside your existing models, controllers, and services.
How do I see what my agents are doing?
In development, install the dev console (rails g active_agent:dashboard:install) and every generation appears at /active_agent as a trace with a span waterfall and token counts. For production monitoring, point telemetry at the hosted platform — one YAML block, free trial tier included.
Does my data leave my infrastructure?
Not unless you send it somewhere. The framework and dev console run entirely in your app against your own database. Hosted monitoring is opt-in via the telemetry config.
Ship your first agent this afternoon
MIT licensed. Built for Rails. No keys required to start — the mock provider runs the full pipeline while you wire things up.