Managing State Across Interactions › Handling State Conflicts
Michael BrenndoerferJuly 11, 20251 min read
AI Agent HandbookAll chapters Part 7 of 15Agent State and Architecture - Putting It All Together
Managing State Across Interactions › Handling State ConflictsOne section · Sections in this chapter6 / 13 ↓
Sections in this chapter13
Sometimes different tiers of state can conflict. What if the user's persistent preference says they like morning flights, but in this session they've been booking evening flights?
The general rule: more recent state takes precedence, but acknowledge the conflict:
In[10]:
Codedef resolve_preference_conflict(self, persistent_pref: str, session_behavior: str) -> str:
"""Handle when session behavior conflicts with persistent preferences"""
return f"""I notice you usually prefer {persistent_pref}, but today you've been
choosing {session_behavior}. Should I update your preference, or is today an exception?"""This gives the user control and makes the agent's reasoning transparent.