rcrewai-rails 0.1.1

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 (48) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +222 -0
  4. data/Rakefile +6 -0
  5. data/app/controllers/rcrewai/rails/application_controller.rb +17 -0
  6. data/app/controllers/rcrewai/rails/crews_controller.rb +67 -0
  7. data/app/controllers/rcrewai/rails/executions_controller.rb +65 -0
  8. data/app/jobs/rcrewai/rails/crew_execution_job.rb +82 -0
  9. data/app/jobs/rcrewai/rails/task_execution_job.rb +63 -0
  10. data/app/models/rcrewai/rails/agent.rb +58 -0
  11. data/app/models/rcrewai/rails/application_record.rb +8 -0
  12. data/app/models/rcrewai/rails/crew.rb +65 -0
  13. data/app/models/rcrewai/rails/execution.rb +98 -0
  14. data/app/models/rcrewai/rails/execution_log.rb +18 -0
  15. data/app/models/rcrewai/rails/task.rb +69 -0
  16. data/app/models/rcrewai/rails/task_assignment.rb +12 -0
  17. data/app/models/rcrewai/rails/task_dependency.rb +42 -0
  18. data/app/views/layouts/rcrewai/rails/application.html.erb +37 -0
  19. data/app/views/rcrewai/rails/crews/index.html.erb +42 -0
  20. data/app/views/rcrewai/rails/crews/show.html.erb +95 -0
  21. data/app/views/rcrewai/rails/executions/show.html.erb +92 -0
  22. data/config/routes.rb +50 -0
  23. data/lib/generators/rcrew_a_i/rails/crew/crew_generator.rb +42 -0
  24. data/lib/generators/rcrew_a_i/rails/crew/templates/agent.rb.erb +45 -0
  25. data/lib/generators/rcrew_a_i/rails/crew/templates/crew.rb.erb +72 -0
  26. data/lib/generators/rcrew_a_i/rails/install/install_generator.rb +40 -0
  27. data/lib/generators/rcrew_a_i/rails/install/templates/create_rcrewai_tables.rb +113 -0
  28. data/lib/generators/rcrew_a_i/rails/install/templates/rcrewai.rb +53 -0
  29. data/lib/generators/rcrewai/rails/crew/crew_generator.rb +42 -0
  30. data/lib/generators/rcrewai/rails/crew/templates/agent.rb.erb +45 -0
  31. data/lib/generators/rcrewai/rails/crew/templates/crew.rb.erb +72 -0
  32. data/lib/generators/rcrewai/rails/install/install_generator.rb +40 -0
  33. data/lib/generators/rcrewai/rails/install/templates/create_rcrewai_tables.rb +113 -0
  34. data/lib/generators/rcrewai/rails/install/templates/rcrewai.rb +53 -0
  35. data/lib/rcrewai/rails/agent_builder.rb +123 -0
  36. data/lib/rcrewai/rails/configuration.rb +22 -0
  37. data/lib/rcrewai/rails/crew_builder.rb +112 -0
  38. data/lib/rcrewai/rails/engine.rb +38 -0
  39. data/lib/rcrewai/rails/tools/action_mailer_tool.rb +60 -0
  40. data/lib/rcrewai/rails/tools/active_record_tool.rb +67 -0
  41. data/lib/rcrewai/rails/tools/active_storage_tool.rb +122 -0
  42. data/lib/rcrewai/rails/tools/rails_cache_tool.rb +69 -0
  43. data/lib/rcrewai/rails/tools/rails_logger_tool.rb +57 -0
  44. data/lib/rcrewai/rails/version.rb +5 -0
  45. data/lib/rcrewai/rails.rb +31 -0
  46. data/lib/rcrewai-rails.rb +1 -0
  47. data/rcrewai-rails.gemspec +48 -0
  48. metadata +261 -0
@@ -0,0 +1,72 @@
1
+ class <%= class_name %>Crew
2
+ include RcrewAI::Rails::CrewBuilder
3
+
4
+ def initialize
5
+ @crew = RcrewAI::Rails::Crew.create!(
6
+ name: "<%= file_name %>",
7
+ description: "<%= crew_description %>",
8
+ process_type: "<%= process_type %>",
9
+ verbose: true,
10
+ memory_enabled: false,
11
+ cache_enabled: true
12
+ )
13
+
14
+ setup_agents
15
+ setup_tasks
16
+ end
17
+
18
+ def execute(inputs = {})
19
+ # Execute asynchronously via ActiveJob
20
+ @crew.execute_async(inputs)
21
+
22
+ # Or execute synchronously:
23
+ # @crew.execute_sync(inputs)
24
+ end
25
+
26
+ private
27
+
28
+ def setup_agents
29
+ # Define your agents here
30
+ # Example:
31
+ # @researcher = @crew.agents.create!(
32
+ # name: "researcher",
33
+ # role: "Senior Research Analyst",
34
+ # goal: "Uncover cutting-edge developments in AI and data science",
35
+ # backstory: "You are an expert researcher with years of experience",
36
+ # verbose: true,
37
+ # allow_delegation: false
38
+ # )
39
+ <% options[:agents].each do |agent_name| %>
40
+
41
+ @<%= agent_name.underscore %> = @crew.agents.create!(
42
+ name: "<%= agent_name.underscore %>",
43
+ role: "<%= agent_name.humanize %> Agent",
44
+ goal: "Perform <%= agent_name.humanize.downcase %> tasks",
45
+ backstory: "You are an expert <%= agent_name.humanize.downcase %> agent",
46
+ verbose: true,
47
+ allow_delegation: false
48
+ )
49
+ <% end %>
50
+ end
51
+
52
+ def setup_tasks
53
+ # Define your tasks here
54
+ # Example:
55
+ # @research_task = @crew.tasks.create!(
56
+ # description: "Research the latest AI trends",
57
+ # expected_output: "A comprehensive report on AI trends",
58
+ # position: 1
59
+ # )
60
+ # @research_task.agents << @researcher
61
+
62
+ # Task dependencies can be set like:
63
+ # @analysis_task.add_dependency(@research_task)
64
+ end
65
+
66
+ # Add any helper methods here
67
+
68
+ # Example callback for task completion:
69
+ # def task_completed(output)
70
+ # Rails.logger.info "Task completed with output: #{output}"
71
+ # end
72
+ end
@@ -0,0 +1,40 @@
1
+ require "rails/generators"
2
+ require "rails/generators/migration"
3
+
4
+ module RcrewAI
5
+ module Rails
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+ include ::Rails::Generators::Migration
9
+
10
+ source_root File.expand_path("templates", __dir__)
11
+
12
+ def self.next_migration_number(dirname)
13
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
14
+ end
15
+
16
+ def create_migration_file
17
+ migration_template "create_rcrewai_tables.rb", "db/migrate/create_rcrewai_tables.rb"
18
+ end
19
+
20
+ def create_initializer
21
+ template "rcrewai.rb", "config/initializers/rcrewai.rb"
22
+ end
23
+
24
+ def add_routes
25
+ route "mount RcrewAI::Rails::Engine => '/rcrewai'"
26
+ end
27
+
28
+ def display_post_install_message
29
+ say "\n✅ RcrewAI Rails has been installed!", :green
30
+ say "\nNext steps:", :yellow
31
+ say " 1. Run migrations: rails db:migrate"
32
+ say " 2. Configure your settings in config/initializers/rcrewai.rb"
33
+ say " 3. Set your LLM API keys in environment variables"
34
+ say " 4. Visit /rcrewai for the web UI (if enabled)"
35
+ say "\n"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,113 @@
1
+ class CreateRcrewaiTables < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :rcrewai_crews do |t|
4
+ t.string :name, null: false
5
+ t.text :description
6
+ t.string :process_type, default: "sequential"
7
+ t.boolean :verbose, default: false
8
+ t.boolean :memory_enabled, default: false
9
+ t.boolean :cache_enabled, default: false
10
+ t.integer :max_rpm
11
+ t.string :manager_llm
12
+ t.text :config
13
+ t.text :memory
14
+ t.boolean :active, default: true
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :rcrewai_crews, :name
20
+ add_index :rcrewai_crews, :active
21
+
22
+ create_table :rcrewai_agents do |t|
23
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
24
+ t.string :name, null: false
25
+ t.string :role, null: false
26
+ t.text :goal
27
+ t.text :backstory
28
+ t.boolean :memory_enabled, default: false
29
+ t.boolean :verbose, default: false
30
+ t.boolean :allow_delegation, default: false
31
+ t.text :tools
32
+ t.integer :max_iterations, default: 25
33
+ t.integer :max_rpm
34
+ t.text :llm_config
35
+ t.boolean :active, default: true
36
+
37
+ t.timestamps
38
+ end
39
+
40
+ add_index :rcrewai_agents, :crew_id
41
+ add_index :rcrewai_agents, :name
42
+
43
+ create_table :rcrewai_tasks do |t|
44
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
45
+ t.text :description, null: false
46
+ t.text :expected_output, null: false
47
+ t.boolean :async_execution, default: false
48
+ t.text :context
49
+ t.text :output_json
50
+ t.text :output_pydantic
51
+ t.string :output_file
52
+ t.text :tools
53
+ t.string :callback_class
54
+ t.string :callback_method_name
55
+ t.integer :position
56
+
57
+ t.timestamps
58
+ end
59
+
60
+ add_index :rcrewai_tasks, :crew_id
61
+ add_index :rcrewai_tasks, :position
62
+
63
+ create_table :rcrewai_task_assignments do |t|
64
+ t.references :task, null: false, foreign_key: { to_table: :rcrewai_tasks }
65
+ t.references :agent, null: false, foreign_key: { to_table: :rcrewai_agents }
66
+
67
+ t.timestamps
68
+ end
69
+
70
+ add_index :rcrewai_task_assignments, [:task_id, :agent_id], unique: true
71
+
72
+ create_table :rcrewai_task_dependencies do |t|
73
+ t.references :task, null: false, foreign_key: { to_table: :rcrewai_tasks }
74
+ t.references :dependency, null: false, foreign_key: { to_table: :rcrewai_tasks }
75
+
76
+ t.timestamps
77
+ end
78
+
79
+ add_index :rcrewai_task_dependencies, [:task_id, :dependency_id], unique: true
80
+
81
+ create_table :rcrewai_executions do |t|
82
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
83
+ t.string :status, null: false
84
+ t.text :inputs
85
+ t.text :output
86
+ t.string :error_message
87
+ t.text :error_details
88
+ t.datetime :started_at
89
+ t.datetime :completed_at
90
+ t.integer :duration_seconds
91
+
92
+ t.timestamps
93
+ end
94
+
95
+ add_index :rcrewai_executions, :crew_id
96
+ add_index :rcrewai_executions, :status
97
+ add_index :rcrewai_executions, :created_at
98
+
99
+ create_table :rcrewai_execution_logs do |t|
100
+ t.references :execution, null: false, foreign_key: { to_table: :rcrewai_executions }
101
+ t.string :level, null: false
102
+ t.text :message, null: false
103
+ t.text :details
104
+ t.datetime :timestamp, null: false
105
+
106
+ t.timestamps
107
+ end
108
+
109
+ add_index :rcrewai_execution_logs, :execution_id
110
+ add_index :rcrewai_execution_logs, :level
111
+ add_index :rcrewai_execution_logs, :timestamp
112
+ end
113
+ end
@@ -0,0 +1,53 @@
1
+ RcrewAI::Rails.configure do |config|
2
+ # ActiveJob queue name for background processing
3
+ # Default: "default"
4
+ config.job_queue_name = ENV.fetch("RCREWAI_QUEUE", "default")
5
+
6
+ # Enable web UI for monitoring crews
7
+ # Default: true
8
+ config.enable_web_ui = ENV.fetch("RCREWAI_WEB_UI", "true") == "true"
9
+
10
+ # Use ActiveJob for async execution
11
+ # Default: true
12
+ config.async_execution = ENV.fetch("RCREWAI_ASYNC", "true") == "true"
13
+
14
+ # Persistence backend (currently only :active_record supported)
15
+ # Default: :active_record
16
+ config.persistence_backend = :active_record
17
+
18
+ # Default LLM provider
19
+ # Options: "openai", "anthropic", "cohere", "groq", etc.
20
+ config.default_llm_provider = ENV.fetch("RCREWAI_LLM_PROVIDER", "openai")
21
+
22
+ # Default LLM model
23
+ config.default_llm_model = ENV.fetch("RCREWAI_LLM_MODEL", "gpt-4")
24
+
25
+ # Maximum retries for failed tasks
26
+ # Default: 3
27
+ config.max_retries = 3
28
+
29
+ # Timeout for crew execution (in seconds)
30
+ # Default: 300 (5 minutes)
31
+ config.timeout = 300
32
+
33
+ # Enable logging
34
+ # Default: true
35
+ config.enable_logging = true
36
+
37
+ # Log level
38
+ # Options: :debug, :info, :warn, :error
39
+ # Default: :info
40
+ config.log_level = :info
41
+ end
42
+
43
+ # Configure RcrewAI base gem if needed
44
+ RcrewAI.configure do |config|
45
+ # Set your API keys here or in environment variables
46
+ # config.openai_api_key = ENV["OPENAI_API_KEY"]
47
+ # config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
48
+ # config.groq_api_key = ENV["GROQ_API_KEY"]
49
+
50
+ # Configure other RcrewAI settings
51
+ # config.default_model = "gpt-4"
52
+ # config.temperature = 0.7
53
+ end
@@ -0,0 +1,42 @@
1
+ require "rails/generators"
2
+
3
+ module RcrewAI
4
+ module Rails
5
+ module Generators
6
+ class CrewGenerator < ::Rails::Generators::NamedBase
7
+ source_root File.expand_path("templates", __dir__)
8
+
9
+ argument :process_type, type: :string, default: "sequential", banner: "sequential|hierarchical"
10
+
11
+ class_option :agents, type: :array, default: [], desc: "List of agents to create"
12
+ class_option :description, type: :string, desc: "Crew description"
13
+
14
+ def create_crew_file
15
+ template "crew.rb.erb", "app/crews/#{file_name}_crew.rb"
16
+ end
17
+
18
+ def create_agent_files
19
+ options[:agents].each do |agent_name|
20
+ @agent_name = agent_name
21
+ template "agent.rb.erb", "app/crews/agents/#{agent_name.underscore}_agent.rb"
22
+ end
23
+ end
24
+
25
+ def display_next_steps
26
+ say "\n✅ Created #{class_name}Crew!", :green
27
+ say "\nNext steps:", :yellow
28
+ say " 1. Configure your crew in app/crews/#{file_name}_crew.rb"
29
+ say " 2. Define tasks for your crew"
30
+ say " 3. Run your crew with: #{class_name}Crew.new.execute"
31
+ say "\n"
32
+ end
33
+
34
+ private
35
+
36
+ def crew_description
37
+ options[:description] || "#{class_name} crew for AI task orchestration"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,45 @@
1
+ class <%= @agent_name.camelize %>Agent
2
+ include RcrewAI::Rails::AgentBuilder
3
+
4
+ def initialize
5
+ @agent = RcrewAI::Agent.new(
6
+ role: role,
7
+ goal: goal,
8
+ backstory: backstory,
9
+ memory: true,
10
+ verbose: true,
11
+ allow_delegation: false,
12
+ tools: tools,
13
+ max_iter: 25,
14
+ max_rpm: 10
15
+ )
16
+ end
17
+
18
+ def role
19
+ "<%= @agent_name.humanize %> Specialist"
20
+ end
21
+
22
+ def goal
23
+ "Perform <%= @agent_name.humanize.downcase %> tasks efficiently and accurately"
24
+ end
25
+
26
+ def backstory
27
+ <<~BACKSTORY
28
+ You are a highly skilled <%= @agent_name.humanize.downcase %> specialist with extensive experience.
29
+ Your expertise allows you to handle complex <%= @agent_name.humanize.downcase %> challenges effectively.
30
+ BACKSTORY
31
+ end
32
+
33
+ def tools
34
+ [
35
+ # Add your tools here
36
+ # RcrewAI::Tools::WebSearch.new,
37
+ # RcrewAI::Tools::FileReader.new,
38
+ # CustomTool.new
39
+ ]
40
+ end
41
+
42
+ def to_agent
43
+ @agent
44
+ end
45
+ end
@@ -0,0 +1,72 @@
1
+ class <%= class_name %>Crew
2
+ include RcrewAI::Rails::CrewBuilder
3
+
4
+ def initialize
5
+ @crew = RcrewAI::Rails::Crew.create!(
6
+ name: "<%= file_name %>",
7
+ description: "<%= crew_description %>",
8
+ process_type: "<%= process_type %>",
9
+ verbose: true,
10
+ memory_enabled: false,
11
+ cache_enabled: true
12
+ )
13
+
14
+ setup_agents
15
+ setup_tasks
16
+ end
17
+
18
+ def execute(inputs = {})
19
+ # Execute asynchronously via ActiveJob
20
+ @crew.execute_async(inputs)
21
+
22
+ # Or execute synchronously:
23
+ # @crew.execute_sync(inputs)
24
+ end
25
+
26
+ private
27
+
28
+ def setup_agents
29
+ # Define your agents here
30
+ # Example:
31
+ # @researcher = @crew.agents.create!(
32
+ # name: "researcher",
33
+ # role: "Senior Research Analyst",
34
+ # goal: "Uncover cutting-edge developments in AI and data science",
35
+ # backstory: "You are an expert researcher with years of experience",
36
+ # verbose: true,
37
+ # allow_delegation: false
38
+ # )
39
+ <% options[:agents].each do |agent_name| %>
40
+
41
+ @<%= agent_name.underscore %> = @crew.agents.create!(
42
+ name: "<%= agent_name.underscore %>",
43
+ role: "<%= agent_name.humanize %> Agent",
44
+ goal: "Perform <%= agent_name.humanize.downcase %> tasks",
45
+ backstory: "You are an expert <%= agent_name.humanize.downcase %> agent",
46
+ verbose: true,
47
+ allow_delegation: false
48
+ )
49
+ <% end %>
50
+ end
51
+
52
+ def setup_tasks
53
+ # Define your tasks here
54
+ # Example:
55
+ # @research_task = @crew.tasks.create!(
56
+ # description: "Research the latest AI trends",
57
+ # expected_output: "A comprehensive report on AI trends",
58
+ # position: 1
59
+ # )
60
+ # @research_task.agents << @researcher
61
+
62
+ # Task dependencies can be set like:
63
+ # @analysis_task.add_dependency(@research_task)
64
+ end
65
+
66
+ # Add any helper methods here
67
+
68
+ # Example callback for task completion:
69
+ # def task_completed(output)
70
+ # Rails.logger.info "Task completed with output: #{output}"
71
+ # end
72
+ end
@@ -0,0 +1,40 @@
1
+ require "rails/generators"
2
+ require "rails/generators/migration"
3
+
4
+ module RcrewAI
5
+ module Rails
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+ include ::Rails::Generators::Migration
9
+
10
+ source_root File.expand_path("templates", __dir__)
11
+
12
+ def self.next_migration_number(dirname)
13
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
14
+ end
15
+
16
+ def create_migration_file
17
+ migration_template "create_rcrewai_tables.rb", "db/migrate/create_rcrewai_tables.rb"
18
+ end
19
+
20
+ def create_initializer
21
+ template "rcrewai.rb", "config/initializers/rcrewai.rb"
22
+ end
23
+
24
+ def add_routes
25
+ route "mount RcrewAI::Rails::Engine => '/rcrewai'"
26
+ end
27
+
28
+ def display_post_install_message
29
+ say "\n✅ RcrewAI Rails has been installed!", :green
30
+ say "\nNext steps:", :yellow
31
+ say " 1. Run migrations: rails db:migrate"
32
+ say " 2. Configure your settings in config/initializers/rcrewai.rb"
33
+ say " 3. Set your LLM API keys in environment variables"
34
+ say " 4. Visit /rcrewai for the web UI (if enabled)"
35
+ say "\n"
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,113 @@
1
+ class CreateRcrewaiTables < ActiveRecord::Migration[7.0]
2
+ def change
3
+ create_table :rcrewai_crews do |t|
4
+ t.string :name, null: false
5
+ t.text :description
6
+ t.string :process_type, default: "sequential"
7
+ t.boolean :verbose, default: false
8
+ t.boolean :memory_enabled, default: false
9
+ t.boolean :cache_enabled, default: false
10
+ t.integer :max_rpm
11
+ t.string :manager_llm
12
+ t.text :config
13
+ t.text :memory
14
+ t.boolean :active, default: true
15
+
16
+ t.timestamps
17
+ end
18
+
19
+ add_index :rcrewai_crews, :name
20
+ add_index :rcrewai_crews, :active
21
+
22
+ create_table :rcrewai_agents do |t|
23
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
24
+ t.string :name, null: false
25
+ t.string :role, null: false
26
+ t.text :goal
27
+ t.text :backstory
28
+ t.boolean :memory_enabled, default: false
29
+ t.boolean :verbose, default: false
30
+ t.boolean :allow_delegation, default: false
31
+ t.text :tools
32
+ t.integer :max_iterations, default: 25
33
+ t.integer :max_rpm
34
+ t.text :llm_config
35
+ t.boolean :active, default: true
36
+
37
+ t.timestamps
38
+ end
39
+
40
+ add_index :rcrewai_agents, :crew_id
41
+ add_index :rcrewai_agents, :name
42
+
43
+ create_table :rcrewai_tasks do |t|
44
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
45
+ t.text :description, null: false
46
+ t.text :expected_output, null: false
47
+ t.boolean :async_execution, default: false
48
+ t.text :context
49
+ t.text :output_json
50
+ t.text :output_pydantic
51
+ t.string :output_file
52
+ t.text :tools
53
+ t.string :callback_class
54
+ t.string :callback_method_name
55
+ t.integer :position
56
+
57
+ t.timestamps
58
+ end
59
+
60
+ add_index :rcrewai_tasks, :crew_id
61
+ add_index :rcrewai_tasks, :position
62
+
63
+ create_table :rcrewai_task_assignments do |t|
64
+ t.references :task, null: false, foreign_key: { to_table: :rcrewai_tasks }
65
+ t.references :agent, null: false, foreign_key: { to_table: :rcrewai_agents }
66
+
67
+ t.timestamps
68
+ end
69
+
70
+ add_index :rcrewai_task_assignments, [:task_id, :agent_id], unique: true
71
+
72
+ create_table :rcrewai_task_dependencies do |t|
73
+ t.references :task, null: false, foreign_key: { to_table: :rcrewai_tasks }
74
+ t.references :dependency, null: false, foreign_key: { to_table: :rcrewai_tasks }
75
+
76
+ t.timestamps
77
+ end
78
+
79
+ add_index :rcrewai_task_dependencies, [:task_id, :dependency_id], unique: true
80
+
81
+ create_table :rcrewai_executions do |t|
82
+ t.references :crew, null: false, foreign_key: { to_table: :rcrewai_crews }
83
+ t.string :status, null: false
84
+ t.text :inputs
85
+ t.text :output
86
+ t.string :error_message
87
+ t.text :error_details
88
+ t.datetime :started_at
89
+ t.datetime :completed_at
90
+ t.integer :duration_seconds
91
+
92
+ t.timestamps
93
+ end
94
+
95
+ add_index :rcrewai_executions, :crew_id
96
+ add_index :rcrewai_executions, :status
97
+ add_index :rcrewai_executions, :created_at
98
+
99
+ create_table :rcrewai_execution_logs do |t|
100
+ t.references :execution, null: false, foreign_key: { to_table: :rcrewai_executions }
101
+ t.string :level, null: false
102
+ t.text :message, null: false
103
+ t.text :details
104
+ t.datetime :timestamp, null: false
105
+
106
+ t.timestamps
107
+ end
108
+
109
+ add_index :rcrewai_execution_logs, :execution_id
110
+ add_index :rcrewai_execution_logs, :level
111
+ add_index :rcrewai_execution_logs, :timestamp
112
+ end
113
+ end
@@ -0,0 +1,53 @@
1
+ RcrewAI::Rails.configure do |config|
2
+ # ActiveJob queue name for background processing
3
+ # Default: "default"
4
+ config.job_queue_name = ENV.fetch("RCREWAI_QUEUE", "default")
5
+
6
+ # Enable web UI for monitoring crews
7
+ # Default: true
8
+ config.enable_web_ui = ENV.fetch("RCREWAI_WEB_UI", "true") == "true"
9
+
10
+ # Use ActiveJob for async execution
11
+ # Default: true
12
+ config.async_execution = ENV.fetch("RCREWAI_ASYNC", "true") == "true"
13
+
14
+ # Persistence backend (currently only :active_record supported)
15
+ # Default: :active_record
16
+ config.persistence_backend = :active_record
17
+
18
+ # Default LLM provider
19
+ # Options: "openai", "anthropic", "cohere", "groq", etc.
20
+ config.default_llm_provider = ENV.fetch("RCREWAI_LLM_PROVIDER", "openai")
21
+
22
+ # Default LLM model
23
+ config.default_llm_model = ENV.fetch("RCREWAI_LLM_MODEL", "gpt-4")
24
+
25
+ # Maximum retries for failed tasks
26
+ # Default: 3
27
+ config.max_retries = 3
28
+
29
+ # Timeout for crew execution (in seconds)
30
+ # Default: 300 (5 minutes)
31
+ config.timeout = 300
32
+
33
+ # Enable logging
34
+ # Default: true
35
+ config.enable_logging = true
36
+
37
+ # Log level
38
+ # Options: :debug, :info, :warn, :error
39
+ # Default: :info
40
+ config.log_level = :info
41
+ end
42
+
43
+ # Configure RcrewAI base gem if needed
44
+ RcrewAI.configure do |config|
45
+ # Set your API keys here or in environment variables
46
+ # config.openai_api_key = ENV["OPENAI_API_KEY"]
47
+ # config.anthropic_api_key = ENV["ANTHROPIC_API_KEY"]
48
+ # config.groq_api_key = ENV["GROQ_API_KEY"]
49
+
50
+ # Configure other RcrewAI settings
51
+ # config.default_model = "gpt-4"
52
+ # config.temperature = 0.7
53
+ end