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

121 lines
3.2 KiB
Markdown

---
phase: 04
name: Model Routing & Agent Loop
wave: 1
depends_on: [03]
files_modified:
- openclaude/settings.json
- scripts/test_agent_loop.py
autonomous: true
requirements: [ROUTE-01, ROUTE-02, AGENT-01, AGENT-02]
---
# Phase 04: Model Routing & Agent Loop — PLAN
<objective>
OpenClaude의 agentRouting을 5-Tier Variet Engine용으로 설정하고, 실제 도구 호출(bash, file read/write)이 포함된 에이전트 루프를 검증한다.
</objective>
<tasks>
<task id="1" title="Configure agentModels and agentRouting in settings.json">
<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>
<action>
1. ~/.claude/settings.json에 agentModels + agentRouting 설정 추가.
Variet Engine은 단일 모델만 동시 로드하므로, 모든 모델이 같은 base_url을 가리킨다.
핫스왑은 별도 API 호출(`/engine/switch/{role}`)로 처리.
```json
{
"agentModels": {
"variet-fast": {
"base_url": "http://192.168.10.4:8000/v1",
"api_key": "variet-local"
}
},
"agentRouting": {
"default": "variet-fast"
}
}
```
2. 설정 파일 경로 확인 (Windows): `%USERPROFILE%\.claude\settings.json`
</action>
<acceptance_criteria>
- settings.json에 `agentModels` 키가 존재한다
- settings.json에 `agentRouting` 키가 존재한다
- `agentRouting.default`가 agentModels의 키를 참조한다
</acceptance_criteria>
</task>
<task id="2" title="Test model hot-swap via API">
<read_first>
- engine/variet_engine.py (/engine/switch endpoint)
- config/engine_models.json (available roles)
</read_first>
<action>
1. 현재 모델 확인:
GET http://127.0.0.1:8000/engine/status
2. balanced 모델로 핫스왑:
POST http://127.0.0.1:8000/engine/switch/balanced
3. 로딩 대기 후 상태 확인:
GET http://127.0.0.1:8000/engine/health (state=ready 될 때까지 폴링)
4. balanced 모델로 추론 테스트:
POST /v1/chat/completions with "What is 2+2?"
5. fast 모델로 복귀:
POST http://127.0.0.1:8000/engine/switch/fast
</action>
<acceptance_criteria>
- /engine/switch/balanced 호출 시 `"status": "switching"` 응답
- balanced 로딩 완료 후 /engine/status에서 `"role": "balanced"` 확인
- balanced 모델로 추론 응답 수신
- fast 복귀 후 /engine/status에서 `"role": "fast"` 확인
</acceptance_criteria>
</task>
<task id="3" title="Validate full agent loop with tool calls">
<read_first>
- openclaude/.env
</read_first>
<action>
1. OpenClaude --print 모드로 도구 호출 테스트:
```
openclaude --print "List the files in the current directory using bash"
```
2. 파일 읽기 도구 테스트:
```
openclaude --print "Read the contents of package.json and tell me the version"
```
3. 스트리밍 응답이 실시간 출력되는지 확인
</action>
<acceptance_criteria>
- 프롬프트에 대해 LLM이 도구 호출(bash 또는 file read)을 시도한다
- 도구 실행 결과가 LLM에 전달되어 최종 응답이 생성된다
- 스트리밍 출력이 터미널에 실시간으로 표시된다
</acceptance_criteria>
</task>
</tasks>