Migration — Legacy → Typed Steps
The legacy unified StepDescription class still works, but new code should use the
typed step classes — they give you type checking, clearer
intent, and get new features first.
Convert in place
Section titled “Convert in place”Every legacy StepDescription has to_typed_step():
legacy = StepDescription(number=1, title="Old", aim="Old step")typed = legacy.to_typed_step() # → LLMStepDescriptionLoading also converts for you: ReasoningChain.from_dict(data, use_typed_steps=True)
(or from_dict_typed(data)) rebuilds typed classes.
By hand
Section titled “By hand”| Legacy | Typed |
|---|---|
StepDescription(..., step_type=StepType.LLM) | LLMStepDescription(...) (no step_type needed). |
StepDescription(..., step_type=StepType.TOOL, step_config=ToolStepConfig(...)) | ToolStepDescription(config=ToolStepConfig(...)). |
StepDescription(..., step_type=StepType.MEMORY, step_config=MemoryStepConfig(...)) | MemoryStepDescription(config=MemoryStepConfig(...)). |
# BeforeStepDescription(number=1, title="Analysis", aim="Analyze data", reasoning_questions="What patterns exist?", step_type=StepType.LLM)
# AfterLLMStepDescription(number=1, title="Analysis", aim="Analyze data", reasoning_questions="What patterns exist?")Why migrate
Section titled “Why migrate”- Type safety — IDE autocomplete + type checking.
- Clear intent — the class name is the step type.
- Better validation — clearer errors for missing fields.
- Future-proof — new features land on typed classes first.
See also
Section titled “See also”- Steps overview — the typed classes.
- JSON serialization