Files
variet_llm/.planning/phases/04-model-routing-agent-loop/04-PLAN.md

3.2 KiB

phase, name, wave, depends_on, files_modified, autonomous, requirements
phase name wave depends_on files_modified autonomous requirements
04 Model Routing & Agent Loop 1
03
openclaude/settings.json
scripts/test_agent_loop.py
true
ROUTE-01
ROUTE-02
AGENT-01
AGENT-02

Phase 04: Model Routing & Agent Loop — PLAN

OpenClaude의 agentRouting을 5-Tier Variet Engine용으로 설정하고, 실제 도구 호출(bash, file read/write)이 포함된 에이전트 루프를 검증한다.

<read_first>

  • openclaude/src/services/api/agentRouting.ts (routing resolution logic)
  • openclaude/README.md (Agent Routing section)
  • config/engine_models.json (5-tier model roles) </read_first>
1. ~/.claude/settings.json에 agentModels + agentRouting 설정 추가. Variet Engine은 단일 모델만 동시 로드하므로, 모든 모델이 같은 base_url을 가리킨다. 핫스왑은 별도 API 호출(`/engine/switch/{role}`)로 처리.
{
  "agentModels": {
    "variet-fast": {
      "base_url": "http://192.168.10.4:8000/v1",
      "api_key": "variet-local"
    }
  },
  "agentRouting": {
    "default": "variet-fast"
  }
}
  1. 설정 파일 경로 확인 (Windows): %USERPROFILE%\.claude\settings.json

<acceptance_criteria>

  • settings.json에 agentModels 키가 존재한다
  • settings.json에 agentRouting 키가 존재한다
  • agentRouting.default가 agentModels의 키를 참조한다 </acceptance_criteria>

<read_first>

  • engine/variet_engine.py (/engine/switch endpoint)
  • config/engine_models.json (available roles) </read_first>
1. 현재 모델 확인: GET http://127.0.0.1:8000/engine/status
  1. balanced 모델로 핫스왑: POST http://127.0.0.1:8000/engine/switch/balanced

  2. 로딩 대기 후 상태 확인: GET http://127.0.0.1:8000/engine/health (state=ready 될 때까지 폴링)

  3. balanced 모델로 추론 테스트: POST /v1/chat/completions with "What is 2+2?"

  4. fast 모델로 복귀: POST http://127.0.0.1:8000/engine/switch/fast

<acceptance_criteria>

  • /engine/switch/balanced 호출 시 "status": "switching" 응답
  • balanced 로딩 완료 후 /engine/status에서 "role": "balanced" 확인
  • balanced 모델로 추론 응답 수신
  • fast 복귀 후 /engine/status에서 "role": "fast" 확인 </acceptance_criteria>

<read_first>

  • openclaude/.env </read_first>
1. OpenClaude --print 모드로 도구 호출 테스트: ``` openclaude --print "List the files in the current directory using bash" ```
  1. 파일 읽기 도구 테스트:

    openclaude --print "Read the contents of package.json and tell me the version"
    
  2. 스트리밍 응답이 실시간 출력되는지 확인

<acceptance_criteria>

  • 프롬프트에 대해 LLM이 도구 호출(bash 또는 file read)을 시도한다
  • 도구 실행 결과가 LLM에 전달되어 최종 응답이 생성된다
  • 스트리밍 출력이 터미널에 실시간으로 표시된다 </acceptance_criteria>