Class: ActiveAgent::Team
- Inherits:
-
Object
- Object
- ActiveAgent::Team
- Defined in:
- lib/active_agent/team.rb
Overview
Orchestrates multiple agents and tasks in sequential or hierarchical processes.
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#process ⇒ Object
readonly
Returns the value of attribute process.
-
#tasks ⇒ Object
readonly
Returns the value of attribute tasks.
Instance Method Summary collapse
-
#initialize(agents:, tasks:, process: :sequential) ⇒ Team
constructor
A new instance of Team.
- #kickoff ⇒ Object
Constructor Details
#initialize(agents:, tasks:, process: :sequential) ⇒ Team
Returns a new instance of Team.
8 9 10 11 12 |
# File 'lib/active_agent/team.rb', line 8 def initialize(agents:, tasks:, process: :sequential) @agents = agents @tasks = tasks @process = process end |
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents.
6 7 8 |
# File 'lib/active_agent/team.rb', line 6 def agents @agents end |
#process ⇒ Object (readonly)
Returns the value of attribute process.
6 7 8 |
# File 'lib/active_agent/team.rb', line 6 def process @process end |
#tasks ⇒ Object (readonly)
Returns the value of attribute tasks.
6 7 8 |
# File 'lib/active_agent/team.rb', line 6 def tasks @tasks end |
Instance Method Details
#kickoff ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_agent/team.rb', line 14 def kickoff accumulated_context = [] @tasks.each_with_index do |task, index| context_str = accumulated_context.last say_verbose "🤖 Task #{index + 1}/#{@tasks.size} [#{task.agent.role}]: #{task.description[0..80]}..." result = task.execute(context: context_str) accumulated_context << result end accumulated_context.last end |