Class: Brute::Middleware::Loop::BackgroundJobs

Inherits:
Loop
  • Object
show all
Defined in:
lib/brute/middleware/006_loop.rb

Overview

Keeps the turn alive while background jobs are running. Sit it OUTSIDE the tool loop: the inner loop ends when the model answers with text, and this one sends control back in for another pass while jobs are still running — which is how a finished job gets reported. Whatever spawns the jobs (say, a middleware running a subagent in the background) keeps env current.

use Brute::Middleware::Loop::BackgroundJobs
use Brute::Middleware::Loop::ToolResult

Constant Summary collapse

CONDITION =
->(env) { env[:background_jobs] }

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ BackgroundJobs

Returns a new instance of BackgroundJobs.



88
89
90
# File 'lib/brute/middleware/006_loop.rb', line 88

def initialize(app)
  super(app, CONDITION)
end