rcrewai 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +21 -0
  3. data/.rubocop_todo.yml +99 -0
  4. data/CHANGELOG.md +64 -1
  5. data/README.md +170 -2
  6. data/ROADMAP.md +84 -0
  7. data/Rakefile +53 -53
  8. data/bin/rcrewai +3 -3
  9. data/docs/mcp.md +109 -0
  10. data/docs/superpowers/plans/2026-05-11-llm-modernization.md +2753 -0
  11. data/docs/superpowers/specs/2026-05-11-llm-modernization-design.md +479 -0
  12. data/docs/upgrading-to-0.3.md +163 -0
  13. data/examples/async_execution_example.rb +82 -81
  14. data/examples/hierarchical_crew_example.rb +68 -72
  15. data/examples/human_in_the_loop_example.rb +73 -74
  16. data/examples/mcp_example.rb +48 -0
  17. data/examples/native_tools_example.rb +64 -0
  18. data/examples/streaming_example.rb +56 -0
  19. data/lib/rcrewai/agent.rb +181 -286
  20. data/lib/rcrewai/async_executor.rb +43 -43
  21. data/lib/rcrewai/cli.rb +11 -11
  22. data/lib/rcrewai/configuration.rb +34 -9
  23. data/lib/rcrewai/crew.rb +134 -39
  24. data/lib/rcrewai/events.rb +30 -0
  25. data/lib/rcrewai/flow/state.rb +47 -0
  26. data/lib/rcrewai/flow/state_store.rb +50 -0
  27. data/lib/rcrewai/flow.rb +243 -0
  28. data/lib/rcrewai/human_input.rb +104 -114
  29. data/lib/rcrewai/knowledge/base.rb +52 -0
  30. data/lib/rcrewai/knowledge/chunker.rb +31 -0
  31. data/lib/rcrewai/knowledge/embedder.rb +48 -0
  32. data/lib/rcrewai/knowledge/sources.rb +83 -0
  33. data/lib/rcrewai/knowledge/store.rb +58 -0
  34. data/lib/rcrewai/knowledge.rb +13 -0
  35. data/lib/rcrewai/legacy_react_runner.rb +172 -0
  36. data/lib/rcrewai/llm_client.rb +24 -1
  37. data/lib/rcrewai/llm_clients/anthropic.rb +174 -54
  38. data/lib/rcrewai/llm_clients/azure.rb +23 -128
  39. data/lib/rcrewai/llm_clients/base.rb +11 -7
  40. data/lib/rcrewai/llm_clients/google.rb +159 -95
  41. data/lib/rcrewai/llm_clients/ollama.rb +150 -106
  42. data/lib/rcrewai/llm_clients/openai.rb +140 -63
  43. data/lib/rcrewai/mcp/client.rb +101 -0
  44. data/lib/rcrewai/mcp/tool_adapter.rb +59 -0
  45. data/lib/rcrewai/mcp/transport/http.rb +53 -0
  46. data/lib/rcrewai/mcp/transport/stdio.rb +55 -0
  47. data/lib/rcrewai/mcp.rb +8 -0
  48. data/lib/rcrewai/memory.rb +45 -37
  49. data/lib/rcrewai/output_schema.rb +79 -0
  50. data/lib/rcrewai/planning.rb +65 -0
  51. data/lib/rcrewai/pricing.rb +34 -0
  52. data/lib/rcrewai/process.rb +86 -95
  53. data/lib/rcrewai/provider_schema.rb +38 -0
  54. data/lib/rcrewai/sse_parser.rb +55 -0
  55. data/lib/rcrewai/task.rb +145 -66
  56. data/lib/rcrewai/tool_runner.rb +132 -0
  57. data/lib/rcrewai/tool_schema.rb +97 -0
  58. data/lib/rcrewai/tools/base.rb +98 -37
  59. data/lib/rcrewai/tools/code_executor.rb +71 -74
  60. data/lib/rcrewai/tools/email_sender.rb +70 -78
  61. data/lib/rcrewai/tools/file_reader.rb +38 -30
  62. data/lib/rcrewai/tools/file_writer.rb +40 -38
  63. data/lib/rcrewai/tools/pdf_processor.rb +115 -130
  64. data/lib/rcrewai/tools/sql_database.rb +58 -55
  65. data/lib/rcrewai/tools/web_search.rb +26 -25
  66. data/lib/rcrewai/version.rb +2 -2
  67. data/lib/rcrewai.rb +20 -10
  68. data/rcrewai.gemspec +39 -39
  69. metadata +77 -47
data/bin/rcrewai CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
- require "bundler/setup"
5
- require "rcrewai"
4
+ require 'bundler/setup'
5
+ require 'rcrewai'
6
6
 
7
- RCrewAI::CLI.start(ARGV)
7
+ RCrewAI::CLI.start(ARGV)
data/docs/mcp.md ADDED
@@ -0,0 +1,109 @@
1
+ # MCP (Model Context Protocol) Support
2
+
3
+ RCrewAI 0.3 ships a minimal MCP client that lets your agents call tools
4
+ hosted by any MCP server — local processes (stdio) or remote services
5
+ (streamable HTTP) — without any custom adapter code.
6
+
7
+ ## What is MCP?
8
+
9
+ [MCP](https://modelcontextprotocol.io) is an open protocol for connecting
10
+ language models to tools and data sources. Servers expose tools via a
11
+ JSON-RPC schema; clients (like RCrewAI) connect, discover the tools, and
12
+ invoke them on the model's behalf.
13
+
14
+ The big win: any of the dozens of off-the-shelf MCP servers — filesystem,
15
+ git, Slack, Postgres, browser automation, custom internal tools — works
16
+ with RCrewAI without writing a single line of glue.
17
+
18
+ ## Connecting
19
+
20
+ ### Stdio (local subprocess)
21
+
22
+ ```ruby
23
+ require 'rcrewai'
24
+
25
+ RCrewAI::MCP::Client.with_connection(
26
+ command: "npx",
27
+ args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
28
+ ) do |client|
29
+ puts "connected to #{client.server_name}"
30
+ client.tools.each { |t| puts " - #{t.name}: #{t.description}" }
31
+ end
32
+ ```
33
+
34
+ ### Streamable HTTP (remote)
35
+
36
+ ```ruby
37
+ RCrewAI::MCP::Client.with_connection(
38
+ url: "https://mcp.example.com/v1",
39
+ headers: { "Authorization" => "Bearer #{ENV['MCP_TOKEN']}" }
40
+ ) do |client|
41
+ # ...
42
+ end
43
+ ```
44
+
45
+ ### Manual lifecycle
46
+
47
+ `with_connection` is the recommended form (auto-closes on block exit), but
48
+ you can also drive the lifecycle manually:
49
+
50
+ ```ruby
51
+ client = RCrewAI::MCP::Client.connect(command: "ruby", args: ["my_server.rb"])
52
+ # ... use client.tools ...
53
+ client.close
54
+ ```
55
+
56
+ ## Tool name prefix
57
+
58
+ To prevent collisions when an agent uses tools from multiple MCP servers,
59
+ tool names are prefixed with the server name:
60
+
61
+ ```
62
+ echo-server__echo
63
+ filesystem__read_file
64
+ filesystem__write_file
65
+ git__commit
66
+ ```
67
+
68
+ The prefix is `#{server_name}__#{tool_name}`, where `server_name` comes
69
+ from the server's own `serverInfo.name`.
70
+
71
+ ## Using MCP tools with an agent
72
+
73
+ MCP tools are ordinary `RCrewAI::Tools::Base` instances — pass them to
74
+ `Agent.new(tools: ...)` like any other tool:
75
+
76
+ ```ruby
77
+ RCrewAI::MCP::Client.with_connection(command: "npx", args: [...]) do |client|
78
+ agent = RCrewAI::Agent.new(
79
+ name: "fs_agent",
80
+ role: "Filesystem operator",
81
+ goal: "Read and summarize files",
82
+ tools: client.tools
83
+ )
84
+
85
+ task = RCrewAI::Task.new(name: "summarize",
86
+ description: "Read /tmp/notes.md and summarize",
87
+ agent: agent)
88
+ result = agent.execute_task(task)
89
+ puts result[:content]
90
+ end
91
+ ```
92
+
93
+ When `ToolRunner` (the new native-function-calling loop) is selected, the
94
+ LLM picks an MCP tool by name, RCrewAI dispatches the call to the MCP
95
+ server, threads the result back into the conversation, and continues.
96
+
97
+ ## What's not (yet) supported in 0.3
98
+
99
+ The 0.3 client is intentionally minimal — it covers `initialize`,
100
+ `tools/list`, `tools/call`, and the `notifications/initialized` handshake.
101
+ The following are not implemented:
102
+
103
+ - **Resources** (`resources/list`, `resources/read`)
104
+ - **Prompts** (`prompts/list`, `prompts/get`)
105
+ - **Server mode** — RCrewAI can be an MCP client, not yet an MCP server
106
+ - **OAuth** authentication for HTTP transports
107
+ - **Notifications other than `initialized`** (e.g., progress, log)
108
+
109
+ These will land in follow-up releases as the MCP spec stabilizes.