sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

Updating Bedrock Converse API citations format to handle web citations

Open danilop opened this issue 2 months ago • 2 comments

Description

This PR adds support for web-based citations in the Bedrock Converse API, enabling the SDK to handle citations from web sources in addition to document-based citations.

Changes:

  • Added WebLocation TypedDict to src/strands/types/citations.py with url and domain fields
  • Updated CitationLocation union type to include the new WebLocation type
  • Enhanced citation location filtering in src/strands/models/bedrock.py to handle web-based citations
  • Refactored citation metadata processing to use safer dictionary comprehension that only includes fields present in the citation

All citation location types (document-based and web-based) are now supported as per the updated Bedrock Converse API specification.

Related Issues

This was a blocking issue for #1154

Documentation PR

N/A

Type of Change

New feature

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • [X] I ran hatch run prepare

Checklist

  • [X] I have read the CONTRIBUTING document
  • [X] I have added any necessary tests that prove my fix is effective or my feature works
  • [ ] I have updated the documentation accordingly
  • [X] I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • [ ] My changes generate no new warnings
  • [X] Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

danilop avatar Nov 11 '25 13:11 danilop

hi team, any update on this? One of my customer is also looking forward for this feature support to test out Nova Web Grounding.

kpx-dev avatar Dec 09 '25 22:12 kpx-dev

All types should be back now for backward compatibility.

danilop avatar Dec 11 '25 14:12 danilop

Closing this PR in favor of a cleaner split:

  • #1343 (bug fix): Fixes the CitationLocation tagged union structure issue (#1323)
  • #1344 (feature): Adds web and search result citation support (depends on #1343)

This separation keeps bug fixes and features in separate PRs as per best practices.

danilop avatar Dec 16 '25 09:12 danilop