94 lines
3.9 KiB
Python
94 lines
3.9 KiB
Python
"""
|
|
Example: End-to-End Scrum Feature Sprint with Multi-Agent Orchestration
|
|
|
|
Demonstrates a complete sprint execution where specialized agents collaborate:
|
|
1. Product Owner defines the User Story & Acceptance Criteria
|
|
2. Tech Lead / Architect specifies the API contract
|
|
3. Backend and Frontend Developers implement in parallel
|
|
4. QA Engineer validates tests and criteria
|
|
5. Code Reviewer verifies Definition of Done
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add scripts directory to path
|
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../scripts")))
|
|
|
|
from scrum_orchestrator import ScrumSprintOrchestrator, ScrumRole, StoryStatus
|
|
|
|
|
|
def run_scrum_simulation():
|
|
print("=" * 60)
|
|
print("Starting Scrum Sprint Simulation with Multi-Agent Team")
|
|
print("=" * 60)
|
|
|
|
# 1. Initialize Sprint
|
|
orchestrator = ScrumSprintOrchestrator(
|
|
sprint_name="Sprint 1 - Authentication & User Profile",
|
|
sprint_goal="Deliver secure JWT authentication and user profile view"
|
|
)
|
|
|
|
# 2. Product Owner creates User Story
|
|
story = orchestrator.add_story(
|
|
title="User Login and Profile Display",
|
|
description="As an intranet user, I want to authenticate securely and view my profile.",
|
|
acceptance_criteria=[
|
|
"Given valid credentials, when submitting the login form, the user receives a JWT token.",
|
|
"Given an authenticated session, the user profile page renders avatar, name, and email.",
|
|
"Given invalid credentials, a clear accessible error toast is shown."
|
|
],
|
|
story_points=3
|
|
)
|
|
print(f"\n[Product Owner] Created Story: {story.story_id} - {story.title}")
|
|
for ac in story.acceptance_criteria:
|
|
print(f" ✓ AC: {ac}")
|
|
|
|
# 3. Scrum Master plans workflow DAG
|
|
workflow_plan = orchestrator.plan_sprint_workflow(story)
|
|
print("\n[Scrum Master] Generated Sprint Workflow Plan:")
|
|
for step in workflow_plan["phases"]:
|
|
deps = f" (Depends on: {', '.join(step['depends_on'])})" if step["depends_on"] else " (Root task)"
|
|
print(f" → [{step['phase']}] Assigned to: {step['role']}{deps}")
|
|
|
|
# 4. Tech Lead drafts API Contract
|
|
api_contract = {
|
|
"endpoint": "/api/v1/auth/login",
|
|
"method": "POST",
|
|
"request": {"username": "str", "password": "str"},
|
|
"response": {"token": "str", "user": {"id": "str", "name": "str", "email": "str"}}
|
|
}
|
|
orchestrator.memory.write("api_contract", api_contract)
|
|
print("\n[Tech Lead] Published API Contract to Shared Memory.")
|
|
|
|
# 5. Parallel Execution: Backend & Frontend
|
|
print("\n[Orchestrator] Dispatching Parallel Development Tasks...")
|
|
# Backend Worker
|
|
contract = orchestrator.memory.read("api_contract")
|
|
print(f" [Backend Dev] Implementing endpoint {contract['endpoint']} matching schema...")
|
|
orchestrator.memory.write("backend_status", "COMPLETED_WITH_TEST_ENDPOINT")
|
|
|
|
# Frontend Worker
|
|
print(f" [Frontend Dev] Building Login Form & Profile View matching contract...")
|
|
orchestrator.memory.write("frontend_status", "COMPLETED_WITH_UI_COMPONENTS")
|
|
|
|
# 6. QA Verification
|
|
print("\n[QA Engineer] Running Test Suite against Acceptance Criteria:")
|
|
print(" ✓ Test 1: POST /api/v1/auth/login returns 200 with JWT token -> PASSED")
|
|
print(" ✓ Test 2: Profile page renders user info properly -> PASSED")
|
|
print(" ✓ Test 3: Invalid credentials trigger error notification -> PASSED")
|
|
|
|
# 7. Code Review & DoD Verification
|
|
print("\n[Code Reviewer] Auditing PR and Definition of Done:")
|
|
print(" ✓ OWASP Security check: Password hashing and JWT expiry verified")
|
|
print(" ✓ Accessibility check: WCAG 2.1 AA color contrast and screen reader aria-labels present")
|
|
print(" ✓ Definition of Done satisfied. Story signed off as DONE.")
|
|
|
|
story.status = StoryStatus.DONE
|
|
print(f"\n[Scrum Master] Story {story.story_id} successfully marked as: {story.status.value.upper()}")
|
|
print("=" * 60)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_scrum_simulation()
|