),
    },
]
for msg in test_history:
    zep_chat_history.append(
        HumanMessage(content=msg["content"])
        if msg["role"] == "human"
        else AIMessage(content=msg["content"])
    )
Run the agent#
Doing so will automatically add the input and response to the Zep memory.
agent_chain.run(
    input="WWhat is the book's relevance to the challenges facing contemporary society?"
)
> Entering new AgentExecutor chain...
Thought: Do I need to use a tool? No
AI: Parable of the Sower is a prescient novel that speaks to the challenges facing contemporary society, such as climate change, economic inequality, and the rise of authoritarianism. It is a cautionary tale that warns of the dangers of ignoring these issues and the importance of taking action to address them.
> Finished chain.
'Parable of the Sower is a prescient novel that speaks to the challenges facing contemporary society, such as climate change, economic inequality, and the rise of authoritarianism. It is a cautionary tale that warns of the dangers of ignoring these issues and the importance of taking action to address them.'
Inspect the Zep memory#
Note the summary, and that the history has been enriched with token counts, UUIDs, and timestamps.
Summaries are biased towards the most recent messages.
def print_messages(messages):
    for m in messages:
        print(m.to_dict())
print(zep_chat_history.zep_summary)
print("\n")
print_messages(zep_chat_history.zep_messages)
The conversation is about Octavia Butler. The AI describes her as an American science fiction author and mentions the
FX series Kindred as a well-known adaptation of her work. The human then asks about her contemporaries, and the AI lists
rtdocs_stable/api.python.langchain.com/en/stable/modules/memory/examples/zep_memory.html