Pathways.tools()
Specify tools available for use in the current state.
Usage
Pathways.tools(tool_names)Essential for type="tool" states, but can also be used in other states where specific capabilities are needed. Typically combined with .success_condition() to define when tool usage is complete.
Parameters
tool_names: Union[str, List[str]]- Names of specific tools or capabilities the LLM should use. Can be a single string or a list of strings. These should match actual available tools.
Returns
Pathways- Self for method chaining, allowing combination with other pathway building methods to create comprehensive conversation flows.
Integration Notes
- Type Inference: infers state type as
"tool"if not explicitly set - Tool Matching: tool names should match actual available capabilities
- Completion Criteria: use
.success_condition()to define completion criteria - Error Handling: consider
.fallback()for when tools fail - State Focus: essential for
type="tool"states but can be used in other states where specific capabilities are needed - Capability Specification: tells the LLM what specific capabilities are available at each step
The .tools() method tells the LLM what specific capabilities are available at each step, automatically inferring the state type as “tool” when tools are the primary focus.
Examples
Complete pathway showing .tools() enabling specific capabilities:
import talk_box as tb
# Creating a technical diagnosis pathway
pathway = (
tb.Pathways(
title="System Diagnostics",
desc="diagnose and resolve technical issues",
activation="user reports technical problems"
)
# === STATE: problem_intake ===
.state("problem intake: understand the reported issue")
.required(["problem description", "system details", "error messages"])
.next_state("initial_diagnosis")
# === STATE: initial_diagnosis ===
.state("initial diagnosis: run initial diagnostic checks")
# .tools() specifies what capabilities are available ---
.tools([
"system_health_checker",
"log_analyzer",
"performance_monitor"
])
.success_condition("initial diagnosis completed")
.next_state("detailed_analysis")
# === STATE: detailed_analysis ===
.state("detailed analysis: perform detailed system analysis")
# .tools() can specify advanced diagnostic tools ---
.tools([
"network_diagnostics",
"database_integrity_check",
"security_scan"
])
.required(["the root cause is identified"])
.next_state("solution")
# === STATE: solution ===
.state("solution: implement solution")
# .tools() for implementation capabilities ---
.tools("automated_repair_tool")
.success_condition("issue resolved and system stable")
)
# See how tools are integrated into the pathway
print(pathway)