rcrewai 0.10.0 → 0.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -0
- data/README.md +133 -23
- data/ROADMAP.md +1 -1
- data/docs/api/agent.md +5 -2
- data/docs/api/configuration.md +36 -41
- data/docs/api/crew.md +34 -48
- data/docs/api/index.md +7 -0
- data/docs/api/task.md +10 -91
- data/docs/api/tools.md +19 -0
- data/docs/examples/api-integration.md +4 -4
- data/docs/examples/async-execution.md +4 -4
- data/docs/examples/code-review-crew.md +1 -1
- data/docs/examples/content-marketing-pipeline.md +3 -3
- data/docs/examples/custom-tools.md +8 -8
- data/docs/examples/customer-support.md +5 -5
- data/docs/examples/data-analysis-team.md +4 -4
- data/docs/examples/database-operations.md +4 -4
- data/docs/examples/ecommerce-operations.md +4 -4
- data/docs/examples/financial-analysis.md +3 -3
- data/docs/examples/hierarchical-crew.md +3 -2
- data/docs/examples/production-ready-crew.md +16 -10
- data/docs/examples/research-development.md +5 -5
- data/docs/examples/simple-research-crew.md +2 -2
- data/docs/examples/social-media.md +4 -4
- data/docs/examples/task-automation.md +2 -2
- data/docs/examples/tool-composition.md +42 -27
- data/docs/examples/web-scraping.md +6 -6
- data/docs/index.md +61 -44
- data/docs/tutorials/advanced-agents.md +194 -917
- data/docs/tutorials/agent-options.md +1 -1
- data/docs/tutorials/checkpointing.md +65 -0
- data/docs/tutorials/concurrency.md +57 -0
- data/docs/tutorials/custom-tools.md +198 -1143
- data/docs/tutorials/deployment.md +156 -155
- data/docs/tutorials/getting-started.md +69 -81
- data/docs/tutorials/index.md +19 -0
- data/docs/tutorials/interceptors-and-events.md +84 -0
- data/docs/tutorials/live-streaming.md +52 -0
- data/docs/tutorials/multiple-crews.md +70 -51
- data/docs/tutorials/providers.md +115 -0
- data/docs/upgrading-to-0.11.md +55 -0
- data/lib/rcrewai/agent.rb +0 -2
- data/lib/rcrewai/configuration.rb +64 -29
- data/lib/rcrewai/context_window.rb +12 -2
- data/lib/rcrewai/llm_clients/anthropic.rb +60 -9
- data/lib/rcrewai/llm_clients/base.rb +7 -0
- data/lib/rcrewai/llm_clients/bedrock.rb +29 -2
- data/lib/rcrewai/llm_clients/google.rb +36 -4
- data/lib/rcrewai/llm_clients/ollama.rb +17 -3
- data/lib/rcrewai/llm_clients/openai.rb +14 -1
- data/lib/rcrewai/llm_clients/openai_responses.rb +21 -2
- data/lib/rcrewai/pricing.rb +13 -3
- data/lib/rcrewai/tool_runner.rb +5 -1
- data/lib/rcrewai/version.rb +1 -1
- metadata +7 -1
|
@@ -36,7 +36,7 @@ end
|
|
|
36
36
|
# Product Catalog Management Tool
|
|
37
37
|
class ProductCatalogTool < RCrewAI::Tools::Base
|
|
38
38
|
def initialize(**options)
|
|
39
|
-
super
|
|
39
|
+
super()
|
|
40
40
|
@name = 'product_catalog_manager'
|
|
41
41
|
@description = 'Manage product listings, descriptions, and catalog optimization'
|
|
42
42
|
@product_database = {}
|
|
@@ -129,7 +129,7 @@ end
|
|
|
129
129
|
# Inventory Management Tool
|
|
130
130
|
class InventoryManagementTool < RCrewAI::Tools::Base
|
|
131
131
|
def initialize(**options)
|
|
132
|
-
super
|
|
132
|
+
super()
|
|
133
133
|
@name = 'inventory_manager'
|
|
134
134
|
@description = 'Manage inventory levels, demand forecasting, and supplier relationships'
|
|
135
135
|
@inventory_data = {}
|
|
@@ -216,7 +216,7 @@ end
|
|
|
216
216
|
# Pricing Strategy Tool
|
|
217
217
|
class PricingStrategyTool < RCrewAI::Tools::Base
|
|
218
218
|
def initialize(**options)
|
|
219
|
-
super
|
|
219
|
+
super()
|
|
220
220
|
@name = 'pricing_strategist'
|
|
221
221
|
@description = 'Optimize pricing strategies and competitive positioning'
|
|
222
222
|
end
|
|
@@ -576,7 +576,7 @@ results[:results].each do |ops_result|
|
|
|
576
576
|
if ops_result[:status] == :completed
|
|
577
577
|
puts " Optimization: Successfully completed"
|
|
578
578
|
else
|
|
579
|
-
puts " Issue: #{ops_result[:
|
|
579
|
+
puts " Issue: #{ops_result[:result]}"
|
|
580
580
|
end
|
|
581
581
|
puts
|
|
582
582
|
end
|
|
@@ -36,7 +36,7 @@ end
|
|
|
36
36
|
# Financial Data Parser Tool
|
|
37
37
|
class FinancialDataTool < RCrewAI::Tools::Base
|
|
38
38
|
def initialize(**options)
|
|
39
|
-
super
|
|
39
|
+
super()
|
|
40
40
|
@name = 'financial_data_parser'
|
|
41
41
|
@description = 'Parse and analyze financial data from various sources'
|
|
42
42
|
end
|
|
@@ -122,7 +122,7 @@ end
|
|
|
122
122
|
# Risk Calculation Tool
|
|
123
123
|
class RiskCalculationTool < RCrewAI::Tools::Base
|
|
124
124
|
def initialize(**options)
|
|
125
|
-
super
|
|
125
|
+
super()
|
|
126
126
|
@name = 'risk_calculator'
|
|
127
127
|
@description = 'Calculate various financial risk metrics'
|
|
128
128
|
end
|
|
@@ -493,7 +493,7 @@ results[:results].each do |analysis_result|
|
|
|
493
493
|
if analysis_result[:status] == :completed
|
|
494
494
|
puts " Analysis: Successfully completed"
|
|
495
495
|
else
|
|
496
|
-
puts " Error: #{analysis_result[:
|
|
496
|
+
puts " Error: #{analysis_result[:result]}"
|
|
497
497
|
end
|
|
498
498
|
puts
|
|
499
499
|
end
|
|
@@ -62,7 +62,6 @@ backend_developer = RCrewAI::Agent.new(
|
|
|
62
62
|
RCrewAI::Tools::WebSearch.new # For researching best practices
|
|
63
63
|
],
|
|
64
64
|
verbose: true,
|
|
65
|
-
max_execution_time: 600
|
|
66
65
|
)
|
|
67
66
|
|
|
68
67
|
frontend_developer = RCrewAI::Agent.new(
|
|
@@ -229,7 +228,7 @@ results[:results].each_with_index do |task_result, index|
|
|
|
229
228
|
if task_result[:status] == :completed
|
|
230
229
|
puts " Result preview: #{task_result[:result][0..100]}..."
|
|
231
230
|
else
|
|
232
|
-
puts " Error: #{task_result[:
|
|
231
|
+
puts " Error: #{task_result[:result]}"
|
|
233
232
|
end
|
|
234
233
|
puts
|
|
235
234
|
end
|
|
@@ -418,6 +417,7 @@ end
|
|
|
418
417
|
engineering_manager = RCrewAI::Agent.new(
|
|
419
418
|
name: "engineering_manager",
|
|
420
419
|
role: "Engineering Manager",
|
|
420
|
+
goal: "Coordinate engineering delivery",
|
|
421
421
|
manager: true,
|
|
422
422
|
allow_delegation: true
|
|
423
423
|
)
|
|
@@ -425,6 +425,7 @@ engineering_manager = RCrewAI::Agent.new(
|
|
|
425
425
|
product_manager = RCrewAI::Agent.new(
|
|
426
426
|
name: "product_manager",
|
|
427
427
|
role: "Product Manager",
|
|
428
|
+
goal: "Coordinate product priorities",
|
|
428
429
|
manager: true,
|
|
429
430
|
allow_delegation: true
|
|
430
431
|
)
|
|
@@ -29,6 +29,15 @@ require 'redis'
|
|
|
29
29
|
|
|
30
30
|
# ===== PRODUCTION CONFIGURATION =====
|
|
31
31
|
|
|
32
|
+
# Ruby's Logger takes one message, so structured fields are merged into it.
|
|
33
|
+
class StructuredLogger < Logger
|
|
34
|
+
%i[debug info warn error].each do |level|
|
|
35
|
+
define_method(level) do |message = nil, fields = nil, &block|
|
|
36
|
+
super(fields ? "#{message} #{fields.to_json}" : message, &block)
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
32
41
|
class ProductionConfig
|
|
33
42
|
def self.setup
|
|
34
43
|
# Environment-based configuration
|
|
@@ -47,6 +56,7 @@ class ProductionConfig
|
|
|
47
56
|
config.openai_api_key = ENV.fetch('OPENAI_API_KEY')
|
|
48
57
|
when :anthropic
|
|
49
58
|
config.anthropic_api_key = ENV.fetch('ANTHROPIC_API_KEY')
|
|
59
|
+
config.anthropic_model = 'claude-opus-5-5'
|
|
50
60
|
when :azure
|
|
51
61
|
config.azure_api_key = ENV.fetch('AZURE_OPENAI_API_KEY')
|
|
52
62
|
config.base_url = ENV.fetch('AZURE_OPENAI_ENDPOINT')
|
|
@@ -65,7 +75,7 @@ class ProductionConfig
|
|
|
65
75
|
private
|
|
66
76
|
|
|
67
77
|
def self.setup_logger
|
|
68
|
-
logger =
|
|
78
|
+
logger = StructuredLogger.new($stdout)
|
|
69
79
|
logger.level = ENV.fetch('LOG_LEVEL', 'INFO').upcase.constantize rescue Logger::INFO
|
|
70
80
|
logger.formatter = proc do |severity, datetime, progname, msg|
|
|
71
81
|
{
|
|
@@ -99,19 +109,19 @@ class ProductionAgent < RCrewAI::Agent
|
|
|
99
109
|
@start_time = nil
|
|
100
110
|
end
|
|
101
111
|
|
|
102
|
-
def execute_task(task)
|
|
112
|
+
def execute_task(task, **opts)
|
|
103
113
|
@start_time = Time.now
|
|
104
114
|
task_labels = { agent_name: name, task_name: task.name }
|
|
105
115
|
|
|
106
116
|
begin
|
|
107
117
|
@logger.info("Task execution started", task_labels)
|
|
108
118
|
|
|
109
|
-
result = super
|
|
119
|
+
result = super
|
|
110
120
|
|
|
111
121
|
duration = Time.now - @start_time
|
|
112
122
|
@logger.info("Task execution completed", task_labels.merge(
|
|
113
123
|
duration: duration,
|
|
114
|
-
result_length: result.length
|
|
124
|
+
result_length: result[:content].to_s.length
|
|
115
125
|
))
|
|
116
126
|
|
|
117
127
|
result
|
|
@@ -151,7 +161,6 @@ support_manager = ProductionAgent.new(
|
|
|
151
161
|
RCrewAI::Tools::FileWriter.new
|
|
152
162
|
],
|
|
153
163
|
verbose: ProductionConfig.env == 'development',
|
|
154
|
-
max_execution_time: 600
|
|
155
164
|
)
|
|
156
165
|
|
|
157
166
|
# Technical Support Specialist
|
|
@@ -166,7 +175,6 @@ tech_support = ProductionAgent.new(
|
|
|
166
175
|
RCrewAI::Tools::FileWriter.new
|
|
167
176
|
],
|
|
168
177
|
verbose: ProductionConfig.env == 'development',
|
|
169
|
-
max_execution_time: 900
|
|
170
178
|
)
|
|
171
179
|
|
|
172
180
|
# Add agents to crew
|
|
@@ -181,8 +189,7 @@ issue_analysis = RCrewAI::Task.new(
|
|
|
181
189
|
description: "Analyze incoming customer support tickets to categorize issues, assess severity, and determine initial response strategy.",
|
|
182
190
|
expected_output: "Structured analysis with issue categorization, severity assessment, and recommended response strategy",
|
|
183
191
|
async: true,
|
|
184
|
-
max_retries: 3
|
|
185
|
-
retry_delay: 10
|
|
192
|
+
max_retries: 3
|
|
186
193
|
)
|
|
187
194
|
|
|
188
195
|
# Technical Issue Resolution
|
|
@@ -407,8 +414,7 @@ health_status = HealthChecker.check_system_health
|
|
|
407
414
|
Automatic retry with backoff:
|
|
408
415
|
|
|
409
416
|
```ruby
|
|
410
|
-
max_retries: 3,
|
|
411
|
-
retry_delay: 10 # Increases on retry
|
|
417
|
+
max_retries: 3 # Waits 2, 4, then 8 seconds between attempts
|
|
412
418
|
```
|
|
413
419
|
|
|
414
420
|
### 4. **Execution Reports**
|
|
@@ -36,7 +36,7 @@ end
|
|
|
36
36
|
# Literature Review Tool
|
|
37
37
|
class LiteratureReviewTool < RCrewAI::Tools::Base
|
|
38
38
|
def initialize(**options)
|
|
39
|
-
super
|
|
39
|
+
super()
|
|
40
40
|
@name = 'literature_review_manager'
|
|
41
41
|
@description = 'Conduct comprehensive literature reviews and citation analysis'
|
|
42
42
|
@research_database = {}
|
|
@@ -188,7 +188,7 @@ end
|
|
|
188
188
|
# Research Methodology Tool
|
|
189
189
|
class ResearchMethodologyTool < RCrewAI::Tools::Base
|
|
190
190
|
def initialize(**options)
|
|
191
|
-
super
|
|
191
|
+
super()
|
|
192
192
|
@name = 'research_methodology_designer'
|
|
193
193
|
@description = 'Design research methodologies and experimental protocols'
|
|
194
194
|
end
|
|
@@ -329,7 +329,7 @@ end
|
|
|
329
329
|
# Data Analysis Tool
|
|
330
330
|
class ResearchAnalyticsTool < RCrewAI::Tools::Base
|
|
331
331
|
def initialize(**options)
|
|
332
|
-
super
|
|
332
|
+
super()
|
|
333
333
|
@name = 'research_analytics'
|
|
334
334
|
@description = 'Perform statistical analysis and interpretation of research data'
|
|
335
335
|
end
|
|
@@ -761,7 +761,7 @@ results[:results].each do |research_result|
|
|
|
761
761
|
if research_result[:status] == :completed
|
|
762
762
|
puts " Component: Successfully completed"
|
|
763
763
|
else
|
|
764
|
-
puts " Issue: #{research_result[:
|
|
764
|
+
puts " Issue: #{research_result[:result]}"
|
|
765
765
|
end
|
|
766
766
|
puts
|
|
767
767
|
end
|
|
@@ -1216,7 +1216,7 @@ Coordinated research across multiple domains:
|
|
|
1216
1216
|
### 5. **Evidence-Based Decision Making**
|
|
1217
1217
|
Data-driven research process:
|
|
1218
1218
|
|
|
1219
|
-
```
|
|
1219
|
+
```text
|
|
1220
1220
|
# Research workflow
|
|
1221
1221
|
Literature Review → Methodology Design → Protocol Development →
|
|
1222
1222
|
Statistical Planning → Documentation → Coordination & Quality Assurance
|
|
@@ -24,7 +24,7 @@ require 'rcrewai'
|
|
|
24
24
|
RCrewAI.configure do |config|
|
|
25
25
|
config.llm_provider = :openai # or :anthropic, :google, :azure
|
|
26
26
|
# API keys are loaded automatically from environment variables
|
|
27
|
-
config.openai_model = 'gpt-
|
|
27
|
+
config.openai_model = 'gpt-4o'
|
|
28
28
|
config.temperature = 0.1 # Lower = more consistent, Higher = more creative
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -108,7 +108,7 @@ require 'rcrewai'
|
|
|
108
108
|
RCrewAI.configure do |config|
|
|
109
109
|
config.llm_provider = :openai
|
|
110
110
|
config.api_key = ENV['OPENAI_API_KEY']
|
|
111
|
-
config.model = 'gpt-
|
|
111
|
+
config.model = 'gpt-4o'
|
|
112
112
|
end
|
|
113
113
|
```
|
|
114
114
|
|
|
@@ -36,7 +36,7 @@ end
|
|
|
36
36
|
# Social Media Content Tool
|
|
37
37
|
class SocialMediaContentTool < RCrewAI::Tools::Base
|
|
38
38
|
def initialize(**options)
|
|
39
|
-
super
|
|
39
|
+
super()
|
|
40
40
|
@name = 'social_media_content_manager'
|
|
41
41
|
@description = 'Create and optimize content for different social media platforms'
|
|
42
42
|
@platform_specs = {
|
|
@@ -154,7 +154,7 @@ end
|
|
|
154
154
|
# Social Media Analytics Tool
|
|
155
155
|
class SocialMediaAnalyticsTool < RCrewAI::Tools::Base
|
|
156
156
|
def initialize(**options)
|
|
157
|
-
super
|
|
157
|
+
super()
|
|
158
158
|
@name = 'social_media_analytics'
|
|
159
159
|
@description = 'Analyze social media performance and generate insights'
|
|
160
160
|
end
|
|
@@ -266,7 +266,7 @@ end
|
|
|
266
266
|
# Social Media Scheduling Tool
|
|
267
267
|
class SocialMediaSchedulerTool < RCrewAI::Tools::Base
|
|
268
268
|
def initialize(**options)
|
|
269
|
-
super
|
|
269
|
+
super()
|
|
270
270
|
@name = 'social_media_scheduler'
|
|
271
271
|
@description = 'Schedule and optimize social media post timing'
|
|
272
272
|
@schedule_queue = []
|
|
@@ -620,7 +620,7 @@ results[:results].each do |campaign_result|
|
|
|
620
620
|
if campaign_result[:status] == :completed
|
|
621
621
|
puts " Deliverable: Successfully completed"
|
|
622
622
|
else
|
|
623
|
-
puts " Issue: #{campaign_result[:
|
|
623
|
+
puts " Issue: #{campaign_result[:result]}"
|
|
624
624
|
end
|
|
625
625
|
puts
|
|
626
626
|
end
|
|
@@ -232,7 +232,7 @@ results[:results].each_with_index do |task_result, index|
|
|
|
232
232
|
if task_result[:status] == :completed
|
|
233
233
|
puts " Result: #{task_result[:result][0..100]}..."
|
|
234
234
|
else
|
|
235
|
-
puts " Error: #{task_result[:
|
|
235
|
+
puts " Error: #{task_result[:result]}"
|
|
236
236
|
end
|
|
237
237
|
puts
|
|
238
238
|
end
|
|
@@ -428,7 +428,7 @@ data_processing_task ∥ email_task
|
|
|
428
428
|
```
|
|
429
429
|
|
|
430
430
|
### Hub-and-Spoke Pattern
|
|
431
|
-
```
|
|
431
|
+
```text
|
|
432
432
|
# Multiple inputs feed into central processing
|
|
433
433
|
Task A ↘
|
|
434
434
|
Task B → Central Task → Output
|
|
@@ -35,11 +35,16 @@ end
|
|
|
35
35
|
# Base tool for common functionality
|
|
36
36
|
class CompositeToolBase < RCrewAI::Tools::Base
|
|
37
37
|
def initialize(**options)
|
|
38
|
-
super
|
|
38
|
+
super()
|
|
39
39
|
@context_store = {}
|
|
40
40
|
@tool_chain = []
|
|
41
41
|
end
|
|
42
42
|
|
|
43
|
+
# Agents invoke tools through #execute; these tools implement #call.
|
|
44
|
+
def execute(**params)
|
|
45
|
+
call(**params)
|
|
46
|
+
end
|
|
47
|
+
|
|
43
48
|
protected
|
|
44
49
|
|
|
45
50
|
def store_context(key, value)
|
|
@@ -810,6 +815,7 @@ end
|
|
|
810
815
|
|
|
811
816
|
# Agent Definitions
|
|
812
817
|
marketing_strategist = RCrewAI::Agent.new(
|
|
818
|
+
name: "marketing_strategist",
|
|
813
819
|
role: "Marketing Strategy Director",
|
|
814
820
|
goal: "Develop comprehensive marketing strategies using data-driven insights from composed tool workflows",
|
|
815
821
|
backstory: "You are an expert marketing strategist who excels at orchestrating multiple marketing tools to create powerful, data-driven campaigns. You understand how to leverage web analytics, social media data, content creation, and performance tracking tools in harmony to achieve maximum impact.",
|
|
@@ -818,6 +824,7 @@ marketing_strategist = RCrewAI::Agent.new(
|
|
|
818
824
|
)
|
|
819
825
|
|
|
820
826
|
content_specialist = RCrewAI::Agent.new(
|
|
827
|
+
name: "content_specialist",
|
|
821
828
|
role: "Content & SEO Specialist",
|
|
822
829
|
goal: "Create and optimize high-performing content by combining content generation with SEO optimization tools",
|
|
823
830
|
backstory: "You are a content creation expert who understands how to combine creative content generation with technical SEO optimization. You excel at using multiple tools together to create content that both engages audiences and ranks well in search engines.",
|
|
@@ -826,6 +833,7 @@ content_specialist = RCrewAI::Agent.new(
|
|
|
826
833
|
)
|
|
827
834
|
|
|
828
835
|
distribution_manager = RCrewAI::Agent.new(
|
|
836
|
+
name: "distribution_manager",
|
|
829
837
|
role: "Multi-Channel Distribution Manager",
|
|
830
838
|
goal: "Orchestrate content distribution across social media and email channels for maximum reach and engagement",
|
|
831
839
|
backstory: "You specialize in multi-channel content distribution, expertly combining social media publishing tools with email marketing systems. You understand how to adapt content for different platforms while maintaining consistent messaging.",
|
|
@@ -834,6 +842,7 @@ distribution_manager = RCrewAI::Agent.new(
|
|
|
834
842
|
)
|
|
835
843
|
|
|
836
844
|
performance_analyst = RCrewAI::Agent.new(
|
|
845
|
+
name: "performance_analyst",
|
|
837
846
|
role: "Marketing Performance Analyst",
|
|
838
847
|
goal: "Analyze campaign performance by combining data from all marketing channels and tools",
|
|
839
848
|
backstory: "You are a data analyst who excels at combining insights from web analytics, social media metrics, and campaign tracking tools. You provide actionable insights by correlating data across multiple tool outputs.",
|
|
@@ -842,6 +851,7 @@ performance_analyst = RCrewAI::Agent.new(
|
|
|
842
851
|
)
|
|
843
852
|
|
|
844
853
|
automation_architect = RCrewAI::Agent.new(
|
|
854
|
+
name: "automation_architect",
|
|
845
855
|
role: "Marketing Automation Architect",
|
|
846
856
|
goal: "Design and implement automated marketing workflows using tool composition patterns",
|
|
847
857
|
backstory: "You are an automation expert who designs sophisticated marketing workflows by composing multiple tools together. You understand how to create efficient, scalable automation systems that leverage the strengths of different marketing tools.",
|
|
@@ -850,6 +860,7 @@ automation_architect = RCrewAI::Agent.new(
|
|
|
850
860
|
)
|
|
851
861
|
|
|
852
862
|
campaign_coordinator = RCrewAI::Agent.new(
|
|
863
|
+
name: "campaign_coordinator",
|
|
853
864
|
role: "Campaign Coordination Specialist",
|
|
854
865
|
goal: "Coordinate complex marketing campaigns by ensuring seamless tool integration and workflow execution",
|
|
855
866
|
backstory: "You excel at coordinating complex marketing campaigns that require multiple tools working in harmony. You ensure that data flows properly between tools and that each tool's output enhances the effectiveness of subsequent tools in the workflow.",
|
|
@@ -859,6 +870,7 @@ campaign_coordinator = RCrewAI::Agent.new(
|
|
|
859
870
|
|
|
860
871
|
# Task Definitions
|
|
861
872
|
strategy_development_task = RCrewAI::Task.new(
|
|
873
|
+
name: "strategy_development",
|
|
862
874
|
description: "Develop a comprehensive marketing strategy for a SaaS product targeting small businesses. Use tool composition to:
|
|
863
875
|
1. Analyze current market performance using web and social analytics
|
|
864
876
|
2. Generate content strategies based on analytics insights
|
|
@@ -872,6 +884,7 @@ strategy_development_task = RCrewAI::Task.new(
|
|
|
872
884
|
)
|
|
873
885
|
|
|
874
886
|
content_creation_workflow_task = RCrewAI::Task.new(
|
|
887
|
+
name: "content_creation_workflow",
|
|
875
888
|
description: "Execute a content creation workflow that demonstrates advanced tool composition:
|
|
876
889
|
1. Generate blog post content for 'small business automation' topic
|
|
877
890
|
2. Optimize the content for SEO using target keywords: ['business automation', 'small business efficiency', 'workflow optimization']
|
|
@@ -884,6 +897,7 @@ content_creation_workflow_task = RCrewAI::Task.new(
|
|
|
884
897
|
)
|
|
885
898
|
|
|
886
899
|
multi_channel_distribution_task = RCrewAI::Task.new(
|
|
900
|
+
name: "multi_channel_distribution",
|
|
887
901
|
description: "Execute a multi-channel distribution campaign using composed tools:
|
|
888
902
|
1. Take the optimized content from the content creation workflow
|
|
889
903
|
2. Adapt it for different social media platforms (Twitter, LinkedIn, Facebook)
|
|
@@ -894,10 +908,11 @@ multi_channel_distribution_task = RCrewAI::Task.new(
|
|
|
894
908
|
Demonstrate how tool composition enables sophisticated multi-channel campaigns.",
|
|
895
909
|
expected_output: "A comprehensive distribution report showing content adaptations for each platform, publishing schedule, estimated reach calculations, and examples of how tool composition enabled better cross-platform coordination.",
|
|
896
910
|
agent: distribution_manager,
|
|
897
|
-
|
|
911
|
+
context: [content_creation_workflow_task]
|
|
898
912
|
)
|
|
899
913
|
|
|
900
914
|
performance_analysis_task = RCrewAI::Task.new(
|
|
915
|
+
name: "performance_analysis",
|
|
901
916
|
description: "Conduct comprehensive performance analysis using composed analytics tools:
|
|
902
917
|
1. Analyze web analytics data to understand user behavior
|
|
903
918
|
2. Evaluate social media performance across platforms
|
|
@@ -908,10 +923,11 @@ performance_analysis_task = RCrewAI::Task.new(
|
|
|
908
923
|
Show how combining multiple analytics tools provides deeper insights than individual tools alone.",
|
|
909
924
|
expected_output: "A detailed performance analysis report that demonstrates how tool composition enables comprehensive cross-channel analytics, including correlation analysis, performance attribution, and optimization recommendations based on combined data sources.",
|
|
910
925
|
agent: performance_analyst,
|
|
911
|
-
|
|
926
|
+
context: [multi_channel_distribution_task]
|
|
912
927
|
)
|
|
913
928
|
|
|
914
929
|
automation_workflow_design_task = RCrewAI::Task.new(
|
|
930
|
+
name: "automation_workflow_design",
|
|
915
931
|
description: "Design an automated marketing workflow that showcases advanced tool composition:
|
|
916
932
|
1. Create a workflow that automatically triggers based on performance thresholds
|
|
917
933
|
2. Include decision points that route to different tool combinations
|
|
@@ -922,10 +938,11 @@ automation_workflow_design_task = RCrewAI::Task.new(
|
|
|
922
938
|
The workflow should demonstrate enterprise-level marketing automation capabilities.",
|
|
923
939
|
expected_output: "A comprehensive automation workflow design including flowcharts, tool composition patterns, decision logic, error handling procedures, and implementation guidelines. Include examples of how the workflow adapts based on performance data.",
|
|
924
940
|
agent: automation_architect,
|
|
925
|
-
|
|
941
|
+
context: [performance_analysis_task]
|
|
926
942
|
)
|
|
927
943
|
|
|
928
944
|
campaign_coordination_task = RCrewAI::Task.new(
|
|
945
|
+
name: "campaign_coordination",
|
|
929
946
|
description: "Coordinate a complete marketing campaign that demonstrates mastery of tool composition:
|
|
930
947
|
1. Orchestrate all previous tasks into a unified campaign
|
|
931
948
|
2. Ensure seamless data flow between all tools and processes
|
|
@@ -936,33 +953,31 @@ campaign_coordination_task = RCrewAI::Task.new(
|
|
|
936
953
|
This should showcase how tool composition enables marketing campaigns that are greater than the sum of their parts.",
|
|
937
954
|
expected_output: "A complete campaign coordination report including execution timeline, tool interaction maps, performance results, optimization actions taken, and a detailed analysis of how tool composition enhanced overall campaign effectiveness compared to using tools in isolation.",
|
|
938
955
|
agent: campaign_coordinator,
|
|
939
|
-
|
|
956
|
+
context: [automation_workflow_design_task]
|
|
940
957
|
)
|
|
941
958
|
|
|
942
959
|
# Create and Execute Crew
|
|
943
960
|
puts "🚀 Initializing Tool Composition Marketing Crew..."
|
|
944
961
|
|
|
945
|
-
tool_composition_crew = RCrewAI::Crew.new(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
verbose: true
|
|
965
|
-
)
|
|
962
|
+
tool_composition_crew = RCrewAI::Crew.new("tool_composition_crew", process: :sequential, verbose: true)
|
|
963
|
+
|
|
964
|
+
[
|
|
965
|
+
marketing_strategist,
|
|
966
|
+
content_specialist,
|
|
967
|
+
distribution_manager,
|
|
968
|
+
performance_analyst,
|
|
969
|
+
automation_architect,
|
|
970
|
+
campaign_coordinator
|
|
971
|
+
].each { |agent| tool_composition_crew.add_agent(agent) }
|
|
972
|
+
|
|
973
|
+
[
|
|
974
|
+
strategy_development_task,
|
|
975
|
+
content_creation_workflow_task,
|
|
976
|
+
multi_channel_distribution_task,
|
|
977
|
+
performance_analysis_task,
|
|
978
|
+
automation_workflow_design_task,
|
|
979
|
+
campaign_coordination_task
|
|
980
|
+
].each { |task| tool_composition_crew.add_task(task) }
|
|
966
981
|
|
|
967
982
|
# Execute the crew
|
|
968
983
|
puts "\n" + "="*80
|
|
@@ -970,7 +985,7 @@ puts "EXECUTING TOOL COMPOSITION DEMONSTRATION"
|
|
|
970
985
|
puts "="*80
|
|
971
986
|
|
|
972
987
|
begin
|
|
973
|
-
results = tool_composition_crew.
|
|
988
|
+
results = tool_composition_crew.execute
|
|
974
989
|
|
|
975
990
|
puts "\n" + "="*80
|
|
976
991
|
puts "TOOL COMPOSITION RESULTS SUMMARY"
|
|
@@ -20,7 +20,7 @@ Our web scraping team includes:
|
|
|
20
20
|
|
|
21
21
|
## Complete Implementation
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
````ruby
|
|
24
24
|
require 'rcrewai'
|
|
25
25
|
require 'nokogiri'
|
|
26
26
|
require 'open-uri'
|
|
@@ -38,7 +38,7 @@ end
|
|
|
38
38
|
# Web Scraping Tool
|
|
39
39
|
class WebScrapingTool < RCrewAI::Tools::Base
|
|
40
40
|
def initialize(**options)
|
|
41
|
-
super
|
|
41
|
+
super()
|
|
42
42
|
@name = 'web_scraper'
|
|
43
43
|
@description = 'Extract data from web pages with rate limiting and error handling'
|
|
44
44
|
@scraped_data = {}
|
|
@@ -254,7 +254,7 @@ end
|
|
|
254
254
|
# Data Validation Tool
|
|
255
255
|
class DataValidationTool < RCrewAI::Tools::Base
|
|
256
256
|
def initialize(**options)
|
|
257
|
-
super
|
|
257
|
+
super()
|
|
258
258
|
@name = 'data_validator'
|
|
259
259
|
@description = 'Validate and clean scraped data'
|
|
260
260
|
end
|
|
@@ -345,7 +345,7 @@ end
|
|
|
345
345
|
# Content Analysis Tool
|
|
346
346
|
class ContentAnalysisTool < RCrewAI::Tools::Base
|
|
347
347
|
def initialize(**options)
|
|
348
|
-
super
|
|
348
|
+
super()
|
|
349
349
|
@name = 'content_analyzer'
|
|
350
350
|
@description = 'Analyze and process scraped content'
|
|
351
351
|
end
|
|
@@ -743,7 +743,7 @@ results[:results].each do |scraping_result|
|
|
|
743
743
|
if scraping_result[:status] == :completed
|
|
744
744
|
puts " Operation: Successfully completed"
|
|
745
745
|
else
|
|
746
|
-
puts " Issue: #{scraping_result[:
|
|
746
|
+
puts " Issue: #{scraping_result[:result]}"
|
|
747
747
|
end
|
|
748
748
|
puts
|
|
749
749
|
end
|
|
@@ -1148,7 +1148,7 @@ puts " • 1,450 keywords extracted and categorized"
|
|
|
1148
1148
|
puts " • 890 named entities identified"
|
|
1149
1149
|
puts " • 78% positive sentiment on AI automation"
|
|
1150
1150
|
puts " • 12 distinct content categories identified"
|
|
1151
|
-
|
|
1151
|
+
````
|
|
1152
1152
|
|
|
1153
1153
|
## Key Web Scraping Features
|
|
1154
1154
|
|