Custom Tool Selection
Prisme.ai natively supports hybrid tool selection capabilities. This functionality is transparently integrated into agent creation processes within both AI Knowledge and AI Builder products. The platform allows developers to completely customize their tool selection system, giving you the control over how your AI agents operate. Learn how to implement custom tool selection logic so your AI agents can intelligently choose the right tools at precisely the right time, maximizing efficiency and performance.
Effective tool selection is critical for tool-using agents. It ensures that agents choose the right tool for each task, leading to accurate, efficient, and purposeful interactions. This guide explores strategies and techniques for implementing your own tool selection in Prisme.ai.
These guides provide example YAML files for educational purposes, showcasing the range of possibilities. It is up to the technical teams to implement them according to your internal tools and APIs.
Understanding Tool Selection
Tool selection is the process by which an AI agent:
- Recognizes when a tool is needed to fulfill a user request
- Evaluates which available tool is most appropriate
- Prepares the necessary parameters for tool execution
- Decides whether to use the tool results or try alternative approaches
Effective tool selection balances accuracy (choosing the right tool) with efficiency (minimizing unnecessary tool usage).
The Tool Selection Challenge
Tool selection presents several key challenges:
Ambiguous Requests
User requests may not clearly indicate which tool is needed
Multiple Valid Options
Several tools might satisfy the request in different ways
Parameter Extraction
Identifying and formatting the required parameters from natural language
Decision Complexity
Balancing multiple factors including capabilities, costs, and permissions
Tool Selection Strategies
Prisme.ai supports several approaches to tool selection, each with different strengths:
Leverage the language model’s reasoning to select appropriate tools.
How it works:
- Tools are described to the LLM with clear purposes and capabilities
- The LLM analyzes user requests and determines tool requirements
- Function calling capabilities enable structured tool invocation
- The LLM formats parameters based on tool schemas
Best for:
- General-purpose agents with diverse tools
- Complex decision-making with nuanced criteria
- Adapting to varied user request formulations
- Scenarios where selection logic is difficult to formalize
Leverage the language model’s reasoning to select appropriate tools.
How it works:
- Tools are described to the LLM with clear purposes and capabilities
- The LLM analyzes user requests and determines tool requirements
- Function calling capabilities enable structured tool invocation
- The LLM formats parameters based on tool schemas
Best for:
- General-purpose agents with diverse tools
- Complex decision-making with nuanced criteria
- Adapting to varied user request formulations
- Scenarios where selection logic is difficult to formalize
Implement explicit rules and conditions for tool selection.
How it works:
- Predetermined conditions dictate when specific tools are used
- Pattern matching identifies relevant request types
- Decision trees guide the selection process
- Explicit fallback strategies handle edge cases
Best for:
- Well-defined, predictable use cases
- High-reliability requirements
- Performance-critical applications
- Compliance-sensitive contexts
Combine LLM reasoning with rule-based guardrails.
How it works:
- Rules provide boundaries and constraints
- LLM makes decisions within allowed parameters
- Explicit overrides for special cases
- Validation of LLM selections against business rules
Best for:
- Complex environments with some well-defined constraints
- Balancing flexibility with control
- Evolving systems where rules are being refined
- Enterprise environments with governance requirements
Implementing LLM-Based Selection
For many applications, LLM-based selection provides the best balance of flexibility and effectiveness:
Craft Clear Tool Descriptions
Provide the LLM with detailed information about each tool.
Effective description elements:
Key components include:
- Clear purpose statement
- When to use the tool
- When NOT to use the tool
- Required parameters
- Expected outcomes
Provide Selection Guidelines
Include explicit guidance for tool selection in your agent instructions.
Example guidelines:
These guidelines help the LLM make consistent decisions aligned with business preferences.
Implement Parameter Extraction
Guide the LLM in extracting and formatting parameters from user requests.
Example guidance:
Effective parameter extraction ensures tools receive correctly formatted inputs.
Design Error Recovery
Prepare for tool selection errors with recovery strategies.
Example recovery instructions:
These strategies ensure resilience when initial tool selections don’t succeed.
Example: LLM-Based Tool Selection
Here’s a complete example of custom implementation of LLM-based tool selection:
Implementing Rule-Based Selection
For more controlled environments, rule-based selection provides predictability and reliability:
Example: Hybrid Selection Approach
Most enterprise applications benefit from hybrid approaches that combine LLM flexibility with rule-based governance:
Example: Tool Definition
Here’s an example of how to define a weather tool in AI Builder:
Best Practices for Tool Selection
Tool Selection in AI Knowledge
For AI Knowledge agents, implement effective tool selection through these configurations:
Configure Tool Descriptions
Create detailed, LLM-friendly descriptions for each tool.
Effective descriptions include:
- Clear purpose and capabilities
- When to use and when not to use
- Example scenarios
- Required parameter information
- Expected result formats
Set Tool Selection Instructions
Add specific guidance for tool selection in agent instructions.
Example instructions:
Add Usage Examples
Provide concrete examples of correct tool selection.
Example:
Test and Refine
Evaluate tool selection performance with real-world scenarios.
Testing approaches:
- Create a test set of diverse queries
- Evaluate tool selection accuracy
- Identify patterns in incorrect selections
- Refine descriptions and instructions
- A/B test different instruction formats
Tool Selection in AI Builder
For advanced tool selection logic in AI Builder, implement these patterns:
Next Steps
Ready to implement effective tool selection for your agents? Continue your journey with these resources:
Was this page helpful?