Skip to main content

Overview

Errors are inevitable in distributed systems. Conversimple provides comprehensive error handling mechanisms to help you build reliable voice agents that gracefully recover from failures.

Error Types

Platform Errors

Errors originating from the Conversimple platform:
Error TypeCauseTypical Action
authentication_errorInvalid API key or customer IDCheck credentials
connection_errorWebSocket connection failedRetry with backoff
rate_limit_errorToo many requestsImplement rate limiting
service_unavailablePlatform maintenanceRetry later
conversation_errorConversation state issueReset conversation

Tool Execution Errors

Errors from your tool functions:
Error TypeCauseTypical Action
tool_execution_errorException in tool codeFix tool logic
tool_timeoutTool took too longOptimize tool
tool_not_foundTool doesn’t existCheck tool registration
invalid_parametersWrong parameter typesValidate inputs
permission_deniedAuthorization failedCheck permissions

AI Service Errors

Errors from STT/LLM/TTS providers:
Error TypeCauseTypical Action
stt_errorSpeech recognition failedRequest user to repeat
llm_errorLanguage model errorRetry or use fallback
tts_errorSpeech synthesis failedRetry or use alternative
provider_timeoutAI service timed outRetry with backoff

Error Handling in Your Agent

Basic Error Handling

Implement the on_error callback:

Tool-Specific Error Handling

Handle errors within tools:

Async Tool Error Handling

For async tools:

Retry Strategies

Exponential Backoff

For transient errors:

Tool Retry Decorator

Create a reusable retry decorator:

Circuit Breaker Pattern

Prevent cascading failures:

Fallback Strategies

Default Responses

Provide fallback responses when tools fail:

Graceful Degradation

Reduce functionality instead of failing completely:

Logging and Monitoring

Structured Logging

Use structured logging for better debugging:

Error Metrics

Track error rates and patterns:

User-Friendly Error Messages

Return Helpful Messages

Provide clear, actionable error messages to users:

Next Steps

Logging & Monitoring

Set up comprehensive logging

Debugging

Advanced debugging techniques