Class PlaybookTool

  • All Implemented Interfaces:
    com.embabel.agent.api.tool.Tool , com.embabel.agent.api.tool.ToolInfo , com.embabel.agent.api.tool.agentic.AgenticTool , com.embabel.agent.api.tool.agentic.ToolChaining

    
    public final class PlaybookTool
     implements AgenticTool<PlaybookTool>
                        

    A tool with conditional tool unlocking that uses an LLM to orchestrate sub-tools.

    Unlike com.embabel.agent.api.tool.agentic.simple.SimpleAgenticTool which makes all tools available immediately, a PlaybookTool allows tools to be progressively unlocked based on conditions such as:

    • Prerequisites: unlock after other tools have been called

    • Artifacts: unlock when certain artifact types are produced

    • Blackboard: unlock based on process state

    • Custom predicates: unlock based on arbitrary conditions

    This provides more predictable LLM behavior by guiding it through a structured sequence of available tools.

    // Kotlin curried syntax
    PlaybookTool("researcher", "Research and analyze topics")
        .withTools(searchTool, fetchTool)           // always available
        .withTool(analyzeTool)(searchTool)          // unlocks after search
        .withTool(summarizeTool)(analyzeTool)       // unlocks after analyze
    
    // Java fluent syntax
    new PlaybookTool("researcher", "Research and analyze topics")
        .withTools(searchTool, fetchTool)
        .withTool(analyzeTool).unlockedBy(searchTool)
        .withTool(summarizeTool).unlockedBy(analyzeTool);