> ## Documentation Index
> Fetch the complete documentation index at: https://allhandsai-fix-security-analyzer-examples.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# openhands.sdk.utils

> API reference for openhands.sdk.utils module

Utility functions for the OpenHands SDK.

### maybe\_truncate()

Truncate the middle of content if it exceeds the specified length.

Keeps the head and tail of the content to preserve context at both ends.

* Parameters:
  * `content` – The text content to potentially truncate
  * `truncate_after` – Maximum length before truncation. If None, no truncation occurs
  * `truncate_notice` – Notice to insert in the middle when content is truncated
* Returns:
  Original content if under limit, or truncated content with head and tail
  preserved
