Class: RubyLLM::Agents::Pipeline::Executor
- Inherits:
-
Object
- Object
- RubyLLM::Agents::Pipeline::Executor
- Defined in:
- lib/ruby_llm/agents/pipeline/executor.rb
Overview
Wraps an agent’s execute method to work with the pipeline.
This is the “core” that middleware wraps around. It’s the final handler in the chain that actually performs the agent’s work.
The Executor adapts the agent’s #execute method to the middleware interface (call(context) -> context).
Class Method Summary collapse
-
.execute(context) ⇒ Context
Execute a context through the full pipeline.
Instance Method Summary collapse
-
#call(context) ⇒ Context
Execute the agent’s core logic.
-
#initialize(agent) ⇒ Executor
constructor
A new instance of Executor.
Constructor Details
#initialize(agent) ⇒ Executor
Returns a new instance of Executor.
42 43 44 |
# File 'lib/ruby_llm/agents/pipeline/executor.rb', line 42 def initialize(agent) @agent = agent end |
Class Method Details
.execute(context) ⇒ Context
Execute a context through the full pipeline
Builds the middleware stack based on the agent’s configuration, then executes the context through it.
34 35 36 37 38 39 |
# File 'lib/ruby_llm/agents/pipeline/executor.rb', line 34 def self.execute(context) agent_instance = context.agent_instance core = new(agent_instance) pipeline = Builder.for(context.agent_class).build(core) pipeline.call(context) end |
Instance Method Details
#call(context) ⇒ Context
Execute the agent’s core logic
Calls the agent’s #execute method with the context. The agent is expected to set context.output with the result.
53 54 55 56 |
# File 'lib/ruby_llm/agents/pipeline/executor.rb', line 53 def call(context) @agent.send(:execute, context) context end |