Skip to content

[BUG] get_html hard-coded 1,000-character truncation returns broken HTML fragments #407

Description

@danielferreira-dias

Checks

  • I have updated to the lastest minor and patch version of Strands
  • I have checked the documentation and this is not expected behavior
  • I have searched ./issues and there are no duplicates of my issue

Strands Version

1.27.0

Tools Package Version

0.2.21

Tools used

  1. Browser Tool

Python Version

3.12

Operating System

Windows 11 (WSL2 - Ubuntu)

Installation Method

pip

Steps to Reproduce

  1. Use the browser tool's get_html action to fetch a page with more than 1,000 characters of HTML
  2. Observe the returned output
  3. Attempt to process the HTML downstream (e.g., via an AfterToolCallEvent hook that converts HTML to markdown)

Expected Behavior

get_html returns the full HTML content of the page (or at minimum, a well-formed HTML fragment), allowing downstream tools and hooks to process it.

Actual Behavior

get_html silently truncates the output at 1,000 characters. The result is an incomplete, malformed HTML fragment. Any downstream processing (e.g., HTML-to-markdown conversion via AfterToolCallEvent) fails because it receives broken HTML

Additional Context

There is no way to disable or configure this truncation, it is hard-coded. This effectively makes get_html unusable for any pipeline that needs to process the full page content.

Reference PR with a proposed fix: Merge Request

Possible Solution

Remove the hard-coded 1,000-character limit. Return full HTML by default and add an optional max_length parameter so callers can opt-in to truncation at a custom limit.

Related Issues

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Language

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions