@persist state storage and nested pydantic structures

Where I have structured state defined but I’m using a nested pydantic, I can’t get it to save the state as it complains about the objects not being serializable.

is this a defect? or is there a way to make this work? it says it supported structure pydantic state models, but I guess nested isn’t supported?

I have encountered this problem before but was too lazy to investigate a proper solution.

I think you might be able to circumvent this by having a custom FlowPersistence class that handles saving and loading state. The issue might be with the SQLiteFlowPersistence class. I’m just guessing here. Let me know if you find a solution.

sounds like this is a bug or feature request then.

There already a PR for the feature, it should land soon nested models in flow persist by bhancockio · Pull Request #2302 · crewAIInc/crewAI · GitHub

2 Likes