sykang16/agentic-wealth-intelligence
0
1# Module B: Agent-Guided Investment Profiling2 3#### ๐ด Priority: HIGH4 5## Objective6Conversational investment profiling using slot-filling7 8## LangGraph Workflow9```10START โ User Input11 โ12Extractor (fill slots)13 โ14Validator (check validity)15 โ16Completion Checker17 โโ Complete? โ END (return profile)18 โโ Incomplete? โ Question Generator โ Ask User โ loop back19```20 21## Agent Architecture (LangGraph)22```python23# State definition24class ConversationState(TypedDict):25 messages: List[Message]26 profile: InvestmentProfile # Partially filled27 missing_slots: List[str]28 current_question: str29```30 31## Pydantic Schema (Required Slots)32```python33class InvestmentProfile(BaseModel):34 # Risk Assessment35 risk_tolerance: Literal["conservative", "moderate", "aggressive"]36 loss_comfort: int = Field(ge=1, le=10) # 1-10 scale37 38 # Time Horizon39 investment_period: Literal["short", "medium", "long"] # <3yr, 3-10yr, >10yr40 liquidity_needs: str41 42 # Financial Situation43 income_stability: Literal["stable", "variable", "uncertain"]44 emergency_fund: bool45 debt_level: Literal["none", "low", "moderate", "high"]46 47 # Investment Experience48 experience_level: Literal["beginner", "intermediate", "advanced"]49 previous_investments: List[str]50 51 # Goals52 primary_goal: str53 target_return: Optional[float]54```55 56## Agent Nodes571. Extractor: Parse user response to fill slots582. Validator: Check if extracted data is valid593. Question Generator: Generate next question for missing slots604. Completion Checker: Determine if profile is complete61 62## Implementation Files63```64src/65โโโ profiling/66โ โโโ __init__.py67โ โโโ agent.py # LangGraph agent definition68โ โโโ nodes/69โ โ โโโ extractor.py70โ โ โโโ validator.py71โ โ โโโ question_gen.py72โ โ โโโ checker.py73โ โโโ schemas.py # InvestmentProfile model74โ โโโ prompts/75โ โโโ extractor_prompt.py76โ โโโ question_prompts.py77```78 79 80 81 82 