getzep / zep

Zep: Long-Term Memory for ‍AI Assistants.
https://docs.getzep.com
Apache License 2.0
2.29k stars 350 forks source link

[FEAT] LangGraph support via Zep checkpointer #342

Open elvenking opened 3 months ago

elvenking commented 3 months ago

I am implementing a multi-agent AI backend using LangChain, LangServe and LangGraph. I would like to store graph state in Zep with similar DX as is currently for chat message history

I would like to have support for a LangGraph state persistence in Zep and have Zep implementation of a LangGraph's checkpointer (ZepSaver) class

https://langchain-ai.github.io/langgraph/reference/checkpoints/

Since LangGraph is a recommended way how to build chat agents in LangChain, i believe this functionality would be helpful to many.

albeiroespitia commented 1 month ago

Did you manage to implement this?

TechNickAI commented 1 month ago

If you try to pass the ZepChatMessageHistory, you get an error

instance of BaseCheckpointSaver expected (type=type_error.arbitrary_type; expected_arbitrary_type=BaseCheckpointSaver)

Seems like we need a ZepCheckpointSaver

elvenking commented 1 month ago

@albeiroespitia No, i am migrating to LangGraph Cloud when it become available.

danielchalef commented 1 month ago

Thanks, all. We'd love to support LangGraph. LG checkpoints contain both chat history and the graph's state. Would you expect Zep to maintain state for the entire graph?

How should Zep's more advanced features - Facts, Dialog Classification, Structured Data Extraction - feature in a LangGraph integration?

albeiroespitia commented 1 month ago

@danielchalef I really wanted to try the facts feature in my langgraph app, I ended up extracting the facts myself with a custom llm, it would be great to have a zep checkpointer in the future that supports all of these features.

elvenking commented 1 month ago

@danielchalef At this point LangGraph Cloud trying to be one stop shop for all your LangGraph needs (deployment + persistent state storage).

What i would ideally like to have is an option to choose Zep (imagined with LangGraph capabilities) to store my graph state and use LangGraph Cloud only for deployment, advanced observability and evaluation. I hope community will push them in that direction, so we could use Zep with LangGraph Cloud. This would be true for any other popular data storage in AI field i would say.

Maybe ping @hwchase17 about that ?

danielchalef commented 1 month ago

@elvenking I expect LangChain to continue rapidly evolving and enhancing the LangGraph framework and cloud service in the coming year, with changes to APIs and the Checkpoint format inevitable. I want to avoid replicating the great work LangChain is doing (and not get caught chasing API changes). We're considering how we can best add value to the ecosystem. I've reached out to you on email. Hope to learn more about your use case & challenges.

joaomorossini commented 1 day ago

I'm interested in this enhancement as well. After using Zep and following its development for a while now, I've come to think it's the best solution for memory so far. Making it compatible with LangGraph would be very useful.

Meanwhile, perhaps there's a workaround: Would it be possible to use ZepMemory as a part of the state instead of being itself the state? Any thoughts?, @elvenking @danielchalef @albeiroespitia