개념적 loop 는 SDK 와 동일 — request build → POST → response parse → if tool_calls: 실행 + append + POST 다시 → else: 텍스트 반환. 차이는 매 step 이 dev 가 instrument 가능하다는 것.
Hook 박을 곳
- Raw request body log (wire 검증)
- Raw response body log (debug)
- Parsed tool_call 결정 log (eval)
- Handler return 값 log (replay)
SDK 가 hide 하는 거 보임
매 step 의 raw shape — request 의 정확한 JSON, response 의 typed/untyped, tool result 의 wrapping (function_call_output vs tool-role message). 한 번 직접 wire 해 보면 SDK 의 magic 이 사라짐.
Production 가치
Per-iteration breakpoint hook(state) 같은 것 — SDK 로는 불가. Customer bug 를 captured wire trace 에서 reproduce, LLM gateway 와 통합 (gateway 가 'well-behaved HTTP client' 동작 기대), per-call instrumentation 다 raw level 에서.