Skip to content

feat: support rcrewai 0.9 (concurrency) - #28

Merged
gkosmo merged 1 commit into
masterfrom
feat/rcrewai-0.9
Sep 10, 2026
Merged

gkosmo merged 1 commit into
masterfrom
feat/rcrewai-0.9

Conversation

@gkosmo

@gkosmo gkosmo commented Sep 10, 2026

Copy link
Copy Markdown
Owner

Tracks rcrewai 0.9.0, whose theme is concurrency: a turn's tool calls, consensus proposals/scoring, and embeddings now fan out across bounded thread pools. Additive, no API changes — the 0.8.1 suite passed against it untouched.

Why this needed real verification

0.9 emits tool events from worker threads. The observation collector attributes spans using the run span id that 0.8 introduced, so concurrency is precisely the case that could break it.

The gem handles it correctly: it captures Events.current_parent and re-establishes it inside each worker (Events.with_parent is thread-local by design). I confirmed this against the real gem rather than trusting the changelog — two 150ms tools in one turn finish in 155ms, not ~300ms, and every resulting event carries the correct parent_id, none nil.

Added collector specs for that shape:

  • interleaved starts and results, matched by call_id rather than arrival order
  • a failing tool not affecting its sibling
  • delivery from eight threads at once

SpanStack already guards its call-id map with a mutex, so no engine change was needed for correctness — but it's now covered by tests instead of assumed.

Added

rcrewai_agents.parallel_tools forwards parallel_tools: to RCrewAI::Agent. This is the one new knob users can't otherwise reach, since the engine builds agents from DB records. Use it for an agent whose tools aren't safe to run in parallel, or that must not fan out against a rate-limited API:

agent.update!(parallel_tools: false)

Nullable and only forwarded when explicitly set, so existing agents keep the gem's default (concurrency on).

Verification

268 examples, 0 failures, random order.

Upgrading

rails rcrew_ai_rails:install:migrations
rails db:migrate

One nullable column. Nothing changes until you set it.

🤖 Generated with Claude Code

https://claude.ai/code/session_0123Ahvp1Cd6DoAgfr5bsYm2

rcrewai 0.9.0's theme is concurrency: a turn's tool calls, consensus
proposals and scoring, and embeddings for providers without a batch
endpoint now fan out across bounded thread pools. It is additive with no
API changes, and the 0.8.1 suite passed against it untouched.

The part that matters to this engine is that tool events are now emitted
from worker threads. The observation collector attributes spans using the
run span id that 0.8 added, so concurrency is exactly the case that could
break it. The gem captures Events.current_parent and re-establishes it
inside each worker (Events.with_parent is thread-local by design), and a
probe against the real gem confirms it: two 150ms tools in one turn
finish in 155ms rather than ~300ms, and every resulting event carries the
correct parent_id with none nil.

Added collector specs for that shape - interleaved starts and results
matched by call_id rather than arrival order, a failing tool not
affecting its sibling, and delivery from eight threads at once. SpanStack
already guards its call-id map with a mutex, so no engine change was
needed for correctness.

Exposed the one new knob users cannot otherwise reach, since the engine
builds agents from DB records: rcrewai_agents.parallel_tools forwards
parallel_tools: to RCrewAI::Agent, for an agent whose tools are not safe
to run in parallel or that must not fan out against a rate-limited API.
Nullable and only forwarded when explicitly set, so existing agents keep
the gem's default.

268 examples, 0 failures.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0123Ahvp1Cd6DoAgfr5bsYm2
@gkosmo
gkosmo merged commit 448e108 into master Sep 10, 2026
3 checks passed
@gkosmo
gkosmo deleted the feat/rcrewai-0.9 branch September 10, 2026 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant