Closes #434 ## Summary Adds Pydantic-based validation at agent input/output boundaries to: - Catch validation errors early with clear error messages - Provide strict schema enforcement for agent outputs - Support graceful fallback when validation fails ## Changes 1. **New module: ** - — validates analyst output with minimum length checks - — validates research debate state - — validates risk management debate state - — validates final trade decisions (BUY/SELL/HOLD) - — validates agent input (ticker, date format) - — strict validation (raises on error) - — graceful fallback (adds error field) 2. **Updated ** - Added conditional import of validation helpers - flag for feature detection 3. **Added to dependencies** 4. **Example: ** - Shows how to wrap existing analyst with validation ## Design Decisions - **Safe by default**: Uses which never raises - **Optional**: Validation is import-guarded; code works without pydantic - **Non-breaking**: Existing code continues to work; validation is additive - **Clear errors**: Validation messages explain exactly what failed ## Testing Built by Laboon 🐋 — AI Assistant powered by Xiaomi MiMo v2 Pro |
||
|---|---|---|
| .. | ||
| pydantic_validation_example.py | ||