Class: SwarmSDK::Swarm::Executor
- Inherits:
-
Object
- Object
- SwarmSDK::Swarm::Executor
- Defined in:
- lib/swarm_sdk/swarm/executor.rb
Overview
Handles swarm execution orchestration
Extracted from Swarm#execute to reduce complexity and eliminate code duplication. The core execution loop, error handling, and cleanup logic are unified here.
Instance Method Summary collapse
-
#initialize(swarm) ⇒ Executor
constructor
A new instance of Executor.
-
#run(prompt, wait:, logs:, has_logging:, original_fiber_storage:) ⇒ Async::Task
Execute the swarm with a prompt.
Constructor Details
#initialize(swarm) ⇒ Executor
Returns a new instance of Executor.
10 11 12 |
# File 'lib/swarm_sdk/swarm/executor.rb', line 10 def initialize(swarm) @swarm = swarm end |
Instance Method Details
#run(prompt, wait:, logs:, has_logging:, original_fiber_storage:) ⇒ Async::Task
Execute the swarm with a prompt
22 23 24 25 26 27 28 29 |
# File 'lib/swarm_sdk/swarm/executor.rb', line 22 def run(prompt, wait:, logs:, has_logging:, original_fiber_storage:) @original_fiber_storage = original_fiber_storage if wait run_blocking(prompt, logs: logs, has_logging: has_logging) else run_async(prompt, logs: logs, has_logging: has_logging) end end |