Skip to content

Commit 56498e5

Browse files
authored
docs: update context management doc with should_truncate_results flag (#88)
1 parent bb34e7c commit 56498e5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/user-guide/concepts/agents/context-management.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ from strands.agent.conversation_manager import SlidingWindowConversationManager
5252
# Create a conversation manager with custom window size
5353
conversation_manager = SlidingWindowConversationManager(
5454
window_size=20, # Maximum number of messages to keep
55+
should_truncate_results=True, # Enable truncating the tool result when a message is too large for the model's context window
5556
)
5657

5758
agent = Agent(
@@ -64,3 +65,4 @@ Key features of the `SlidingWindowConversationManager`:
6465
- **Maintains Window Size**: Automatically removes messages from the window if the number of messages exceeds the limit.
6566
- **Dangling Message Cleanup**: Removes incomplete message sequences to maintain valid conversation state.
6667
- **Overflow Trimming**: In the case of a context window overflow, it will trim the oldest messages from history until the request fits in the models context window.
68+
- **Configurable Tool Result Truncation**: Enable / disable truncation of tool results when the message exceeds context window limits. When `should_truncate_results=True` (default), large results are truncated with a placeholder message. When `False`, full results are preserved but more historical messages may be removed.

0 commit comments

Comments
 (0)