Repository navigation
feat(ai-analyzer): tool-using agentic loop (Tier 1) - #84
Merged
Merged
Conversation
Closes #83. ai-analyzer 를 single-shot 호출에서 Bedrock Converse toolConfig 기반 agentic loop 로 전환. 모델이 1차 컨텍스트만으로 결론낼 수 있으면 즉시 종료, 추가 정보가 필요하면 read-only 도구로 직접 fetch. Tier 1 도구: - query_metrics(promql, lookback_minutes) — VictoriaMetrics 추가 조회 - query_logs(logql, lookback_minutes, limit) — Loki 추가 조회 - list_recent_alerts(window_minutes) — Alertmanager 활성 알람 (cascade 판별) 안전망: - AGENT_MAX_ITERATIONS=5 강제 종료 - 같은 (tool, args) 중복 호출 detect → 즉시 정리 후 break - Loki limit ≤ 500, lookback ≤ 360min schema clamp - 모든 도구 read-only - AGENT_ENABLED=false 로 토글 시 기존 single-shot 경로 fallback Slack 카드 footer 에 `agent_iters=N` 추가하여 운영 중 깊이 추적 가능. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
developowl
added a commit
that referenced
this pull request
Jun 25, 2026
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.
Closes #83.
Summary
ai-analyzer를 single-shot Bedrock 호출에서 agentic loop 로 전환. 모델이 1차 컨텍스트만으로 결론낼 수 있으면 그대로 종료(현행과 동일 latency/비용), 추가 정보가 필요하면 read-only 도구로 직접 fetch 후 다음 iteration 으로 진행.What
신규 도구 (Tier 1) — 모두 read-only, 기존 fetcher 재활용:
query_metricspromql,lookback_minutes(≤360)vm.fetch_promql(신규)query_logslogql,lookback_minutes(≤360),limit(≤500)loki.fetch_logql(신규)list_recent_alertswindow_minutes(≤360, 본인 fingerprint 제외)alertmanager.list_active(신규 파일)변경 파일:
안전망
AGENT_MAX_ITERATIONS=5강제 종료(tool, args)중복 호출 감지 → error 결과 inject 후 다음 turn 에 종료 유도limit ≤ 500, lookback≤ 360min스키마 clampAGENT_ENABLED=false토글 시 기존 single-shotanalyze()경로 그대로Why
기존 1-pass 한계:
agentic loop 시 시나리오:
Validation
py_compile통과helm template(chart values.yaml YAML lint 통과)Notes
AM_URL기본값http://alertmanager.alertmanager:9093은apps/metric-server/vmalert/values.yaml의 vmalert target 과 동일 — in-cluster service. Tailscale IP pinning 불필요.toolConfig지원. 현 default model (apac.amazon.nova-pro-v1:0) 그대로 호환.🤖 Generated with Claude Code