-
Notifications
You must be signed in to change notification settings - Fork 4
Installation
adham90 edited this page Jan 21, 2026
·
2 revisions
Detailed installation instructions for RubyLLM::Agents.
| Dependency | Minimum Version | Notes |
|---|---|---|
| Ruby | 3.1.0 | Required for pattern matching |
| Rails | 7.0 | Requires Hotwire for dashboard |
| PostgreSQL/MySQL/SQLite | Any | For execution tracking |
RubyLLM::Agents automatically installs:
gem "rails", ">= 7.0"
gem "ruby_llm", ">= 1.0" # LLM client library
gem "turbo-rails", ">= 1.0" # Hotwire Turbo for real-time UI
gem "stimulus-rails", ">= 1.0" # Hotwire Stimulus for JavaScript
gem "chartkick", ">= 5.0" # Beautiful charts for analytics# Gemfile
gem "ruby_llm-agents"bundle installrails generate ruby_llm_agents:installThis creates:
create db/migrate/xxx_create_ruby_llm_agents_executions.rb
create config/initializers/ruby_llm_agents.rb
create app/llm/agents/application_agent.rb
insert config/routes.rb
rails db:migrateChoose one method:
# .env
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=...EDITOR="code --wait" rails credentials:editopenai:
api_key: sk-...
anthropic:
api_key: sk-ant-...
google:
api_key: ...# config/initializers/ruby_llm_agents.rb
RubyLLM.configure do |config|
config.openai_api_key = ENV['OPENAI_API_KEY']
config.anthropic_api_key = ENV['ANTHROPIC_API_KEY']
config.google_api_key = ENV['GOOGLE_API_KEY']
endStart your Rails server and visit:
http://localhost:3000/agents
You should see the RubyLLM::Agents dashboard.
# rails console
module LLM
class TestAgent < ApplicationAgent
model "gpt-4o-mini"
param :message, required: true
def user_prompt
message
end
end
end
result = LLM::TestAgent.call(message: "Hello!")
puts result.contentWhen upgrading to a new version:
bundle update ruby_llm-agents
rails generate ruby_llm_agents:upgrade
rails db:migrateThe upgrade generator adds any new database columns or tables.
rails generate ruby_llm_agents:install
rails db:migrateEnsure the route is mounted:
# config/routes.rb
mount RubyLLM::Agents::Engine => "/agents"Verify your keys are set:
# rails console
puts ENV['OPENAI_API_KEY'].present?See Troubleshooting for more solutions.
Add buildpacks if using native extensions:
heroku buildpacks:add --index 1 heroku/rubyEnsure your Dockerfile includes:
ENV OPENAI_API_KEY=${OPENAI_API_KEY}Set environment variables in your CI configuration:
# .github/workflows/test.yml
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}