Was looking into langchain V1 in comparison with a current codebase (application is self hosted on azure been in production for a year now) I maintain (was on langchain 0.3.X) . Our main agent is a create_openai_agent wrapped in an agentexecutor then a runnablewithmessagehistory (cosmos db used to maintain memory)
Then astream events is used to invoke the agent. I made an attempt to upgrade to v1 from my understanding agentexecutor is no longer a thing. However I believed that runnable is still valid? But as I try to use it, I find big pydantic errors during the chain start. Is runnable still supported in V1? What’s the right way to go about streaming responses from a create_agent and handling it’s memory?
I’ve read on checkpointer but it seems like it doesn’t support the CosmosDB (from langchain community) integration that we are using with Runnables. And I do not see how checkpointer would handle retrieval of message history? Only saving?
What’s the right way to go about streaming responses from a create_agent and handling it’s memory?
Memory is handled using langgraph checkpointers now
stream using stream API (rather than astream_events)
I’ve read on checkpointer but it seems like it doesn’t support the CosmosDB (from langchain community)
We’d recommend changing to postgres. You could try and roll out your own checkpointer for cosmos DB, but I wouldn’t recommend that as a migration path.
And I do not see how checkpointer would handle retrieval of message history? Only saving?
It retrievers the message history and it’s much more general, as it is not restricted to working with message history but supports custom agent state (i.e., other fields that you define and can update/access at run time using tools!)
@michael6 I think you need to use data class to define types, langchain v1 doesn’t seem to support pydantic out of the box.
We support pydantic for structured outputs for agents. If you need custom state, then we recommend than users use typed dicts for defining custom state.