Skip to content

How to use memory with create_react_agent #26337

Closed Answered by YogeshSaini85
YogeshSaini85 asked this question in Q&A
Discussion options

You must be logged in to vote

@dosu Okay so I found the way to pass redis memory to the agent executor.
But when I run the agent, I see that it doesn't make any entry in the redis database.

Here is my code:

prompt = PromptTemplate(
        template=COPILOT_PROMPT,
        input_variables=["input", "agent_scratchpad"],       
    )
memory = RedisChatMessageHistory(
        url="redis://127.0.0.1:6379/0", ttl=6000, session_id="my-session"
    )
agent = create_react_agent(llm, tools, prompt)

agent_executor = AgentExecutor.from_agent_and_tools(
        agent=agent,
        tools=tools,
        verbose=False,
        handle_parsing_errors=True,
        max_iterations=4000,
        max_execution_time=60000
    )
agent_hist…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Answer selected by YogeshSaini85
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant