C.W.K.
Stream
Lesson 02 of 07 · published

Fallback chain과 degraded 모드

~14 min · fallback, degraded-mode, reliability

Level 0Observer
0 XP0/64 lessons0/13 achievements
0/150 XP to next level150 XP to go0% complete

패턴 셋, blast radius 셋

Claude 호출 fallback 셋 맛 — 같은 프로바이더, 더 작은 모델 — Sonnet rate-limited면 Sonnet → Haiku. Cross-프로바이더 — capability-equivalent 호출에 Anthropic → OpenAI → Gemini. Async deferral — sync fail하면 호출을 Batch API나 큐에 push. 각각 다른 비용 스토리·다른 UX 함의.

Degraded 모드는 honest UX

Fallback path가 lower-quality 답 반환하면 user한테 알려. 'Reply generated by Haiku because Sonnet was unavailable'이 silently worse 답 ship보다 나음. cwkPippa가 UI badge로 brain surface — 아빠가 피파가 더 작은 모델에 run할 때 알게.

분기당 한 번 drill

Untested fallback에 버그 있어. 매 분기 staging에서 의도적으로 primary path 비활성, fallback이 end-to-end run 봐. Drill에서 찾은 버그는 프로덕션에서 안 무는 버그.

원칙: 신뢰성이 layered. Fallback이 layer; drill이 증명.

Code

Three-step fallback chain·python
from anthropic import Anthropic, RateLimitError, InternalServerError, APIConnectionError

client = Anthropic(max_retries=2)

async def chat_with_fallback(messages):
    # 1) 계획된 tier 시도.
    try:
        return ('sonnet', await call(client, 'claude-sonnet-4-6', messages))
    except (RateLimitError, InternalServerError, APIConnectionError):
        pass
    # 2) 같은 프로바이더, 더 작은 모델.
    try:
        return ('haiku', await call(client, 'claude-haiku-4-5-20251001', messages))
    except (RateLimitError, InternalServerError, APIConnectionError):
        pass
    # 3) Cross-프로바이더.
    return ('openai', await call_openai(messages))
User한테 fallback surface·typescript
function ResponseBadge({ tier }: { tier: 'sonnet' | 'haiku' | 'openai' }) {
  if (tier === 'sonnet') return null;  // primary path, no badge
  const label =
    tier === 'haiku' ? 'fast mode (smaller model)' : 'fallback provider';
  return (
    <span className="text-xs text-amber-600" title={`Generated via ${tier}`}>
      {label}
    </span>
  );
}

External links

Exercise

Runbook에 분기 drill 추가. Drill — staging에서 Anthropic API 키 비활성, representative 요청 run, fallback path가 SLA 안에 service confirm. On-call 누구·뭘 봐야 하는지 문서화.
Hint
Fallback 동안 user가 뭘 보는지 describe 못 하면 degraded UX undefined — 그거 먼저 fix.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.