Quick Start
How It Works
| Phase | Behavior | Performance |
|---|---|---|
| Schema Build | Availability checks run once | Zero runtime cost |
| Tool Execution | Only available tools included | No availability overhead |
| LLM Interaction | Only sees usable tools | Prevents hallucination |
Implementation Methods
Function Decorator
BaseTool Protocol
Registry Functions
Availability Rules
Behavior Patterns
- No Check Method: Tool is always considered available
- Check Returns True: Tool included in LLM schema
- Check Returns False: Tool hidden from LLM
- Check Throws Exception: Tool hidden + warning logged
Exception Handling
Plain Function Registry
Configuration Patterns
Environment-Based Availability
Service Discovery
Conditional Tool Loading
Performance Guidelines
Keep Checks Fast
Keep Checks Fast
Availability checks run at schema-build time and must be fast (< 100ms recommended).Good: Environment variable checks, import tests, quick pings
Bad: Full API calls, heavy file operations, long network requests
Cache Results When Possible
Cache Results When Possible
For checks that might be expensive, consider caching results.
Fail Fast on Missing Dependencies
Fail Fast on Missing Dependencies
Check critical dependencies first, avoid unnecessary work.
Graceful Degradation
Graceful Degradation
Design tools to degrade gracefully when dependencies are partially available.
Related
Tools Overview
Core tool system and registration
Agent Configuration
Agent setup and tool integration

