Skip to main content

strands/conversation_manager/
null_conversation_manager.rs

1//! The no-op conversation manager.
2
3use async_trait::async_trait;
4
5use super::{ConversationManager, ConversationManagerReduceOptions};
6use crate::error::Result;
7
8/// Leaves the history alone (`NullConversationManager`): `reduce` always returns `false`, so a
9/// context-window overflow leaves the agent loop. Stateful models use it, since the provider
10/// keeps the history.
11#[derive(Debug, Clone, Copy, Default)]
12#[non_exhaustive]
13pub struct NullConversationManager;
14
15impl NullConversationManager {
16    /// Creates the manager.
17    #[must_use]
18    pub fn new() -> Self {
19        Self
20    }
21}
22
23#[async_trait]
24impl ConversationManager for NullConversationManager {
25    fn name(&self) -> &str {
26        "strands:null-conversation-manager"
27    }
28
29    async fn reduce(&self, _options: ConversationManagerReduceOptions<'_>) -> Result<bool> {
30        Ok(false)
31    }
32}