FEAT(app): add Korean language support

- Enable Korean language processing
- Add Korean prompt templates
This commit is contained in:
2025-12-24 18:52:03 +09:00
parent 48012c4864
commit 536db91511
7 changed files with 225 additions and 172 deletions

131
README.md
View File

@@ -1,32 +1,33 @@
# MAS (Multi-Agent System)
**K8s Infrastructure Planning System** - AI agents that analyze your Kubernetes cluster and generate implementation plans.
**K8s 인프라 분석 & 의사결정 시스템** - 클러스터를 분석하고 도구 도입 여부를 결정해주는 AI 시스템
## 🎯 What is this?
MAS는 Kubernetes 클러스터 상태를 분석하고, 인프라 배포 계획을 수립하는 AI 에이전트 시스템입니다.
MAS는 Kubernetes 클러스터 상태를 분석하고, **도구 도입 추천/비추천을 결정**해주는 AI 에이전트 시스템입니다.
**사용 시나리오:**
1. "Tekton 도입하고 싶어" → 클러스터 분석 → YAML 구조 설계 → 구현 가이드 생성
2. 생성된 Markdown 프롬프트를 복사해서 다른 AI (Claude Code, ChatGPT 등)에 붙여넣기
3. 실제 코드 구현은 다른 AI가 담당
1. "Tekton 도입 여부를 결정해줘" → 클러스터 분석 → **도입 추천/비추천 결정**
2. 한국어로 이유, 대안, 구현 가이드 제공
3. 기술적 세부사항 없이 **명확한 결론** 제시
## 🤖 Agents
### Planning Agent (Claude 4.5)
- 폴더 구조 설계 (deploy/tool/base, overlays/prod, etc.)
- YAML 파일 조직화
- K8s 리소스 계획 (Namespace, Deployment, Service, etc.)
- 도구 요구사항 분석
- 필요한 K8s 리소스 파악
- 확인이 필요한 클러스터 정보 정의
### Research Agent (Groq Llama 3.3)
- kubectl 명령어로 클러스터 상태 분석
- 기존 리소스 확인 (namespaces, storage classes, quotas)
- 호환성 검토
- 기존 도구 확인 (ArgoCD, Gitea, Prometheus 등)
- 리소스 사용률 및 버전 확인
### Prompt Generator (Claude 4.5)
- Markdown 형식의 구현 가이드 생성
- YAML 예시 포함
- 검증 명령어 제공
### Decision Agent (Claude 4.5)
- **도입 추천/비추천 결정** (한국어)
- 명확한 이유 제시
- 대안 제시 (비추천인 경우)
- 간단한 구현 가이드 (추천인 경우)
### Tech stack
- **Backend**: LangGraph + LangChain + FastAPI
@@ -213,53 +214,64 @@ Examples:
## 📝 Usage examples
### Example 1: Deploy Tekton
### Example 1: Tekton 도입 여부 결정
```text
User: "Tekton 도입하고 싶어"
User: "Tekton 도입 여부를 결정해줘"
🎼 Orchestrator:
→ routes to Planning Agent
🎼 Orchestrator → 조율
📋 Planning Agent:
designs folder structure: deploy/tekton/{base,overlays/prod}
plans K8s resources: Namespace, RBAC, Deployments, Services
identifies research needs
Tekton 요구사항: Namespace, CRDs, Controllers
필요 리소스: 2 CPU, 4GB RAM
확인 필요: 기존 CI/CD 도구, K8s 버전
🔍 Research Agent:
runs: kubectl get namespaces, kubectl get storageclasses
checks: existing tekton resources, cluster version
analyzes: available resources and quotas
→ kubectl get nodes: v1.33.6, 3 nodes ✓
kubectl get pods -A: ArgoCD 운영 중 발견
Gitea Actions 사용 가능 확인
📝 Prompt Generator:
→ generates comprehensive Markdown implementation guide
→ includes: YAML examples, folder structure, validation commands
💡 Decision Agent:
❌ Tekton 도입 비추천
✨ Output: Markdown prompt ready to copy-paste into Claude Code/ChatGPT
이유:
- ArgoCD + Gitea Actions로 충분
- 추가 리소스 소비 불필요
- 학습 곡선 및 유지보수 부담
대안:
- Gitea Actions 활용 (이미 설치됨)
- ArgoCD로 배포 자동화 유지
✨ Output: 명확한 한국어 보고서
```
### Example 2: Deploy Harbor Registry
### Example 2: Harbor 필요성 분석
```text
User: "Harbor를 배포하려고 해"
User: "Harbor가 필요한지 분석해줘"
→ Planning: folder structure + YAML organization
→ Research: storage classes, ingress controllers, TLS setup
Prompt Gen: Markdown guide with Harbor Helm values, ingress config, etc.
→ Planning: Harbor 요구사항 분석
→ Research: 기존 registry 확인 (Gitea Container Registry 발견)
Decision:
❌ Harbor 도입 비추천
이유: Gitea Container Registry로 충분
Copy the prompt → Paste into another AI → Get actual implementation
사용자 친화적 한국어 결론
```
### Example 3: Deploy Prometheus
### Example 3: Prometheus 설치 여부
```text
User: "Prometheus를 설치하고 싶어"
User: "Prometheus를 설치해야 할까?"
→ Planning: monitoring stack structure (Prometheus, Grafana, AlertManager)
→ Research: existing ServiceMonitors, PVC requirements
Prompt Gen: Complete implementation guide
→ Planning: Monitoring stack 요구사항
→ Research: 이미 Prometheus 운영 중 발견!
Decision:
✅ 이미 설치되어 있음
현재 상태: monitoring namespace에서 정상 작동 중
Result: Ready-to-use prompt for code generation
중복 설치 방지
```
---
@@ -267,19 +279,44 @@ User: "Prometheus를 설치하고 싶어"
## 🔧 Workflow
```
User Input: "Deploy X"
User Input: "X 도입 여부를 결정해줘"
Orchestrator (조율)
Planning Agent (구조 설계)
Planning Agent (도구 요구사항 분석)
Research Agent (클러스터 분석)
Research Agent (클러스터 상태 분석)
Prompt Generator (가이드 생성)
Decision Agent (한국어 의사결정 보고서)
Output: Markdown Implementation Guide
User copies → Pastes to Claude Code/ChatGPT → Gets actual code
Output: ✅ 추천 또는 ❌ 비추천 (이유 포함)
```
## 📊 출력 예시
```markdown
# Tekton 도입 분석 결과
## 📊 현재 클러스터 상태
- Kubernetes 버전: v1.33.6
- 노드: 3개 (1 control-plane, 2 workers)
- 기존 CI/CD: ArgoCD, Gitea Actions
- 운영 애플리케이션: 15개
## 💡 권장사항: Tekton 도입 비추천
### ❌ 비추천 이유
1. ArgoCD + Gitea Actions 조합으로 충분
2. 추가 리소스 소비 (2 CPU, 4GB RAM)
3. 학습 곡선 및 운영 부담 증가
### 🔄 권장 대안
- Gitea Actions로 빌드 파이프라인 구성
- ArgoCD로 GitOps 배포 유지
- 필요시 GitHub Actions 연동
## 🎯 결론
현재 인프라로 충분하며, Tekton 도입은 불필요합니다.
```
## 🤝 Contributing

View File

@@ -14,5 +14,5 @@ commonLabels:
# 이미지 태그 설정 (ArgoCD Image Updater가 자동으로 업데이트)
images:
- name: gitea0213.kro.kr/bluemayne/mas
newTag: main-sha-bcd28d7d2120843e827ee23014bc94b0b418d565
newTag: main-sha-5b5b04c48822deaeeb63dba29dfbf57d701ec159

View File

@@ -17,39 +17,35 @@ claude_orchestrator = ChatAnthropic(
)
ORCHESTRATOR_PROMPT = """You are the Orchestrator of a K8s Infrastructure Planning System.
ORCHESTRATOR_PROMPT = """You are the Orchestrator of a K8s Analysis & Decision System.
## Role
Coordinate agents to analyze K8s cluster and generate implementation plans.
Coordinate agents to analyze cluster and provide deployment recommendations.
## Available Agents
- planning: Design folder structure, YAML organization, K8s resources
- research: Analyze K8s cluster state (kubectl commands, resources, configs)
- prompt_generator: Generate Markdown implementation prompt for other AI assistants
- end: Complete the task and show final prompt
- planning: Understand what user wants to deploy and what info is needed
- research: Analyze K8s cluster state (kubectl commands)
- prompt_generator: Generate Korean recommendation report (추천/비추천 결정)
- end: Complete the task
## Workflow
1. User requests infrastructure deployment (e.g., "Deploy Tekton")
2. Delegate to **planning** agent (if no plan exists)
3. Delegate to **research** agent to analyze cluster state
4. Delegate to **prompt_generator** to create implementation prompt
5. End with final Markdown prompt for the user
1. User asks: "X를 도입하고 싶어" or "X 사용 여부를 결정해줘"
2. Planning → what would be needed for X
3. Research → analyze current cluster state
4. Prompt Generator → Korean recommendation (도입 추천/비추천)
5. End → show final decision to user
## Decision Logic
- No plan exists → NEXT_AGENT: planning
- Plan exists but no research → NEXT_AGENT: research
- Plan + research exist but no prompt → NEXT_AGENT: prompt_generator
- Prompt generated → NEXT_AGENT: end
- No plan → NEXT_AGENT: planning
- Plan exists, no research → NEXT_AGENT: research
- Research done, no recommendation → NEXT_AGENT: prompt_generator
- Recommendation ready → NEXT_AGENT: end
## Output Format
NEXT_AGENT: <agent_name>
REASON: <explanation>
REASON: <brief reason>
## Tools Available
- execute_host: Run kubectl commands on host (use sparingly, research agent handles this)
- execute_bash: Run commands in container
Limit iterations to 2 maximum. Keep workflow simple: planning → research → prompt_generator → end.
Keep workflow simple: planning → research → prompt_generator → end.
"""

View File

@@ -20,15 +20,14 @@ claude_planning = ChatAnthropic(
PLANNING_PROMPT = """You are the K8s Infrastructure Planning Agent.
## Role
Analyze user requests for Kubernetes infrastructure and create detailed implementation plans.
Analyze user requests for Kubernetes infrastructure and create implementation plans.
## Your Mission
When a user wants to deploy something (e.g., "Tekton", "Harbor", "Prometheus"):
1. Understand what they want to deploy
2. Design the folder structure for K8s manifests
3. Plan YAML file organization
4. Identify what K8s resources are needed
5. Determine what information to gather from their cluster
2. Design high-level folder structure
3. Identify what K8s resources would be needed
4. Determine what cluster information to gather
## Output Format (JSON)
```json
@@ -38,12 +37,7 @@ When a user wants to deploy something (e.g., "Tekton", "Harbor", "Prometheus"):
"target_tool": "Name of the tool/service to deploy",
"folder_structure": {
"base_path": "deploy/X",
"directories": ["base", "overlays/prod", "overlays/dev"],
"files": {
"base/deployment.yaml": "Main deployment manifest",
"base/service.yaml": "Service definition",
"base/kustomization.yaml": "Kustomize base"
}
"directories": ["base", "overlays/prod"]
},
"k8s_resources": [
{"type": "Namespace", "name": "X"},
@@ -51,18 +45,20 @@ When a user wants to deploy something (e.g., "Tekton", "Harbor", "Prometheus"):
{"type": "Service", "name": "X-svc"}
],
"research_needed": [
"Check existing namespaces",
"Verify storage classes available",
"Check current resource quotas"
"Check Kubernetes version",
"Check existing similar tools",
"Verify available resources",
"Check storage classes"
],
"implementation_steps": [
{"step": 1, "description": "Create namespace and RBAC", "files": ["namespace.yaml", "serviceaccount.yaml"]},
{"step": 2, "description": "Deploy core components", "files": ["deployment.yaml", "service.yaml"]}
]
"requirements": {
"min_k8s_version": "1.24",
"estimated_resources": {"cpu": "2", "memory": "4Gi"},
"dependencies": ["tool1", "tool2"]
}
}
```
Focus on K8s best practices: namespaces, RBAC, resource limits, health checks, and GitOps compatibility.
Keep it simple and high-level. Focus on what needs to be checked, not detailed YAML structures.
"""

View File

@@ -17,74 +17,82 @@ claude_prompt_gen = ChatAnthropic(
)
PROMPT_GENERATOR_SYSTEM = """You are the Prompt Generator Agent.
PROMPT_GENERATOR_SYSTEM = """You are the Decision & Recommendation Agent.
## Role
Generate implementation prompts for other AI assistants (like Claude Code, ChatGPT, etc.).
Analyze cluster state and provide user-friendly recommendations in Korean.
## Input
- Planning data: folder structure, YAML files, K8s resources
- Planning data: what would be needed if deploying
- Research data: current cluster state, existing resources
## Output Format (Markdown)
Create a comprehensive prompt that another AI can use to implement the infrastructure:
## Output Format (Korean Markdown)
Create a user-friendly analysis report:
```markdown
# Deploy [TOOL_NAME] to Kubernetes
# [도구명] 도입 분석 결과
## Context
[Brief description of current cluster state from research data]
## 📊 현재 클러스터 상태
- **Kubernetes 버전**: [version]
- **노드 구성**: [nodes info]
- **기존 도구**: [existing tools like ArgoCD, Gitea, etc.]
- **운영 중인 애플리케이션**: [number and types]
- **리소스 사용률**: [if available]
## Folder Structure
Create the following directory structure:
```
## 💡 권장사항: [도입 추천 / 도입 비추천]
### ✅ 도입을 추천하는 이유 (또는 ❌ 도입을 비추천하는 이유)
1. [이유 1]
2. [이유 2]
3. [이유 3]
### 🔄 대안 (도입 비추천인 경우)
- [대안 1]: [설명]
- [대안 2]: [설명]
### 📌 도입 시 고려사항 (도입 추천인 경우)
- **필요 리소스**: [CPU, Memory]
- **예상 작업 시간**: [time estimate]
- **복잡도**: [난이도]
- **유지보수 부담**: [maintenance effort]
## 🎯 결론
[1-2문장으로 최종 권장사항 요약]
---
## 📁 구현 가이드 (도입하기로 결정한 경우)
### 폴더 구조
\`\`\`
deploy/[tool]/
├── base/
│ ├── namespace.yaml
│ ├── deployment.yaml
│ ├── service.yaml
│ └── kustomization.yaml
└── overlays/
└── prod/
└── kustomization.yaml
```
└── overlays/prod/
└── kustomization.yaml
\`\`\`
## Implementation Steps
### 주요 단계
1. [Step 1 설명]
2. [Step 2 설명]
3. [Step 3 설명]
### Step 1: [Title]
**File:** `deploy/[tool]/base/namespace.yaml`
```yaml
[Example YAML with placeholders]
```
### Step 2: [Title]
**File:** `deploy/[tool]/base/deployment.yaml`
```yaml
[Example YAML with specific recommendations]
```
## Key Considerations
- Resource limits: [specific recommendations based on cluster]
- Storage: [based on available StorageClasses]
- Networking: [based on existing services]
- RBAC: [specific permissions needed]
## Validation Commands
```bash
kubectl apply -k deploy/[tool]/overlays/prod
### 검증 방법
\`\`\`bash
kubectl get pods -n [namespace]
kubectl logs -n [namespace] deployment/[name]
```
## Expected Outcome
[What should be running after implementation]
kubectl get svc -n [namespace]
\`\`\`
```
## Guidelines
1. Be specific and actionable
2. Include actual YAML examples (not just descriptions)
3. Reference the cluster's current state from research data
4. Provide validation steps
5. Make it copy-paste ready for another AI
1. **한국어로 작성** (모든 내용)
2. **명확한 결론** 제시 (추천/비추천)
3. **구체적인 이유** 제공
4. **YAML 코드 제외** (폴더 구조만 간단히)
5. **사용자 친화적** (기술 용어 최소화)
6. 이모지 사용으로 가독성 향상
"""
@@ -110,22 +118,27 @@ def prompt_generator_node(state: AgentState) -> AgentState:
# Claude 호출
response = claude_prompt_gen.invoke([
SystemMessage(content=PROMPT_GENERATOR_SYSTEM),
HumanMessage(content=f"""Generate an implementation prompt for this request:
HumanMessage(content=f"""사용자 요청에 대한 분석 결과를 한국어로 작성해주세요:
**User Request:** {user_request}
**사용자 요청:** {user_request}
**Planning Data:**
**계획 데이터:**
```json
{plan_summary}
```
**Research Data (Cluster State):**
**클러스터 분석 결과:**
```json
{research_summary}
```
Create a comprehensive Markdown prompt that another AI can use to implement this infrastructure.
Include specific YAML examples, folder structure, and validation steps.
위 정보를 바탕으로:
1. 현재 클러스터 상태 요약
2. 도입 추천/비추천 결정 (명확한 이유와 함께)
3. 대안 제시 (비추천인 경우) 또는 구현 가이드 (추천인 경우)
4. 최종 결론
**중요**: 한국어로 작성하고, YAML 코드는 제외하고, 사용자 친화적으로 작성해주세요.
""")
])

View File

@@ -20,27 +20,37 @@ groq_research = ChatOpenAI(
)
RESEARCH_PROMPT = """Research Agent: Collect system info via commands.
RESEARCH_PROMPT = """Research Agent: Analyze Kubernetes cluster state.
Request commands in JSON:
{"commands": [{"tool": "execute_host", "command": "kubectl get nodes", "use_sudo": true}]}
Rules:
- Request 1-2 commands at a time
- Use execute_host for kubectl/git, execute_bash for container
- Use execute_host for kubectl commands (with use_sudo: true)
- Focus on: version, existing tools, resources, nodes
- Output ONLY JSON when requesting commands
Final report format:
Final report format (Korean):
{
"summary": "Brief findings",
"findings": [{"category": "...", "data": "..."}],
"recommendations": ["..."],
"tekton_recommendation": {
"should_use": true/false,
"reasons": ["..."],
"alternatives": ["..."]
"summary": "클러스터 상태 요약",
"cluster_info": {
"k8s_version": "v1.x.x",
"nodes": "3 nodes (1 control-plane, 2 workers)",
"existing_tools": ["ArgoCD", "Gitea", "Prometheus"]
},
"findings": [
{"category": "기존 CI/CD", "data": "ArgoCD 운영 중"},
{"category": "리소스", "data": "충분한 여유 있음"}
],
"recommendation": {
"deploy": true/false,
"reasons": ["이유1", "이유2"],
"alternatives": ["대안1", "대안2"]
}
}
Keep findings concise and actionable. Focus on decision-making data.
"""

View File

@@ -22,20 +22,21 @@ except:
async def start():
"""채팅 시작 시"""
await cl.Message(
content="☸️ **K8s Infrastructure Planning System v3.0**에 오신 것을 환영합니다!\n\n"
"당신의 Kubernetes 클러스터 상태를 분석하고 인프라 배포 계획을 수립해드립니다.\n\n"
"**에이전트 팀**\n"
"- 🎼 **Orchestrator** (Claude 4.5): 전체 워크플로우 조율\n"
"- 📋 **Planning Agent** (Claude 4.5): 폴더 구조 & YAML 설계\n"
"- 🔍 **Research Agent** (Groq): K8s 클러스터 상태 분석\n"
"- 📝 **Prompt Generator** (Claude 4.5): 구현 가이드 생성\n\n"
content="☸️ **K8s 인프라 분석 & 의사결정 시스템**에 오신 것을 환영합니다!\n\n"
"클러스터를 분석하고, 도구 도입 여부를 결정해드립니다.\n\n"
"**어떻게 작동하나요?**\n"
"1. 📋 도구 분석 → 2. 🔍 클러스터 상태 확인 → 3. 💡 추천/비추천 결정\n\n"
"**사용 예시**\n"
"```\n"
"Tekton 도입하고 싶어\n"
"Harbor를 배포하려고 해\n"
"Prometheus를 설치하고 싶어\n"
"Tekton 도입 여부를 결정해줘\n"
"Harbor가 필요한지 분석해줘\n"
"Prometheus를 설치해야 할까?\n"
"```\n\n"
"배포하고 싶은 도구를 알려주세요!"
"**결과물**\n"
"✅ 도입 추천 또는 ❌ 도입 비추천 (이유 포함)\n"
"🔄 대안 제시\n"
"📌 구현 가이드 (도입하는 경우)\n\n"
"궁금한 도구를 알려주세요!"
).send()
@@ -90,9 +91,9 @@ async def main(message: cl.Message):
}
agent_display_names = {
"planning": "인프라 계획 수립",
"planning": "도구 요구사항 분석",
"research": "클러스터 상태 분석",
"prompt_generator": "구현 가이드 생성"
"prompt_generator": "의사결정 보고서 생성"
}
icon = agent_icons.get(agent_name, "🤖")
@@ -115,10 +116,10 @@ async def main(message: cl.Message):
# Orchestrator는 간단한 상태 메시지만 표시
current_agent = state.get("current_agent", "")
status_icons = {
"planning": "📋 인프라 계획 수립 중...",
"planning": "📋 도구 요구사항 분석 중...",
"research": "🔍 클러스터 상태 분석 중...",
"prompt_generator": "📝 구현 가이드 생성 중...",
"end": "✨ 완료! 아래 프롬프트를 복사하여 사용하세요."
"prompt_generator": "💡 의사결정 보고서 생성 중...",
"end": "분석 완료!"
}
status_text = status_icons.get(current_agent, "⏳ 작업 중...")
status_msg.content = status_text
@@ -149,10 +150,10 @@ async def setup_agent(settings):
def rename(orig_author: str):
"""에이전트 이름 매핑"""
rename_dict = {
"orchestrator": "Orchestrator (Claude 4.5)",
"planning": "Planning Agent (Claude 4.5)",
"research": "Research Agent (Groq)",
"prompt_generator": "Prompt Generator (Claude 4.5)"
"orchestrator": "조율자 (Claude 4.5)",
"planning": "요구사항 분석 (Claude 4.5)",
"research": "클러스터 분석 (Groq)",
"prompt_generator": "의사결정 (Claude 4.5)"
}
return rename_dict.get(orig_author, orig_author)