Class MatryoshkaToolInjectionStrategy
-
- All Implemented Interfaces:
-
com.embabel.agent.spi.loop.ToolInjectionStrategy
public final class MatryoshkaToolInjectionStrategy implements ToolInjectionStrategy
Injection strategy that handles MatryoshkaTool invocations.
When a MatryoshkaTool is invoked:
Its selected inner tools are added to the available tools
If MatryoshkaTool.removeOnInvoke is true, the facade is removed
This enables progressive tool disclosure - presenting simplified categories initially, then revealing granular tools when the LLM expresses intent.
Example flow:
LLM sees: "database_operations" tool
LLM invokes: database_operations
Result: database_operations removed, query_table/insert/update/delete added
LLM can now use specific database tools
This strategy can be combined with other strategies using ChainedToolInjectionStrategy.
-
-
Field Summary
Fields Modifier and Type Field Description public final static MatryoshkaToolInjectionStrategyINSTANCE
-
Constructor Summary
Constructors Constructor Description MatryoshkaToolInjectionStrategy()
-
Method Summary
Modifier and Type Method Description ToolInjectionResultevaluate(ToolInjectionContext context)Called after each tool execution to determine tool changes. -
-
Method Detail
-
evaluate
ToolInjectionResult evaluate(ToolInjectionContext context)
Called after each tool execution to determine tool changes.
Default implementation bridges to legacy evaluateToolResult for backward compatibility. Override this method for new implementations that need to add/remove tools.
- Parameters:
context- The current state of the tool loop- Returns:
Result containing tools to add and/or remove
-
-
-
-