mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-09 04:28:16 +00:00
* feat: add flow_structure() serializer for Flow class introspection Adds a new flow_serializer module that introspects a Flow class and returns a JSON-serializable dictionary describing its complete graph structure. This enables Studio UI to render visual flow graphs (analogous to how crew_structure() works for Crews). The serializer extracts: - Method metadata (type, triggers, conditions, router paths) - Edge graph (listen and route edges between methods) - State schema (from Pydantic model if typed) - Human feedback and Crew reference detection - Flow input detection Includes 23 comprehensive tests covering linear flows, routers, AND/OR conditions, human feedback, crew detection, state schemas, edge cases, and JSON serialization. * fix: lint — ruff check + format compliance for flow_serializer * fix: address review — PydanticUndefined bug, FlowCondition tuple handling, dead code cleanup, inheritance tests 1. Fix PydanticUndefined default handling (real bug) — required fields were serialized with sentinel value instead of null 2. Fix FlowCondition tuple type in _extract_all_methods_from_condition — tuple conditions now properly extracted 3. Remove dead get_flow_inputs branch that did nothing 4. Document _detect_crew_reference as best-effort heuristic 5. Add 2 inheritance tests (parent→child method propagation) --------- Co-authored-by: Joao Moura <joao@crewai.com>