Tool Reliability
How PraisonAI tools handle errors, retries, and edge cases
graph LR
subgraph "Tool Reliability"
Request[📋 User Request] --> Process[⚙️ Tool Reliability]
Process --> Result[✅ Result]
end
classDef input fill:#6366F1,stroke:#7C90A0,color:#fff
classDef process fill:#189AB4,stroke:#7C90A0,color:#fff
classDef output fill:#10B981,stroke:#7C90A0,color:#fff
class Request input
class Process process
class Result outputsequenceDiagram
participant User
participant Agent
participant Feature as Tool Reliability
User->>Agent: Request
Agent->>Feature: Process request
Feature-->>Agent: Result
Agent-->>User: Responsefrom praisonaiagents import Agent, duckduckgo
agent = Agent(name="Researcher", tools=[duckduckgo])
agent.start("Find recent news about tool reliability in AI agents")The user relies on search tools; PraisonAI retries and fallbacks keep the agent run stable when a provider fails.
PraisonAI tools are designed with reliability-first principles.
flowchart LR
A[Tool Call] --> B{Success?}
B -->|Yes| C[Return Results]
B -->|No| D{Retries Left?}
D -->|Yes| E[Wait & Retry]
E --> A
D -->|No| F[Return Error]
style A fill:#8B0000,color:#fff
style C fill:#189AB4,color:#fff
style F fill:#189AB4,color:#fff
classDef agent fill:#8B0000,color:#fff
classDef tool fill:#189AB4,color:#fffSearch Provider Priority
flowchart TD
A[search_web] --> B{Tavily Available?}
B -->|Yes| C[Use Tavily]
B -->|No| D{Exa Available?}
D -->|Yes| E[Use Exa]
D -->|No| F{You.com Available?}
F -->|Yes| G[Use You.com]
F -->|No| H{DuckDuckGo?}
H -->|Yes| I[Use DuckDuckGo]
H -->|No| J[Use SearxNG]
style A fill:#8B0000,color:#fff
style C fill:#189AB4,color:#fff
style E fill:#189AB4,color:#fff
style G fill:#189AB4,color:#fff
style I fill:#189AB4,color:#fff
style J fill:#189AB4,color:#fffAutomatic Fallback
search_web tries providers in order until one succeeds
Each provider retries 3 times with exponential backoff
Quick Start
- Simple Usage
python from praisonaiagents.tools import search_web # Automatically uses best available provider results = search_web("AI news 2024") - With Configuration
python from praisonaiagents.tools import internet_search # Direct DuckDuckGo access with retry results = internet_search("Python tutorials", retries=3)
Error Handling
Check for errors
results = search_web("query")
if results and "error" in results[0]:
print(f"Failed: {results[0]['error']}")list_processes handles None
System processes may return None for CPU/memory. Defaults to 0.0.
API Keys
| Provider | Environment Variable | Quality |
|---|---|---|
| Tavily | TAVILY_API_KEY | ⭐⭐⭐ Best |
| Exa | EXA_API_KEY | ⭐⭐⭐ Best |
| You.com | YDC_API_KEY | ⭐⭐ Good |
| DuckDuckGo | None needed | ⭐ Basic |
Auto-Approve Tools
approve:
- write_file
- execute_command
agents:
writer:
tools:
- write_fileSchema-level Reliability
Runtime reliability (error handling, retries, fallbacks) complements schema-time reliability for comprehensive tool safety.
Schema validation catches broken tools at development time:
- Invalid OpenAI function schemas
- Missing required fields like
properties - Non-JSON-serializable values
- Duplicate tool names in lists
Runtime reliability handles execution errors:
- Network failures and timeouts
- API rate limits and retries
- Provider fallbacks
- Process crashes
For schema validation details and fixing validation errors, see Tool Schema Validation.