ReplanningToolFactory

Factory interface for creating replanning tool decorators. Extended by Tool.Companion to provide Tool.replanAlways, Tool.replanWhen, etc.

Inheritors

Functions

Link copied to clipboard
open fun <T> conditionalReplan(tool: Tool, decider: (t: T, replanContext: ReplanContext) -> ReplanDecision?): DelegatingTool

When the decider returns a ReplanDecision, replan after execution, adding the artifact to the blackboard along with any additional updates from the decision. The decider receives the artifact cast to type T and the replan context. If the artifact is null or cannot be cast to T, the decider is not called.

Link copied to clipboard
open fun replanAlways(tool: Tool): Tool

Make this tool always replan after execution, adding the artifact to the blackboard.

Link copied to clipboard
open fun <T> replanAndAdd(tool: Tool, valueComputer: (t: T) -> Any?): DelegatingTool

Replan and add the object returned by the valueComputer to the blackboard.

Link copied to clipboard
open fun <T> replanWhen(tool: Tool, predicate: (t: T) -> Boolean): DelegatingTool

When the predicate matches the tool result artifact, replan, adding the artifact to the blackboard. The predicate receives the artifact cast to type T. If the artifact is null or cannot be cast to T, returns normally.