
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Rails engine for integrating RcrewAI into your Rails applications. Provides ActiveRecord persistence, background job integration, generators, and a web UI for managing AI crews and agents.
Add this line to your application's Gemfile:
gem 'rcrewai-rails'
And then execute:
$ bundle install
Run the installation generator:
$ rails generate rcrew_a_i:rails:install
$ rails db:migrate
This will:
config/routes.rb
If you need to mount the routes manually, add this to your config/routes.rb
:
Rails.application.routes.draw do
mount RcrewAI::Rails::Engine => '/rcrewai'
# Your other routes...
end
This makes the web UI available at /rcrewai
and API endpoints at /rcrewai/api/v1/
.
Configure RcrewAI Rails in config/initializers/rcrewai.rb
:
RcrewAI::Rails.configure do |config|
# ActiveJob queue for background processing
config.job_queue_name = "default"
# Enable/disable web UI
config.enable_web_ui = true
# Use async execution by default
config.async_execution = true
# Default LLM settings
config.default_llm_provider = "openai"
config.default_llm_model = "gpt-4"
# Logging
config.enable_logging = true
config.log_level = :info
end
# Configure the base RcrewAI gem
RcrewAI.configure do |config|
config.openai_api_key = ENV["OPENAI_API_KEY"]
# Add other LLM provider keys as needed
end
Generate a new crew with agents:
$ rails generate rcrewai:rails:crew research_team sequential \
--agents researcher analyst writer \
--description "Research team for market analysis"
This creates a crew class in app/crews/research_team_crew.rb
.
class ResearchCrew
include RcrewAI::Rails::CrewBuilder
crew_name "research_team"
crew_description "AI-powered research team"
process_type :sequential
memory_enabled true
def setup_agents
@researcher = create_agent("researcher",
role: "Senior Research Analyst",
goal: "Uncover insights and trends",
backstory: "Expert researcher with years of experience"
)
@writer = create_agent("writer",
role: "Content Writer",
goal: "Create compelling reports",
backstory: "Skilled writer specializing in technical content"
)
end
def setup_tasks
@research_task = create_task("Research latest AI trends",
expected_output: "Comprehensive research report",
position: 1
)
assign_agent_to_task(@researcher, @research_task)
@writing_task = create_task("Write executive summary",
expected_output: "2-page executive summary",
position: 2
)
assign_agent_to_task(@writer, @writing_task)
add_task_dependency(@writing_task, @research_task)
end
end
# Execute the crew
crew = ResearchCrew.new
execution = crew.execute(topic: "AI in Healthcare")
class DataAnalystAgent
include RcrewAI::Rails::AgentBuilder
agent_role "Data Analyst"
agent_goal "Analyze application data"
tools [
RcrewAI::Rails::Tools::ActiveRecordTool.new(
model_class: User,
allowed_methods: [:count, :where, :pluck]
),
RcrewAI::Rails::Tools::RailsCacheTool.new,
RcrewAI::Rails::Tools::ActionMailerTool.new(
mailer_class: ReportMailer,
allowed_methods: [:send_report]
)
]
end
Access the web UI at /rcrewai
to:
Executions run through ActiveJob by default, using whatever adapter your Rails app is configured with:
# Async execution (default)
crew.execute_async(inputs)
# Sync execution
crew.execute_sync(inputs)
# Custom job options
CrewExecutionJob.set(wait: 5.minutes).perform_later(crew, inputs)
The gem provides these ActiveRecord models:
RcrewAI::Rails::Crew
- Crew configurationsRcrewAI::Rails::Agent
- Agent definitionsRcrewAI::Rails::Task
- Task definitionsRcrewAI::Rails::Execution
- Execution historyRcrewAI::Rails::ExecutionLog
- Detailed execution logsThe engine provides JSON API endpoints:
GET /rcrewai/api/v1/crews
GET /rcrewai/api/v1/crews/:id
POST /rcrewai/api/v1/crews/:id/execute
GET /rcrewai/api/v1/executions
GET /rcrewai/api/v1/executions/:id
GET /rcrewai/api/v1/executions/:id/status
GET /rcrewai/api/v1/executions/:id/logs
After checking out the repo, run:
$ bundle install
$ bundle exec rspec
To install this gem onto your local machine:
$ bundle exec rake install
Bug reports and pull requests are welcome on GitHub.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that rcrewai-rails demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.