CrewAI Agile
CrewAI Multi-Agent AI Agile Scrum Kanban Sprint Planning Product Owner Scrum Master Developer QA DevOps Automation LLM GPT-4
| Agent | Role | Goal | Tools |
|---|---|---|---|
| Product Owner | จัดลำดับ Backlog | Maximize Value Delivery | Jira API, Analysis |
| Scrum Master | จัดการ Sprint | Remove Blockers, Improve Process | Board API, Metrics |
| Developer | เขียน Code | Deliver Quality Code | Code Tools, Git |
| QA Engineer | ทดสอบ | Ensure Quality | Test Framework |
| DevOps | Deploy Monitor | Reliable Infrastructure | K8s, CI/CD, Monitor |
Agent Configuration
# === CrewAI Agile Team Setup ===
# pip install crewai crewai-tools
from dataclasses import dataclass
# from crewai import Agent, Task, Crew, Process
# from crewai_tools import SerperDevTool, FileReadTool
# product_owner = Agent(
# role="Product Owner",
# goal="Analyze user stories, prioritize backlog by business value",
# backstory="Senior Product Manager with 10 years experience in Agile. "
# "Expert at breaking down requirements into actionable stories.",
# tools=[SerperDevTool()],
# llm="gpt-4",
# verbose=True,
# allow_delegation=True
# )
#
# scrum_master = Agent(
# role="Scrum Master",
# goal="Plan sprints, track progress, remove blockers, improve velocity",
# backstory="Certified Scrum Master with expertise in Kanban and metrics. "
# "Focused on team productivity and continuous improvement.",
# tools=[],
# llm="gpt-4",
# verbose=True,
# allow_delegation=True
# )
#
# developer = Agent(
# role="Senior Developer",
# goal="Write clean, tested code that implements user stories",
# backstory="Full-stack developer with 8 years experience. "
# "Expert in Python, TypeScript, and cloud architecture.",
# tools=[FileReadTool()],
# llm="gpt-4",
# verbose=True
# )
#
# qa_engineer = Agent(
# role="QA Engineer",
# goal="Create test plans, find bugs, ensure quality standards",
# backstory="QA specialist focused on automated testing and quality gates.",
# tools=[],
# llm="gpt-4",
# verbose=True
# )
@dataclass
class AgentConfig:
role: str
goal: str
tools: str
delegation: bool
key_tasks: str
agents = [
AgentConfig("Product Owner",
"Maximize Value Delivery through Backlog Prioritization",
"Jira API, Market Research, User Analytics",
True,
"Story Writing, Backlog Grooming, Sprint Goal, Acceptance Criteria"),
AgentConfig("Scrum Master",
"Improve Team Velocity and Remove Blockers",
"Board API, Metrics Dashboard, Communication",
True,
"Sprint Planning, Daily Standup, Retrospective, Velocity Report"),
AgentConfig("Developer",
"Deliver Quality Code on Time",
"Code Editor, Git, Test Runner, Linter",
False,
"Implementation, Code Review, Refactoring, Documentation"),
AgentConfig("QA Engineer",
"Ensure Product Quality Before Release",
"Test Framework, Bug Tracker, Performance Tool",
False,
"Test Plan, Test Execution, Bug Report, Regression Test"),
AgentConfig("DevOps Engineer",
"Reliable CI/CD and Infrastructure",
"K8s, Docker, Terraform, Monitoring",
False,
"Pipeline Setup, Deploy, Monitor, Incident Response"),
]
print("=== Agent Configs ===")
for a in agents:
print(f"\n [{a.role}] Goal: {a.goal}")
print(f" Tools: {a.tools}")
print(f" Delegation: {a.delegation}")
print(f" Tasks: {a.key_tasks}")
Sprint Workflow
# === Sprint Workflow with CrewAI ===
# Sprint Planning Task
# planning_task = Task(
# description="Analyze the product backlog and plan Sprint 5. "
# "Select stories worth 40 story points. "
# "Consider team velocity of 38 points/sprint.",
# expected_output="Sprint 5 plan with selected stories, "
# "assignments, and sprint goal",
# agent=scrum_master
# )
#
# development_task = Task(
# description="Implement the top priority story: "
# "As a user, I want to filter products by category",
# expected_output="Implementation plan with code structure, "
# "API endpoints, and database schema changes",
# agent=developer
# )
#
# testing_task = Task(
# description="Create test plan for the product filter feature. "
# "Include unit tests, integration tests, and E2E tests.",
# expected_output="Complete test plan with test cases, "
# "expected results, and automation scripts",
# agent=qa_engineer
# )
#
# crew = Crew(
# agents=[product_owner, scrum_master, developer, qa_engineer],
# tasks=[planning_task, development_task, testing_task],
# process=Process.sequential,
# verbose=True
# )
# result = crew.kickoff()
@dataclass
class SprintPhase:
phase: str
agent: str
input_data: str
output: str
duration: str
phases = [
SprintPhase("Backlog Grooming",
"Product Owner",
"Raw Requirements, User Feedback, Market Research",
"Prioritized Backlog with Story Points",
"2 ชั่วโมง"),
SprintPhase("Sprint Planning",
"Scrum Master + Team",
"Prioritized Backlog, Team Velocity (38 pts)",
"Sprint Goal, Selected Stories, Assignments",
"2-4 ชั่วโมง"),
SprintPhase("Development",
"Developer",
"Sprint Backlog, Acceptance Criteria",
"Working Code, Unit Tests, PR",
"8-9 วัน"),
SprintPhase("Testing",
"QA Engineer",
"Working Code, Test Plan",
"Test Results, Bug Reports, Sign-off",
"1-2 วัน (ขนานกับ Dev)"),
SprintPhase("Sprint Review",
"Product Owner + Team",
"Working Increment, Sprint Goal",
"Demo Feedback, Backlog Updates",
"1-2 ชั่วโมง"),
SprintPhase("Retrospective",
"Scrum Master + Team",
"Sprint Metrics, Team Feedback",
"Action Items, Process Improvements",
"1 ชั่วโมง"),
]
print("=== Sprint Phases ===")
for p in phases:
print(f"\n [{p.phase}] Agent: {p.agent}")
print(f" Input: {p.input_data}")
print(f" Output: {p.output}")
print(f" Duration: {p.duration}")
Kanban Metrics
# === Kanban Metrics Analysis ===
@dataclass
class KanbanMetric:
metric: str
formula: str
target: str
agent_action: str
metrics = [
KanbanMetric("Cycle Time",
"เวลาจาก In Progress → Done",
"< 3 วัน สำหรับ Story ปกติ",
"Agent วิเคราะห์ Story ที่เกิน Target แนะนำ Split"),
KanbanMetric("Lead Time",
"เวลาจาก To Do → Done",
"< 5 วัน สำหรับ Story ปกติ",
"Agent วิเคราะห์ Queue Time แนะนำ WIP Limit"),
KanbanMetric("WIP (Work in Progress)",
"จำนวน Story ที่ In Progress",
"≤ Team Size (5-7)",
"Agent Alert เมื่อเกิน WIP Limit"),
KanbanMetric("Throughput",
"จำนวน Story Done ต่อสัปดาห์",
"> 8 stories/sprint",
"Agent Track Trend แนะนำ Improvement"),
KanbanMetric("Velocity",
"Story Points Done ต่อ Sprint",
"Stable ±10% จาก Average",
"Agent คำนวณ Velocity สำหรับ Planning"),
KanbanMetric("Blocked Items",
"จำนวน Story ที่ Blocked",
"0 (ไม่มี Blocked)",
"Agent Alert Scrum Master ทันทีเมื่อมี Block"),
]
print("=== Kanban Metrics ===")
for m in metrics:
print(f" [{m.metric}] {m.formula}")
print(f" Target: {m.target}")
print(f" Agent: {m.agent_action}")
เคล็ดลับ
- Role: กำหนด Role ชัดเจน Agent ทำงานตรงบทบาท
- Backstory: เขียน Backstory ละเอียด Agent ให้ผลลัพธ์ดีขึ้น
- Sequential: ใช้ Sequential Process สำหรับ Workflow ที่ต้องทำตามลำดับ
- Tools: ให้ Agent มี Tools เฉพาะที่จำเป็น ไม่ให้เกินไป
- Memory: เปิด Memory ให้ Agent จำ Context จาก Sprint ก่อน
CrewAI คืออะไร
Python Framework Multi-Agent AI Team Role Goal Backstory Tools LLM GPT-4 Sequential Hierarchical Process pip install crewai Automation
ใช้กับ Agile อย่างไร
Product Owner Scrum Master Developer QA DevOps Agent Sprint Planning Daily Review Retrospective Kanban Board Backlog Priority
ตั้งค่า Agent อย่างไร
Agent role goal backstory tools llm verbose delegation Task description expected_output Crew agents tasks process kickoff
Kanban Board ทำอย่างไร
To Do In Progress Review Done WIP Limit Cycle Time Lead Time Throughput Velocity Blocked Agent Monitor Jira Trello API Callback Memory
สรุป
CrewAI Multi-Agent Agile Scrum Kanban Sprint Agent Role Task Crew Sequential Velocity Cycle Time WIP Limit Automation LLM GPT-4
