피드로 돌아가기
Your schema validation passes and the agent still picks the wrong tool. The bug is semantic.
Dev.toDev.to
AI/ML

Schema Validation 한계 극복을 통한 Tool-call 오류 77.5% 정밀 진단 및 해결

Your schema validation passes and the agent still picks the wrong tool. The bug is semantic.

James O'Connor2026년 6월 10일2intermediate

Context

Pydantic 기반의 JSON-schema 검증만으로는 Agent의 Tool-call 실패를 방지하는 데 한계 노출. Structural Validation은 데이터 타입과 필수 필드만 확인하므로, 사용자 의도와 무관한 도구 선택이나 논리적으로 잘못된 인자 값 전달과 같은 Semantic Error를 감지하지 못하는 아키텍처적 맹점 존재.

Technical Solution

  • Structural Validation 통과 후 실행되는 Deterministic Precheck 단계 도입을 통한 런타임 상태 검증
  • 모델 의존성을 배제한 Model-agnostic 로직을 통해 호출된 Tool의 전제 조건과 Resolved State의 일치 여부 확인 -destructive tool 실행 전 유효한 ID 소유권 및 상태(예: CANCELABLE)를 확인하는 비즈니스 로직 강제
  • Intent Understanding 오류로 인한 잘못된 Tool 선택 문제는 LLM Judge의 유사한 취약점 고려하여 Human-in-the-loop 기반의 Confirmation 단계로 대체
  • Model Family를 교차 적용하여 Judge 모델의 편향성을 최소화하는 전략 검토

- Tool-call 실패 로그를 Structural vs Semantic 오류로 분류하여 실제 병목 지점 파악 - 모델 실행 전 호출 인자와 현재 시스템 상태를 비교하는 Deterministic Precheck 함수 구현 - 고위험 API 호출 시 LLM Judge 대신 명시적인 사용자 Confirmation UI 도입 - 검증 모델 도입 시 메인 에이전트와 다른 Model Family를 선택하여 판단 오류의 상관관계 제거

원문 읽기