1. Learn
  2. /
  3. Courses
  4. /
  5. AI Agents with Hugging Face smolagents

Connected

Exercise

Don't Forget: Keeping Memory Between Calls

You're planning a graduation trip and using a smolagents travel assistant to keep track of important dates and information.

However, the agent forgets unless you explicitly preserve its memory. Your goal is to prevent the agent from resetting between questions so it can remember key travel details across multiple interactions.

You have access to the travel_agent, already set up with a model and no tools.

Instructions

100 XP
  • Modify the second .run() method so the agent retains memory using the reset parameter.
  • Set the value of reset to False to prevent the agent from resetting its state.