Tool Reliability

How PraisonAI tools handle errors, retries, and edge cases

Diagram

Tool Reliability

📋 User Request

⚙️ Tool Reliability

✅ Result

Diagram
Tool ReliabilityAgentUserTool ReliabilityAgentUserRequestProcess requestResultResponse
python
from 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.

Diagram

Yes

No

Yes

No

Tool Call

Success?

Return Results

Retries Left?

Wait & Retry

Return Error

Search Provider Priority

Diagram

Yes

No

Yes

No

Yes

No

Yes

No

search_web

Tavily Available?

Use Tavily

Exa Available?

Use Exa

You.com Available?

Use You.com

DuckDuckGo?

Use DuckDuckGo

Use SearxNG

Quick Start

  1. Simple Usage
    python
    from praisonaiagents.tools import search_web
    
    # Automatically uses best available provider
    results = search_web("AI news 2024")
  2. 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
python
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

ProviderEnvironment VariableQuality
TavilyTAVILY_API_KEY⭐⭐⭐ Best
ExaEXA_API_KEY⭐⭐⭐ Best
You.comYDC_API_KEY⭐⭐ Good
DuckDuckGoNone needed⭐ Basic

Auto-Approve Tools

yaml
approve:
  - write_file
  - execute_command

agents:
  writer:
    tools:
      - write_file

Schema-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.

Related