#How to reset agent state or clear up memory.

1 messages · Page 1 of 1 (latest)

silk perch
#

After particular code execution i want coagent to treat user query as a fresh content , cause after certain tasks , agent hallucinates and mimicking the tool actions rather actually performing it.

waxen stumpBOT
silk perch
#

i am using langgraph, any solution for it ?

waxen stumpBOT
#

In langgraph, the straightforward way is to simply start a new thread.
Stop the current run before starting another one (so the agent doesn’t keep running in the background). In CoAgents, this is typically a stop() on the running agent/session. And reset() from useCopilotChat clears the visible chat state. If your LangGraph agent uses thread persistence, start the next run on a new LangGraph thread ID (or delete/reset the old thread) so the agent has no prior state. 
Please note -  There’s also a recent issue where stop() didn’t fully stop LangGraph in some setups.

GitHub

♻️ Reproduction Steps ##. Nextjs frontend import { useCoAgent, useCopilotChat } from "@copilotkit/react-core"; import { Role, TextMessage } from "@copilotkit/runtime-client-gql"...

reef plover
#

Is there anyway to include new chat option and chat History just line other ai , like gemini or openai ?

waxen stumpBOT
reef plover
#

Thanks. Now I am clear. Do copilotkit have anything to keep chat History? Like any component that I can directly connect to database to manage user wise chats.