Skip to content

Skip legacy models when selecting a Bedrock inference profile - #72521

Open
vincbeck wants to merge 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/skip-legacy-bedrock-models
Open

Skip legacy models when selecting a Bedrock inference profile#72521
vincbeck wants to merge 1 commit into
apache:mainfrom
aws-mwaa:vincbeck/skip-legacy-bedrock-models

Conversation

@vincbeck

@vincbeck vincbeck commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

get_text_inference_profile_arn() returns the first "sonnet" inference profile in list_inference_profiles order. That order is not stable, and when it changed the helper started returning a profile backed by a model its provider had marked as legacy. Bedrock then rejects the request:

ValidationException: This Model is marked by provider as Legacy and you
have not been actively using the model in the last 30 days. Please upgrade
to an active model on Amazon Bedrock.

The inference profile summaries do not expose a lifecycle status, so look the legacy models up with list_foundation_models and skip any profile that resolves to one of them. Foundation model IDs are compared rather than ARNs because a global profile resolves to the same model in several regions.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

get_text_inference_profile_arn() returns the first "sonnet" inference profile
in list_inference_profiles order. That order is not stable, and when it changed
the helper started returning a profile backed by a model its provider had
marked as legacy. Bedrock then rejects the request:

    ValidationException: This Model is marked by provider as Legacy and you
    have not been actively using the model in the last 30 days. Please upgrade
    to an active model on Amazon Bedrock.

example_bedrock_batch_inference and example_bedrock_retrieve_and_generate both
use this helper, so both fail for as long as a legacy model sits first in the
listing.

The inference profile summaries do not expose a lifecycle status, so look the
legacy models up with list_foundation_models and skip any profile that
resolves to one of them. Foundation model IDs are compared rather than ARNs
because a global profile resolves to the same model in several regions.
@vincbeck
vincbeck requested a review from o-nikolas as a code owner September 4, 2026 15:16
@boring-cyborg boring-cyborg Bot added area:providers provider:amazon AWS/Amazon - related issues labels Sep 4, 2026
legacy_model_ids = {
model["modelId"]
for model in client.list_foundation_models()["modelSummaries"]
if model.get("modelLifecycle", {}).get("status") == "LEGACY"

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.

Should we filter for just ACTIVE so that if there's a new state like DEPRECATED or something else, this would still keep working?

log.info("Legacy model IDs: %s", sorted(legacy_model_ids))

profiles = client.list_inference_profiles(typeEquals="SYSTEM_DEFINED")["inferenceProfileSummaries"]
arns = [

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.

Since the pick among non-legacy candidates still follows list_inference_profiles order, the model under test can change between runs. Would it make sense to add a deterministic tiebreak, e.g. sort the candidates and pick the oldest non-legacy Sonnet, so runs are reproducible and we don't land on a brand-new release before batch inference or RAG support it?

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

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants