Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- uses: actions/checkout@v4

# rcrewai now ships to rubygems, so the gemspec dep (`rcrewai ~> 0.8.0`)
# rcrewai now ships to rubygems, so the gemspec dep (`rcrewai ~> 0.10.0`)
# resolves from there. The sibling-checkout workaround this job used while
# the gem was unpublished has been removed.
- name: Set up Ruby
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed
- Requires `rcrewai ~> 0.10.0`. No migration is needed, and the suite passed against it unchanged. The engine does not expose 0.10's `CancelToken`, per-call `chat(model:)` or `cached_tokens`; see the README.

### Fixed
- **Docs and install template:** the README and docs site set `config.openai_api_key` inside `RcrewAI.configure`, which is the engine's configuration, so the example raised `NoMethodError`. They now use `RCrewAI.configure(validate: false)`. The generated initializer's commented example also named settings that don't exist (`groq_api_key`, `default_model`).
- **Docs:** the README's `tools [ ... ]` example nested the array and broke the agent, and it didn't say that tools must be required explicitly.
- **Docs:** corrected the `CrewExecutionJob` namespace, the rcrewai repo link and the gem's documentation URL, listed `POST /crews`, and brought the docs site up from rcrewai 0.7.

## [0.9.0] - 2026-09-10

Tracks **rcrewai 0.9.0**, whose theme is concurrency: a turn's tool calls,
Expand Down
60 changes: 49 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# RcrewAI Rails

Rails engine for integrating [RcrewAI](https://github.com/gkosmo/rcrewai-rails) into your Rails applications. Provides ActiveRecord persistence, background job integration, generators, and a web UI for managing AI crews and agents.
Rails engine for integrating [rcrewai](https://github.com/gkosmo/rcrewAI) into your Rails applications. Provides ActiveRecord persistence, background job integration, generators, and a web UI for managing AI crews and agents.

## Features

Expand All @@ -10,7 +10,7 @@ Rails engine for integrating [RcrewAI](https://github.com/gkosmo/rcrewai-rails)
- **Web UI**: Monitor and manage crews through a built-in interface
- **Rails-Specific Tools**: Pre-built tools for ActiveRecord, ActionMailer, Rails cache, and more
- **Configuration**: Flexible configuration through Rails initializers
- **Full rcrewai 0.9 feature coverage** (see [rcrewai 0.9](#rcrewai-09-capabilities), [0.8](#rcrewai-08-capabilities) and [0.7](#rcrewai-07-capabilities) capabilities):
- **Runs on rcrewai 0.10, with features through 0.9 exposed on the models** (see [rcrewai 0.10](#rcrewai-010), [0.9](#rcrewai-09-capabilities), [0.8](#rcrewai-08-capabilities) and [0.7](#rcrewai-07-capabilities)):
- Agent config: reasoning, per-agent LLM, rate limiting, context-window trimming, cognitive memory
- Task output: structured output schemas, guardrails, file output, multimodal attachments
- Crew: `before_kickoff`/`after_kickoff` hooks, planning, the `consensual` process, batch execution
Expand Down Expand Up @@ -171,8 +171,12 @@ RcrewAI::Rails.configure do |config|
config.log_level = :info
end

# Configure the base RcrewAI gem
RcrewAI.configure do |config|
# Configure the base rcrewai gem. It reads provider keys such as OPENAI_API_KEY
# and ANTHROPIC_API_KEY from the environment on its own, so this is only needed
# for values set in code. Note the capital C: `RcrewAI.configure` is the engine's
# configuration, which has no provider settings. `validate: false` stops a missing
# key from failing boot in places that don't call an LLM, such as assets:precompile.
RCrewAI.configure(validate: false) do |config|
config.openai_api_key = ENV["OPENAI_API_KEY"]
# Add other LLM provider keys as needed
end
Expand Down Expand Up @@ -239,14 +243,20 @@ execution = crew.execute(topic: "AI in Healthcare")

### Using Rails-Specific Tools

The tools are not loaded with the engine, so require the ones you use:

```ruby
require "rcrewai/rails/tools/active_record_tool"
require "rcrewai/rails/tools/rails_cache_tool"
require "rcrewai/rails/tools/action_mailer_tool"

class DataAnalystAgent
include RcrewAI::Rails::AgentBuilder

agent_role "Data Analyst"
agent_goal "Analyze application data"

tools [
tools(
RcrewAI::Rails::Tools::ActiveRecordTool.new(
model_class: User,
allowed_methods: [:count, :where, :pluck]
Expand All @@ -256,10 +266,13 @@ class DataAnalystAgent
mailer_class: ReportMailer,
allowed_methods: [:send_report]
)
]
)
end
```

Pass the tools as separate arguments, not as one array: `tools [a, b]` nests the
array and the agent fails when it lists its tools.

### Monitoring Executions

Access the web UI at `/rcrewai` to:
Expand All @@ -280,12 +293,35 @@ crew.execute_async(inputs)
crew.execute_sync(inputs)

# Custom job options
CrewExecutionJob.set(wait: 5.minutes).perform_later(crew, inputs)
RcrewAI::Rails::CrewExecutionJob.set(wait: 5.minutes).perform_later(crew, inputs)
```

## rcrewai 0.9 capabilities
## rcrewai 0.10

This engine requires [rcrewai](https://github.com/gkosmo/rcrewAI) `~> 0.10.0`. The
upgrade needs no migration. rcrewai 0.10 adds live streaming features to its
Anthropic client, and most of them work at the client level, so the engine has no
settings for them:

| rcrewai 0.10 feature | In this engine |
|---|---|
| Keep-alive connection for streaming requests | Applies automatically to Anthropic agents that stream |
| `config.base_url` for Anthropic | Set it in `RCrewAI.configure` |
| `RCrewAI::CancelToken` / `chat(cancel:)` | Not exposed. `Execution#cancel!` only updates the record's status and does not stop a running stream |
| `chat(model:)` per-call override | Not exposed. Use an agent's `llm_config` to choose its model |
| `cached_tokens` on usage | Not recorded. The observation engine does not store it on spans or rollups |

This engine tracks [rcrewai](https://github.com/gkosmo/rcrewAI) `~> 0.9`.
To use cancellation or per-call models, call an rcrewai client directly from your
own code.

**Current Claude models:** these reject the `temperature` that rcrewai sends by
default, so turn it off globally. A per-agent `llm_config` can't remove it.

```ruby
RCrewAI.configure(validate: false) { |config| config.temperature = nil }
```

## rcrewai 0.9 capabilities

### Concurrency

Expand Down Expand Up @@ -397,15 +433,16 @@ existing records are unaffected — set only what you need.
| `reasoning` / `max_reasoning_attempts` | Run a planning/reasoning pass before answering |
| `respect_context_window` | Trim history to fit the model's context window |
| `parallel_tools` | Run a turn's tool calls concurrently (rcrewai 0.9; `nil` uses the gem default of on) |
| `llm_config` (JSON) | Per-agent LLM override, e.g. `{ "provider": "anthropic", "model": "claude-sonnet-5" }` |
| `llm_config` (JSON) | Per-agent LLM override, e.g. `{ "provider": "anthropic", "model": "claude-opus-5-5" }` (see the [`temperature` note](#rcrewai-010)) |
| `memory_enabled` + `memory_scope` + `memory_short_term_limit` | Enable cognitive memory (see below) |

```ruby
agent = crew.agents.create!(
name: "researcher", role: "Researcher", goal: "Find facts",
reasoning: true,
max_rpm: 30,
llm_config: { provider: "anthropic", model: "claude-sonnet-5" },
# Current Claude models also need RCrewAI's temperature set to nil; see "rcrewai 0.10".
llm_config: { provider: "anthropic", model: "claude-opus-5-5" },
memory_enabled: true, memory_scope: "research", memory_short_term_limit: 20
)
```
Expand Down Expand Up @@ -500,6 +537,7 @@ The engine provides JSON API endpoints:
```
GET /rcrewai/api/v1/crews
GET /rcrewai/api/v1/crews/:id
POST /rcrewai/api/v1/crews
POST /rcrewai/api/v1/crews/:id/execute
GET /rcrewai/api/v1/executions
GET /rcrewai/api/v1/executions/:id
Expand Down
3 changes: 2 additions & 1 deletion docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ <h2>JSON API endpoints</h2>
<tbody>
<tr><td><span class="verb get">GET</span></td><td class="method">/crews</td></tr>
<tr><td><span class="verb get">GET</span></td><td class="method">/crews/:id</td></tr>
<tr><td><span class="verb post">POST</span></td><td class="method">/crews</td></tr>
<tr><td><span class="verb post">POST</span></td><td class="method">/crews/:id/execute</td></tr>
<tr><td><span class="verb get">GET</span></td><td class="method">/executions</td></tr>
<tr><td><span class="verb get">GET</span></td><td class="method">/executions/:id</td></tr>
Expand All @@ -204,7 +205,7 @@ <h2>Running executions</h2>
crew.execute_sync(inputs) # run inline

# Custom job options:
CrewExecutionJob.set(wait: 5.minutes).perform_later(crew, inputs)</pre>
RcrewAI::Rails::CrewExecutionJob.set(wait: 5.minutes).perform_later(crew, inputs)</pre>
</div>
</section>

Expand Down
73 changes: 71 additions & 2 deletions docs/capabilities.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
<section class="page-hero">
<div class="wrap">
<h1>Capabilities</h1>
<p>The engine tracks rcrewai ~> 0.7. Every capability is configured through columns on the persisted models and forwarded to the core objects at build time — all off/absent by default.</p>
<p>The engine requires rcrewai ~> 0.10.0. Every capability is configured through columns on the persisted models and forwarded to the core objects at build time — all off/absent by default.</p>
</div>
</section>

Expand All @@ -170,6 +170,7 @@ <h2>Agent configuration</h2>
<tr><td><code>max_rpm</code></td><td>Rate-limit the agent's LLM calls (requests/minute).</td></tr>
<tr><td><code>reasoning</code> / <code>max_reasoning_attempts</code></td><td>Run a reasoning pass before answering.</td></tr>
<tr><td><code>respect_context_window</code></td><td>Trim history to fit the model's context window.</td></tr>
<tr><td><code>parallel_tools</code></td><td>Run a turn's tool calls concurrently (nil uses the gem default of on).</td></tr>
<tr><td><code>llm_config</code> (JSON)</td><td>Per-agent LLM override.</td></tr>
<tr><td><code>memory_enabled</code> + <code>memory_scope</code> + <code>memory_short_term_limit</code></td><td>Enable cognitive memory.</td></tr>
</tbody>
Expand All @@ -178,7 +179,8 @@ <h2>Agent configuration</h2>
name: "researcher", role: "Researcher", goal: "Find facts",
reasoning: true,
max_rpm: 30,
llm_config: { provider: "anthropic", model: "claude-sonnet-5" },
# Current Claude models also need RCrewAI's temperature set to nil.
llm_config: { provider: "anthropic", model: "claude-opus-5-5" },
memory_enabled: true, memory_scope: "research", memory_short_term_limit: 20
)</pre>
</div>
Expand Down Expand Up @@ -253,6 +255,73 @@ <h2>Flows</h2>
</div>
</section>

<section>
<div class="wrap">
<h2>Observation engine</h2>
<p>Every execution is traced as a tree of spans (crew, agent, task, LLM call, and tool call) with timings, token counts, and cost. See the trace at <code>/rcrewai/executions/:id/observation</code> and spend at <code>/rcrewai/observations/costs</code>.</p>
<pre>RcrewAI::Rails.configure do |config|
config.observation_enabled = true
config.observation_capture_prompts = :truncated # :none | :truncated | :full
config.observation_retention_days = 30
end</pre>
<p class="caption">Prune old spans with rake rcrewai:observation:prune. Token and cost data need an agent that runs through rcrewai's native tool runner; with a fallback such as Ollama without native tools, the cost dashboard is empty.</p>
</div>
</section>

<section>
<div class="wrap">
<h2>Checkpointing and resume</h2>
<p>Record each task's result so an interrupted run can resume without re-running and re-paying for completed tasks. Off by default; enable it globally or per crew. It needs the <code>rcrewai_checkpoints</code> table.</p>
<pre>RcrewAI::Rails.configure { |config| config.checkpoint_enabled = true } # globally
crew.update!(checkpoint_enabled: true) # or per crew</pre>
</div>
</section>

<section>
<div class="wrap">
<h2>Concurrent tool calls</h2>
<p>rcrewai runs a turn's tool calls concurrently by default. Opt out on an agent whose tools aren't safe to run in parallel, or that must not fan out against a rate-limited API. Left <code>nil</code>, the gem's default applies.</p>
<pre>agent.update!(parallel_tools: false)</pre>
</div>
</section>

<section>
<div class="wrap">
<h2>LLM interceptors</h2>
<p>Hooks that run around every LLM request the engine's agents make. Return a replacement to modify the payload or result, or <code>nil</code> to leave it untouched. A hook that raises is reported and skipped.</p>
<pre>RcrewAI::Rails.configure do |config|
config.llm_before_request = lambda do |payload, context|
Rails.logger.info("[llm] -> #{context[:provider]}/#{context[:model]}")
payload
end
end</pre>
</div>
</section>

<section>
<div class="wrap">
<h2>Providers</h2>
<p>Set as an agent's <code>llm_config</code> provider or as <code>config.default_llm_provider</code>: <code>openai</code>, <code>anthropic</code>, <code>google</code>, <code>azure</code>, <code>ollama</code>, and:</p>
<table>
<thead><tr><th>Provider</th><th>Notes</th></tr></thead>
<tbody>
<tr><td><code>openai_compatible</code></td><td>Any OpenAI-format endpoint. Requires RCrewAI's <code>base_url</code>.</td></tr>
<tr><td><code>bedrock</code></td><td>AWS Bedrock via the Converse API. Requires <code>aws_region</code>.</td></tr>
<tr><td><code>snowflake</code></td><td>Snowflake Cortex inference. Requires <code>snowflake_account</code>.</td></tr>
<tr><td><code>openai_responses</code></td><td>OpenAI's Responses API. Non-streaming only.</td></tr>
</tbody>
</table>
<p class="caption">Current Claude models reject the temperature rcrewai sends by default, so set RCrewAI's temperature to nil to use them.</p>
</div>
</section>

<section>
<div class="wrap">
<h2>rcrewai 0.10</h2>
<p>Keep-alive streaming connections apply automatically to Anthropic agents that stream. <code>CancelToken</code>, per-call <code>chat(model:)</code>, and <code>cached_tokens</code> are not exposed by the engine: <code>Execution#cancel!</code> only updates the record's status and does not stop a running stream. Call an rcrewai client directly from your own code to use them.</p>
</div>
</section>

<footer>
<div class="wrap">
<p>
Expand Down
5 changes: 3 additions & 2 deletions docs/getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,9 @@ <h2>Configuration</h2>
config.default_memory_store = RCrewAI::Memory::SqliteStore.new(path: "db/rcrewai_memory.sqlite3")
end

# Configure the base RcrewAI gem
RcrewAI.configure do |config|
# Configure the base rcrewai gem (note the capital C).
# Keys in the environment are read automatically.
RCrewAI.configure(validate: false) do |config|
config.openai_api_key = ENV["OPENAI_API_KEY"]
end</pre>
</div>
Expand Down
26 changes: 21 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>RcrewAI Rails — AI agent crews for Rails</title>
<meta name="description" content="A Rails engine for orchestrating AI agents with ActiveRecord persistence, background jobs, generators, a web dashboard, and full rcrewai 0.7 feature coverage.">
<meta name="description" content="A Rails engine for orchestrating AI agents with ActiveRecord persistence, background jobs, generators, a web dashboard, built on rcrewai 0.10.">
<style>
:root {
--crimson: #c4221f;
Expand Down Expand Up @@ -156,7 +156,7 @@
<section class="hero">
<div class="wrap">
<h1>Build AI agent crews,<br><span class="accent">the Rails way.</span></h1>
<p class="lead">A Rails engine for orchestrating AI agents — with ActiveRecord persistence, background-job execution, generators, a web dashboard, and full rcrewai 0.7 feature coverage.</p>
<p class="lead">A Rails engine for orchestrating AI agents — with ActiveRecord persistence, background-job execution, generators, a web dashboard, built on rcrewai 0.10.</p>
<div class="install-line"><span class="prompt">gem </span>'rcrewai-rails'</div>
<div class="cta">
<a class="btn btn-primary" href="getting-started.html">Get Started</a>
Expand Down Expand Up @@ -193,7 +193,7 @@ <h3>Web Dashboard</h3>
<div class="feature">
<span class="ic">🤖</span>
<h3>Multi-LLM Support</h3>
<p>OpenAI GPT, Anthropic Claude, Google Gemini, Azure OpenAI, and Ollama.</p>
<p>OpenAI, Anthropic Claude, Google Gemini, Azure OpenAI, Ollama, AWS Bedrock, Snowflake Cortex, and any OpenAI-compatible endpoint.</p>
</div>
<div class="feature">
<span class="ic">🧰</span>
Expand All @@ -206,8 +206,8 @@ <h3>Rails-Specific Tools</h3>

<section>
<div class="wrap">
<h2>What's new <span class="badge">0.4 – 0.7</span></h2>
<p class="sub">Full parity with rcrewai 0.4–0.7, surfaced through ActiveRecord.</p>
<h2>What's new <span class="badge">0.4 – 0.10</span></h2>
<p class="sub">rcrewai features through 0.9, surfaced through ActiveRecord, on rcrewai 0.10.</p>
<div class="whatsnew">
<div class="wn-item">
<h4>Agent intelligence</h4>
Expand All @@ -233,6 +233,22 @@ <h4>Flows</h4>
<h4>Cognitive memory</h4>
<p>Semantic recall with a pluggable embedder and SQLite-backed store.</p>
</div>
<div class="wn-item">
<h4>Observation engine</h4>
<p>Span-level traces of every run, with timings, tokens, cost, and a live view.</p>
</div>
<div class="wn-item">
<h4>Checkpointing</h4>
<p>Resume an interrupted run without re-running the tasks it already finished.</p>
</div>
<div class="wn-item">
<h4>Interceptors and providers</h4>
<p>Hooks around every LLM request, plus Bedrock, Snowflake, and OpenAI-compatible endpoints.</p>
</div>
<div class="wn-item">
<h4>Concurrent tool calls</h4>
<p>A turn's tool calls run in parallel, with a per-agent opt-out.</p>
</div>
</div>
</div>
</section>
Expand Down
28 changes: 18 additions & 10 deletions lib/generators/rcrewai/rails/install/templates/rcrewai.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,25 @@
# config.observation_retention_days = 30
end

# Configure RcrewAI base gem if needed
RcrewAI.configure do |config|
# Set your API keys here or in environment variables
# config.openai_api_key = ENV["OPENAI_API_KEY"]
# config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
# config.groq_api_key = ENV["GROQ_API_KEY"]

# Configure other RcrewAI settings
# config.default_model = "gpt-4"
# config.temperature = 0.7
# Configure the base rcrewai gem if needed. Note the capital C: RCrewAI holds
# provider settings, while RcrewAI.configure below is this engine's configuration.
# validate: false stops a missing key from failing boot in places that don't call
# an LLM, such as assets:precompile.
RCrewAI.configure(validate: false) do |config|
# Keys are read from the environment (OPENAI_API_KEY, ANTHROPIC_API_KEY, ...)
# automatically, so set them here only if they come from somewhere else.
# config.openai_api_key = Rails.application.credentials.openai_api_key
# config.anthropic_api_key = Rails.application.credentials.anthropic_api_key

# config.openai_model = "gpt-4o"
# config.anthropic_model = "claude-opus-5-5"

# Current Claude models reject temperature, so leave it unset to use them.
# config.temperature = nil
end

# More engine settings. RcrewAI.configure is the same as RcrewAI::Rails.configure.
RcrewAI.configure do |config|
# --- Checkpointing (rcrewai 0.8+) -----------------------------------------
# Records durable per-task state during a crew run so an interrupted run can
# be resumed instead of re-executing (and re-paying for) completed tasks.
Expand Down
Loading
Loading