ToolLoop

org.llm4s.agent.graph.toolloop.ToolLoop
See theToolLoop companion object
final class ToolLoop

The model/tool loop as a graph - the Stage 0 proof of runtime-owned tool results and resumable approval ((#1269)):

input -> model --fan-out, one task per call--> call-tool --(dynamic join "tool-batch")--> collect -> model
                                                  \--suspend--> approval --/
  • Each call is its own task: policy first, then the tool. A policy RequireApproval and a tool's NeedsApproval both suspend the call with an ApprovalRequest and resume at the one approval node, whose continuation fills that call's slot in the batch barrier.
  • The loop, not the tool, records exactly one ToolResult per call - for success, failure, denial, rejection and unknown tools alike; the results key refuses a second one.
  • collect runs only when the barrier releases, checks every call of the batch has exactly one result, and appends the ToolMessages in call order. The model never sees a partial batch.
  • The model node re-checks the history with Message.validateConversation before every call.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def answers(decisions: (InterruptId, ApprovalDecision)*): Map[InterruptId, Value]
def requests(suspended: Suspended): Result[Vector[(InterruptId, ApprovalRequest)]]

The approval requests a suspended run is waiting on.

The approval requests a suspended run is waiting on.

Attributes

Concrete fields

val graph: CompiledGraph[String, String]