ν”Όλ“œλ‘œ λŒμ•„κ°€κΈ°
πŸ€– Learn Harness Engineering by Building a Mini Openclaw 🦞
Dev.toDev.to
AI/ML

7,000라인의 Python μ½”λ“œλ‘œ κ΅¬ν˜„ν•œ ν”„λ‘œλ•μ…˜κΈ‰ AI Agent Gateway 섀계

πŸ€– Learn Harness Engineering by Building a Mini Openclaw 🦞

Truong Phung2026λ…„ 4μ›” 25일8λΆ„intermediate

Context

λ‹¨μˆœ API 호좜 μˆ˜μ€€μ˜ νŠœν† λ¦¬μ–Ό ν•œκ³„λ₯Ό κ·Ήλ³΅ν•˜κΈ° μœ„ν•΄ μ‹€μ œ 운영 ν™˜κ²½μ˜ Gateway ꡬ쑰 뢄석 ν•„μš”. μ„Έμ…˜ 관리, 채널 λΌμš°νŒ…, λ™μ‹œμ„± μ œμ–΄ λ“± ν”„λ‘œλ•μ…˜ λ‹¨κ³„μ—μ„œ λ°œμƒν•˜λŠ” 병λͺ© 지점 해결을 λͺ©ν‘œλ‘œ 함.

Technical Solution

  • JSONL 기반의 Append-only write 및 Replay read ꡬ쑰λ₯Ό ν†΅ν•œ Session Persistence κ΅¬ν˜„
  • 5-tier Binding Table 섀계λ₯Ό ν†΅ν•œ Channel-Peer-Agent κ°„μ˜ μ •λ°€ν•œ Routing 및 격리 보μž₯
  • Write-ahead Queue와 Exponential Backoff μ „λž΅μ„ κ²°ν•©ν•œ Delivery μ‹œμŠ€ν…œμœΌλ‘œ λ©”μ‹œμ§€ 전솑 μ‹ λ’°μ„± 확보
  • Named Lane μ‹œμŠ€ν…œ λ„μž…μ„ ν†΅ν•œ μš”μ²­ 직렬화 및 Concurrency μ œμ–΄λ‘œ λ¦¬μ†ŒμŠ€ κ²½ν•© ν•΄κ²°
  • 3-layer Retry Onion ꡬ쑰와 Auth Profile Rotation 섀계λ₯Ό ν†΅ν•œ μ‹œμŠ€ν…œ Resilience κ°•ν™”
  • 8-layer Prompt Assembly 및 Hybrid Memory ꡬ쑰λ₯Ό ν†΅ν•œ Agent Intelligence 고도화

1. AI Agent 섀계 μ‹œ λ‹¨μˆœ 루프가 μ•„λ‹Œ Session-Gateway-Delivery둜 μ΄μ–΄μ§€λŠ” κ³„μΈ΅ν˜• νŒŒμ΄ν”„λΌμΈ κ²€ν† 

2. λ©”μ‹œμ§€ μœ μ‹€ λ°©μ§€λ₯Ό μœ„ν•΄ In-memory 큐 λŒ€μ‹  Write-ahead Log 기반의 전솑 λ©”μ»€λ‹ˆμ¦˜ 적용

3. LLM API의 Rate Limit λŒ€μ‘μ„ μœ„ν•œ Auth Profile Rotation 및 Retry μ „λž΅ 수립

4. 닀쀑 채널 톡합을 μœ„ν•΄ 각 ν”Œλž«νΌ λ©”μ‹œμ§€λ₯Ό 곡톡 InboundMessage μŠ€ν‚€λ§ˆλ‘œ 좔상화

원문 읽기