Repository navigation
fix(ai-analyzer): enforce tool-call vs text mode in agent system prompt - #86
Merged
Merged
Conversation
PR #84 검증에서 세 케이스 모두 agent_iters=1 로 끝났는데, 본문에 `query_metrics(promql=...)`, `query_logs(logql=...)` 같이 도구 이름을 텍스트로 박아 운영자 명령어처럼 제시함. tool call 을 발행하지 않고 응답으로 직접 작성한 결과. 원인: 기존 system prompt 가 "출력 형식: 명령어 bullet" 으로 텍스트 응답을 강하게 박아두어, 도구 이름을 그 형식에 맞춰 명령어처럼 출력하는 경향. 도구 사용 지침이 출력 형식 섹션보다 약했음. Fix: - "두 가지 모드" 섹션 신설 — (A) tool call 발행 vs (B) 최종 답변 작성. 한 turn 에 둘 중 하나만 한다고 명시. - (A) 모드 안에 "도구 이름을 텍스트로 적지 말 것" 강조. - (B) 모드 안에 "agent 도구 이름은 등장 X, 실제 kubectl/LogQL/PromQL 만" 명시. - 모드 선택 기준을 별도 섹션으로 추출. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #84 검증에서 agent 가 도구를 호출하는 대신 도구 이름을 텍스트로 운영자 명령어처럼 박는 현상 발견. system prompt 를 "두 가지 모드" 구조로 재작성해 turn 단위로 tool call 또는 최종 답변 중 하나만 발행하도록 강제.
Why
PR #84 검증 결과 (3 케이스 모두):
→
tool_use가 아닌end_turn으로 즉시 종료, 본문에query_logs(...)query_metrics(...)같은 도구 이름을 텍스트로 박음. 의도된 동작 (tool call 발행) 이 아님.원인: 기존 prompt 가 출력 형식 ("운영자가 실행할 명령어 bullet 2-4개") 을 강하게 박아두고, 도구 사용 지침이 그 아래 약하게 들어가 있어 모델이 도구를 호출하는 메커니즘 대신 그 형식에 맞춰 텍스트로 출력하는 경향.
What
system prompt 를 두 모드로 명확히 분리:
Validation
머지 + 새 image 빌드 + ArgoCD sync 후, 같은 3 케이스 (simple/ambiguous/cascade) 로 재 검증:
agent_iters=1,stopReason=end_turn, 본문에 도구 이름 텍스트 Xagent_iters≥2, 첫 iterstopReason=tool_uselist_recent_alerts호출 기대Notes
analyze_agentic()/TOOL_SCHEMAS/_dispatch_tool()모두 그대로AGENT_ENABLED=false토글로 즉시 single-shot fallback 가능 (기존 안전망 유지)🤖 Generated with Claude Code