오류 처리 개요
AI 서비스는 공급자 API 장애, 속도 제한, 네트워크 타임아웃, 채널 연결 해제 등 다양한 잠재적 장애에 직면합니다. 적절한 오류 처리 메커니즘 설정으로 서비스 가용성을 크게 향상시킬 수 있습니다.
자동 재시도
{
"providers": {
"openai": {
"retry": {
"maxAttempts": 3,
"initialDelay": 1000,
"maxDelay": 10000,
"backoffMultiplier": 2,
"retryableErrors": [429, 500, 502, 503, 504, "ECONNRESET", "ETIMEDOUT"]
}
}
}
}
모델 장애 전환
{
"models": {
"primary": {"provider": "openai", "model": "gpt-4o", "fallback": "secondary"},
"secondary": {"provider": "anthropic", "model": "claude-sonnet-4-20250514", "fallback": "local"},
"local": {"provider": "ollama", "model": "llama3.1:8b"}
}
}
서킷 브레이커 패턴
{
"providers": {
"openai": {
"circuitBreaker": {
"enabled": true,
"failureThreshold": 5,
"resetTimeout": 60000,
"halfOpenRequests": 2
}
}
}
}
채널 자동 재연결
{
"channels": {
"whatsapp-main": {
"reconnect": {
"enabled": true,
"maxAttempts": 10,
"interval": 30000,
"notifyOnDisconnect": true
}
}
}
}
우아한 성능 저하
{
"degradation": {
"rules": [
{
"condition": "provider.openai.down",
"actions": [
{"switch": "model", "to": "local"},
{"disable": "tools", "except": ["basic"]},
{"notify": "admin"}
]
}
]
}
}
정리
안정적인 오류 처리는 OpenClaw 고가용성의 보장입니다. 자동 재시도, 장애 전환, 서킷 브레이커 및 우아한 성능 저하의 조합 설정을 통해 서비스 가용성을 99.9% 이상으로 향상시킬 수 있습니다.