Commit Graph

1 Commits

Author SHA1 Message Date
Laboon 🐋 5450fc9e81 feat: Add Pydantic schema validation at agent boundaries
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
2026-03-23 09:32:23 +00:00