Skip to content

run recommendation does not resolve --bundle-version LATEST (sends literal 'LATEST', 400) #1565

@jariy17

Description

@jariy17

Summary

agentcore run recommendation does not resolve --bundle-version LATEST to a concrete version ID. The literal string LATEST is sent straight through to the config-bundle API path, which only accepts a version UUID, so the command fails with a 400 validation error.

By contrast, agentcore run ab-test --control-version LATEST / --treatment-version LATEST does resolve LATEST correctly. The two code paths are inconsistent.

Version

@aws/agentcore 0.20.0 (also reproduces on the 0.19.0-d5745 prerelease build).

Steps to reproduce

  1. Create a project with a runtime and add a config bundle, then deploy so the bundle has a version.
  2. Run a system-prompt recommendation referencing the bundle with --bundle-version LATEST:
agentcore run recommendation \
  --type system-prompt \
  -r <runtime> \
  -e Builtin.Helpfulness \
  --bundle-name PromptV1 \
  --bundle-version LATEST \
  --system-prompt-json-path systemPrompt \
  --lookback 1 \
  -n MyReco \
  --json

Expected

LATEST resolves to the bundle's latest version ID (the same way run ab-test resolves it), and the recommendation job is created.

Actual

The command fails with a 400. The literal LATEST is placed into the request URL (.../configuration-bundles/<bundle-id>/versions/LATEST) and rejected by the version-id regex validation:

Recommendation API error (400): {"message":"Config bundle API client error (400): 400 Client Error:
Bad Request for url: https://bedrock-agentcore-control.<region>.amazonaws.com/configuration-bundles/<bundle-id>/versions/LATEST
| body: {"message":"1 validation error detected: Value at 'versionId' failed to satisfy constraint:
Member must satisfy regular expression pattern: [a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}"}}

Workaround

Pass the explicit version UUID instead of LATEST (e.g. from the deploy outputs or agentcore config-bundle versions):

agentcore run recommendation ... --bundle-name PromptV1 --bundle-version a7be96aa-8a83-47b8-8d98-0829b14c1d9b ...

With an explicit UUID the recommendation job is created successfully (status PENDING).

Suggested fix

In the run recommendation bundle-resolution path, resolve --bundle-version LATEST (and likely a missing/omitted version) to the latest concrete version ID before constructing the config-bundle API request — mirroring the resolution already done in the run ab-test config-bundle path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions