Skip to content

fix(eve/harness): allow explicit bedrock anthropic inference-profile override (#1314) - #1532

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/1314-bedrock-cache-override
Open

fix(eve/harness): allow explicit bedrock anthropic inference-profile override (#1314)#1532
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/1314-bedrock-cache-override

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

What

AWS Bedrock application inference profiles can have opaque ids that omit the
underlying provider name (us.app-profile-7f3a2b1c). detectPromptCachePath
inferred the anthropic-direct path only when the resolved model id contained
anthropic, so an Anthropic model reached through an opaque profile classified
as none and received no cacheControl / cachePoint markers — repeated
turns paid full uncached input cost (#1314).

Changes

  • prompt-cache.ts — add PromptCacheHint interface and accept it in
    detectPromptCachePath. The Bedrock branch now checks
    hints.bedrockInferenceProfileTarget === "anthropic" after the model-id
    heuristic. Hints are gated on providerName.includes("bedrock") and
    consulted after the heuristic so they cannot accidentally rewrite
    non-Bedrock providers or disable an inferred path.
  • tool-loop.tsresolveActiveRuntimeModel returns the active
    RuntimeModelReference; the step runner derives PromptCacheHint | undefined
    via the new resolvePromptCacheHints helper (reads
    reference.providerOptions.bedrock.inferenceProfileTarget === "anthropic"),
    then passes the hint to detectPromptCachePath.

Author usage

defineAgent({
  model: myBedrockModel,
  modelOptions: {
    providerOptions: {
      bedrock: { inferenceProfileTarget: "anthropic" },
    },
  },
});

Tests

Five new detectPromptCachePath cases in prompt-cache.test.ts covering the
opaque-profile no-hint path, the override path, the non-Bedrock guard, and
hint-vs-heuristic precedence. Full harness workspace suites pass:
buzz-agent --lib proxy of 703/703 (46 files), tsc -p tsconfig.json --noEmit
clean.

Refs #1314

…override (vercel#1314)

`detectPromptCachePath` inferred the `anthropic-direct` path for Bedrock only
when the resolved model id contained `anthropic`. AWS application inference
profile ids can be opaque (`us.app-profile-…`), so a Bedrock-resolved
Anthropic model received no `cacheControl`/`cachePoint` markers and repeated
turns paid full uncached input cost.

Introduce an optional `PromptCacheHint` channel. Agents can declare the
underlying provider family via
`modelOptions.providerOptions.bedrock.inferenceProfileTarget = "anthropic"`;
the tool-loop reads the hint from the resolved `RuntimeModelReference` and
passes it to `detectPromptCachePath`. The classifier consults hints only
after provider-name and model-id heuristics and only when the provider
name already includes `bedrock`, so a hint cannot accidentally rewrite the
classification of a non-Bedrock provider.

Refs vercel#1314

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant