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 pathwaypathway = ( 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 pathwayprint(pathway)
**System Diagnostics**
Purpose: diagnose and resolve technical issues
Activate when:
- user reports technical problems
Flow guidance:
- PROBLEM_INTAKE (collect): problem intake: understand the reported issue
Required: (1) problem description, (2) system details, (3) error messages
- INITIAL_DIAGNOSIS (tool): initial diagnosis: run initial diagnostic checks
Tools: (1) system_health_checker, (2) log_analyzer, (3) performance_monitor
Success: initial diagnosis completed
- DETAILED_ANALYSIS (tool): detailed analysis: perform detailed system analysis
Required: the root cause is identified
Tools: (1) network_diagnostics, (2) database_integrity_check, (3) security_scan
- SOLUTION (tool): solution: implement solution
Tools: automated_repair_tool
Success: issue resolved and system stable
Follow as flexible guidance, adapting to user conversation patterns while ensuring key objectives
are addressed.
/opt/hostedtoolcache/Python/3.11.13/x64/lib/python3.11/site-packages/talk_box/pathways.py:561: UserWarning: State 'detailed_analysis' was inferred as 'tool' but method suggests 'collect'. Keeping first inference 'tool'.
warnings.warn(