experiment: pydantic-graph prototype for workflow engine replacement - #1289
Open
lambdabaa wants to merge 1 commit into
Open
experiment: pydantic-graph prototype for workflow engine replacement#1289lambdabaa wants to merge 1 commit into
lambdabaa wants to merge 1 commit into
Conversation
…gine Standalone prototype validating whether pydantic-graph can replace the factory's custom workflow execution engine (primitives.py + executor.py). Ports progressively harder subgraphs — sequential chains, gate/verdict routing with typed return unions, and parallel fork/join — and compares execution behavior against the current engine. Key findings (52 tests, 95% coverage): - BaseNode models factory node types cleanly (Q1: YES) - Return-type routing is the biggest architectural gain (Q2: YES) - FactoryState + FactoryDeps carry context effectively (Q3: YES) - Mermaid + Graph.iter() are genuine observability wins (Q4: YES) - definitions.py patterns adapt structurally (Q5: YES) - 74% infrastructure code reduction (1,457 → 73 lines) See experiments/pydantic-graph-prototype/docs/migration-verdict.md for the full comparison and recommended migration path. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Standalone prototype validating whether pydantic-graph can replace the factory's custom workflow execution engine (
primitives.py+executor.py). Lives inexperiments/pydantic-graph-prototype/as a side-by-side comparison — does not modify any existing factory code.Key Findings
Infrastructure reduction: 74% (1,457 → 73 lines). The entire
executor.pyis replaced byGraph.run().Recommendation: Proceed with thin-adapter migration starting with
improve_workflow. Seedocs/migration-verdict.mdfor the full analysis.How to review
Key files:
docs/migration-verdict.md— answers all 5 prototype questions with evidencedocs/comparison-report.md— side-by-side event traces, LOC comparison, feature matrixsrc/pg_factory/nodes/— BaseNode implementations (study chain, gates, parallel)src/pg_factory/compare.py— dual-engine comparison harnessTest plan
pytest)🤖 Generated with Claude Code