Skip to content

fix(aws-strands): generate stable document names - #2505

Merged
ranst91 merged 1 commit into
ag-ui-protocol:mainfrom
green3sf:fix/strands-stable-document-names
Aug 26, 2026
Merged

ranst91 merged 1 commit into
ag-ui-protocol:mainfrom
green3sf:fix/strands-stable-document-names

Conversation

@green3sf

Copy link
Copy Markdown

Summary

  • replace the shared Bedrock document name with a neutral, deterministic SHA-256 name
  • scope names with the stable AG-UI message ID, per-message document position, and stable source identity so replayed history keeps the same names while documents remain unique across turns
  • keep direct converter calls deterministic without exposing filenames, URL query tokens, or metadata values in model-visible names
  • thread message identity through both full-history replay and the session-manager prompt path

Why

Bedrock requires document names to be unique across the complete request. Strands replays prior messages, so the hard-coded document name made a second document—even in a later turn—break the conversation.

The digest uses length-framed stable inputs. The separate silent-failure behavior tracked in #1976 is intentionally out of scope.

Validation

  • uv run --frozen python -m pytest tests/ -q — 428 passed, 2 skipped
  • uv run --frozen --with strands-agents==1.15.0 python -m pytest tests/ -q — 425 passed, 5 skipped
  • regression coverage for multiple documents in one message, identical content across turns, replay stability, unsafe metadata, changing URL fetch bytes, and the direct-converter fallback
  • git diff --check and Python bytecode compilation passed

Fixes #2425

@green3sf
green3sf requested a review from a team as a code owner August 23, 2026 13:27
@green3sf

Copy link
Copy Markdown
Author

@NathanTarbert the PR is up and ready for review. It keeps document names stable across replayed turns, preserves uniqueness for identical documents across turns, and leaves #1976 out of scope as discussed.

@ranst91
ranst91 force-pushed the fix/strands-stable-document-names branch from 3b12189 to 4658d02 Compare August 26, 2026 14:34
@github-actions

Copy link
Copy Markdown
Contributor

Python Preview Packages

Version 0.0.0.dev1787754867 published to TestPyPI.

Warning: These packages are built from contributor code that may not yet have been vetted for correctness or security. Install at your own risk and do not use in production.

Install with uv

Add the TestPyPI index to your pyproject.toml:

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = true

Then install the packages you need:

# Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1787754867' --index testpypi

# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1787754867' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1787754867' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1787754867' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1787754867' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1787754867' --index testpypi

Install with pip

pip install \
  --index-url https://test.pypi.org/simple/ \
  --extra-index-url https://pypi.org/simple/ \
  ag-ui-protocol==0.0.0.dev1787754867

Use --extra-index-url https://pypi.org/simple/ so pip can resolve
transitive dependencies (pydantic, fastapi, etc.) from real PyPI.


Commit: 5f8373a

@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

@ag-ui/a2a-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a-middleware@2505

@ag-ui/a2ui-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-middleware@2505

@ag-ui/event-throttle-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/event-throttle-middleware@2505

@ag-ui/mcp-apps-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-apps-middleware@2505

@ag-ui/mcp-middleware

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mcp-middleware@2505

@ag-ui/a2a

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2a@2505

@ag-ui/adk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/adk@2505

@ag-ui/ag2

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/ag2@2505

@ag-ui/agno

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/agno@2505

@ag-ui/aws-strands

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/aws-strands@2505

@ag-ui/claude-agent-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-agent-sdk@2505

@ag-ui/claude-managed-agents

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/claude-managed-agents@2505

@ag-ui/crewai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/crewai@2505

@ag-ui/langchain

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langchain@2505

@ag-ui/langgraph

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/langgraph@2505

@ag-ui/llamaindex

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/llamaindex@2505

@ag-ui/mastra

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/mastra@2505

@ag-ui/pydantic-ai

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/pydantic-ai@2505

@ag-ui/vercel-ai-sdk

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/vercel-ai-sdk@2505

@ag-ui/watsonx

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/watsonx@2505

@ag-ui/a2ui-toolkit

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/a2ui-toolkit@2505

create-ag-ui-app

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/create-ag-ui-app@2505

@ag-ui/client

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/client@2505

@ag-ui/core

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/core@2505

@ag-ui/encoder

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/encoder@2505

@ag-ui/proto

pnpm add https://pkg.pr.new/ag-ui-protocol/ag-ui/@ag-ui/proto@2505

commit: 4658d02

@ranst91 ranst91 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the other PR, I took this one to completion fixing one small outstanding issue. Thanks for the contribution!

@ranst91
ranst91 merged commit 49e71f2 into ag-ui-protocol:main Aug 26, 2026
50 checks passed
@green3sf

Copy link
Copy Markdown
Author

Thank you for taking this to completion and for fixing the final outstanding issue. I really appreciate the review and merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ag_ui_strands: every document block is named "document", so a second document permanently breaks a Bedrock conversation

2 participants