Skip to content

Resize & Policy

Resize controls the prompt window and memo updates.

Defaults

python
session.set_settings("session.resize.max_messages_text_length", 12000)
session.set_settings("session.resize.max_keep_messages_count", 12)
session.set_settings("session.resize.every_n_turns", 8)

Force resize

python
session.resize(force="deep")

Custom policy

python
def policy_handler(full_history, current_history, settings):
    if len(current_history) > 6:
        return "deep"
    return None

session.set_policy_handler(policy_handler)