File size: 1,482 Bytes
e5e882e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from core.base_agent import BaseAgent
from core.database import db
from typing import Dict, Any

class BusinessAnalystAgent(BaseAgent):
    def __init__(self):
        super().__init__("Business Analyst")
        self.create_chain("""

        You are a Business Analyst. Your task is to create detailed user stories from the given business requirements.

        

        Business Requirements:

        {input}

        

        Create user stories following this format:

        As a [type of user]

        I want [some goal]

        So that [some reason]

        

        Acceptance Criteria:

        1. [First criterion]

        2. [Second criterion]

        ...

        

        Please provide clear, testable user stories with specific acceptance criteria.

        """)
        
    async def create_user_stories(self, requirements: str) -> Dict[str, Any]:
        """Create user stories from business requirements"""
        result = await self.process({"input": requirements})
        
        # Store the user stories in the database
        db.store_artifact(
            "user_stories",
            result,
            {
                "type": "user_story",
                "source": "business_analyst",
                "status": "created"
            }
        )
        
        return {
            "status": "success",
            "user_stories": result,
            "message": "User stories created successfully"
        }