withToolChainingFrom

open override fun <T : Any> withToolChainingFrom(type: Class<T>, predicate: DomainToolPredicate<T>): StateMachineTool<S>

Register a domain class with a predicate to control when its @LlmTool methods are exposed.

When a single artifact of the specified type is returned by any tool and passes the predicate, any @LlmTool annotated methods on that instance become available as tools (globally, not state-bound).

Parameters

type

The domain class that may contribute tools

predicate

Predicate to filter which instances contribute tools


inline fun <T : Any> withToolChainingFrom(noinline predicate: (T, AgentProcess?) -> Boolean): StateMachineTool<S>

Register a class with a predicate. Kotlin-friendly version using reified type parameter.


Register a class that can contribute @LlmTool methods when a single instance is retrieved. Kotlin-friendly version using reified type parameter.

Example:

StateMachineTool("orderProcessor", "Process orders", OrderState::class.java)
.withToolChainingFrom<Order>() // Order methods become available when a single Order is retrieved
.withInitialState(OrderState.DRAFT)
...