Skip to content

Explicit State Serialization for Complex Module Graphs #2

@bdsaglam

Description

@bdsaglam

Problem

Current implementation passes module state through workflow context implicitly. For complex module graphs with nested sub-modules, this can become unclear and potentially problematic.

Proposed Solution

Implement explicit state serialization for complex module graphs:

  • Define clear serialization boundaries
  • Support snapshotting intermediate state
  • Enable state inspection for debugging

Use Cases

  • Deep module hierarchies (e.g., RAG → Retriever → Ranker → Generator)
  • Modules with complex internal state
  • Debugging failed workflows by inspecting intermediate state

Implementation Notes

  • Consider using Pydantic models for state serialization
  • Evaluate what state needs to be serialized vs reconstructed
  • LM instances should remain as references (not serialized)
  • Look at how Pydantic AI handles RunContext serialization

Priority

High

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions