Files
crewAI/tests/test_flow_initial_state_fix.py
Devin AI 3cd55459b9 Fix Flow initial_state BaseModel dict coercion issue #3147
- Fix Flow constructor to accept initial_state parameter
- Replace dict conversion with model.model_copy() in _create_initial_state
- Replace dict conversion with model.copy(update=...) in _initialize_state
- Add comprehensive tests covering dict method name collisions
- Preserve BaseModel structure to prevent attribute collision

Fixes issue where Pydantic BaseModel instances were coerced into dicts,
causing field names like 'items', 'keys', 'values' to be overridden by
built-in dict methods. Now BaseModel structure is preserved using
Pydantic's built-in copying methods.

Co-Authored-By: Jo\u00E3o <joao@crewai.com>
2025-07-13 14:09:32 +00:00

5.2 KiB