Skip to content

How to limit the conversation history in Haystack Agents? #9436

Answered by sjrl
SuperMohit asked this question in Questions
Discussion options

You must be logged in to vote

Hey @SuperMohit thanks for the question! We are planning work on enabling Agent memory in this epic. No work has been started yet but you can follow it there.

As for doing something about it now, it's possible to customize the behavior of how messages are stored inside of State within Agent. You can find more info on State here. But basically you will want to specify a custom state_schema which then you will pass to Agent. So something like this

import os

os.environ["SERPERDEV_API_KEY"] = "YOUR_API_KEY"  # Replace with your actual API key
os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"  # Replace with your actual API key

from haystack.components.agents import Agent
from haystack.components.

Replies: 2 comments 1 reply

Comment options

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

Answer selected by SuperMohit
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
Labels
None yet
3 participants