Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c1944a5
fix(aws-startup-advisor): refresh GPT-5.4/GPT-5.5 Bedrock endpoint me…
Nov 7, 2026
e72d05d
fix(aws-startup-advisor): pin and disclose the GPT-6 Chat fallback sh…
Nov 7, 2026
bc51f0c
fix(aws-startup-advisor): scope the in. CRIS prefix and runtime featu…
Nov 7, 2026
dfd07bd
fix(aws-startup-advisor): stop granting GPT-5.4/5.5 an in. CRIS id in…
Nov 7, 2026
6b873f8
fix(aws-startup-advisor): grant the in. CRIS prefix to GPT-5.6 Terra …
Nov 7, 2026
8c37ef0
fix(aws-startup-advisor): address PR 583 review — GPT-5.4/5.5 default…
Nov 8, 2026
e39c59a
fix(aws-startup-advisor): scope the 1.10x Geo rate to GPT-5.6
Nov 8, 2026
810e2ea
fix(aws-startup-advisor): state the bedrock-runtime default endpoint …
Nov 7, 2026
5bdbc2f
feat(aws-startup-advisor): default Anthropic SDK migrations to the be…
Nov 7, 2026
b105531
fix(aws-startup-advisor): fail closed on runtime_openai_cris plans wi…
Nov 8, 2026
42cb7a1
fix(aws-startup-advisor): probe embedding ids via InvokeModel under a…
Nov 8, 2026
fee5ffc
fix(aws-startup-advisor): address PR 585 review round 1 — default-pro…
Nov 8, 2026
4ff48f5
fix(aws-startup-advisor): grant the default project per bedrock_model…
Nov 8, 2026
1cb59c8
fix(aws-startup-advisor): grant the default project any-row-wins when…
Nov 8, 2026
8e431e3
fix(aws-startup-advisor): address PR 585 review round 2 — validated i…
Nov 8, 2026
d955896
feat(aws-startup-advisor): detect Mantle-only selectors in Discover a…
Nov 8, 2026
aaf2844
feat(aws-startup-advisor): ask Mantle-only requirements in Clarify (Q…
Nov 8, 2026
3c452a3
feat(aws-startup-advisor): derive mantle_selector from ai_constraints…
Nov 8, 2026
90b2540
fix(aws-startup-advisor): align Mantle selector vocabulary across Dis…
Nov 8, 2026
be3ee4b
fix(aws-startup-advisor): define Step 0.8 for a Mantle requirement on…
Nov 8, 2026
768d75e
fix(aws-startup-advisor): stop quoting one per-token price for both B…
Nov 8, 2026
c23d907
fix(aws-startup-advisor): iam_policy dispatches stored-response grant…
Nov 9, 2026
c764157
fix(aws-startup-advisor): Anthropic computer_/text_editor_/bash_ clie…
Nov 9, 2026
afcd983
docs(aws-startup-advisor): Azure Design/schema and the code-rewriter …
Nov 9, 2026
a8a0ec3
fix(aws-startup-advisor): Step 0.8 validates a matched selector again…
Nov 9, 2026
4f86112
fix(aws-startup-advisor): price the web_search continuity fixture on …
Nov 9, 2026
3cf0a9a
feat(aws-startup-advisor): add bedrock-runtime Responses/Chat/Message…
Nov 8, 2026
16814de
fix(aws-startup-advisor): agent-advisor Anthropic recommendations def…
Nov 8, 2026
64a029d
fix(aws-startup-advisor): agent-advisor OpenAI recommendations defaul…
Nov 8, 2026
6fee2d9
docs(aws-startup-advisor): agent-advisor model-recommend, handoff and…
Nov 8, 2026
56f927c
chore(aws-startup-advisor): re-sync the agent-advisor vendored bedroc…
Nov 8, 2026
f4037ce
docs(aws-startup-advisor): agent-advisor handoff carries mantle_requi…
Nov 8, 2026
572fa83
fix(aws-startup-advisor): agent-advisor OpenAI catalog re-reads the G…
Nov 8, 2026
250ff83
fix(aws-startup-advisor): agent-advisor engines validate selectors, G…
Nov 9, 2026
9486124
docs(aws-startup-advisor): agent-advisor injection carries mantle_sel…
Nov 9, 2026
da15cad
fix(aws-startup-advisor): agent-advisor runtime_converse strengths li…
Nov 9, 2026
0f4c56e
chore(aws-startup-advisor): re-sync agent-advisor vendored copies aft…
Nov 9, 2026
af7ef41
fix(aws-startup-advisor): agent-advisor engines validate web_search/b…
Nov 9, 2026
2697099
fix(aws-startup-advisor): agent-advisor checks required prompt cachin…
Nov 9, 2026
72615b1
merge upstream/main and keep the Mantle selector step on the 1.1 scan
Nov 9, 2026
dd26c75
fix(aws-startup-advisor): keep Responses-only features and Web Search…
Nov 9, 2026
bfada0d
fix(aws-startup-advisor): write the Mantle scan fixtures as schema 1.…
Nov 9, 2026
eb63351
Merge upstream/main and keep Mantle selector discovery beside the 1.1…
Nov 10, 2026
8f6fabb
Merge remote-tracking branch 'upstream/main' into fix/agent-advisor-r…
Nov 10, 2026
a9c1f56
Merge remote-tracking branch 'upstream/main' into fix/agent-advisor-r…
Nov 10, 2026
03f6eac
Merge upstream/main (#598, #599, #600) into fix/agent-advisor-runtime…
Nov 10, 2026
14445a3
Merge upstream/main into fix/llm-to-bedrock-runtime-default.
Nov 10, 2026
067af70
Merge branch 'main' into fix/agent-advisor-runtime-default
herosjourney Nov 11, 2026
7294126
Merge upstream/main into fix/gpt54-55-runtime-metadata
Nov 11, 2026
1951698
chore: merge upstream/main into fix/agent-advisor-runtime-default
Nov 12, 2026
e17c00a
chore: merge upstream/main into fix/gpt54-55-runtime-metadata
Nov 12, 2026
cabaff8
merge: sync #583 (e17c00ac); upstream/main already included. mise run…
Nov 12, 2026
a275a82
merge: sync #585 (cabaff87) into fix/agent-advisor-runtime-default
Nov 12, 2026
57344fa
Merge upstream/main into fix/agent-advisor-runtime-default
Nov 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,24 @@ grep -rn "embedding\|embed_query\|create_embedding" <REPO> --include="*.py" --in

# Vision / image input
grep -rn "image_url\|image_file\|vision\|ImageBlock" <REPO> --include="*.py" --include="*.js" --include="*.ts" | grep -v node_modules

# Stored-response operations (OpenAI Responses API only): retrieve / cancel / delete by id
grep -rn "responses\.retrieve(\|responses\.cancel(\|responses\.delete(\|/responses/[^\"']*\(/cancel\)\?[\"']" <REPO> --include="*.py" --include="*.js" --include="*.ts" | grep -v node_modules
```

**`stored_response_ops`** (typed field, optional — emit it whenever the source is an OpenAI
Responses app): the subset of `["retrieve", "cancel", "delete"]` whose `client.responses.<op>(id)`
call sites (or raw `GET /responses/{id}`, `POST /responses/{id}/cancel`, `DELETE /responses/{id}`
requests) the last grep found and a runtime rewrite keeps. Creation (`responses.create`) is NOT
one of them. On `bedrock-runtime`, retrieving, canceling or deleting a stored response authorizes
`bedrock:GetInvoke` / `bedrock:CancelInvoke` / `bedrock:DeleteInvoke` on the account's default
project, separately from the `bedrock:InvokeModel` that creation needs
(<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-responses-api.html>, "Permissions",
read 2026-11-08) — the report generator's §6.4 IAM recipe reads this field so a retained
`responses.retrieve(id)` is not denied after creation and the preflight ping both passed. Emit `[]`
(or omit) when no such call exists; never emit it for a Chat Completions, Converse or Anthropic
Messages source, which have no stored responses.

# 9. Detect behavior deltas (user-visible parameter-surface differences)

If `source_provider ∈ {openai, google, anthropic}` AND `same_model_family == false`, scan the source code for known parameter-surface differences between the source provider and Bedrock. The orchestration checkpoint asks the user to confirm each user-visible change before the rewriter modifies code; this step enumerates them. (Vertex AI customers are emitted as `google` per §7.1.2 — parameter surface is identical between Gemini API and Vertex AI Gemini.)
Expand Down Expand Up @@ -365,7 +381,7 @@ Write your result to `<Phase results directory>/analysis.json` with the `Write`

Return ONE flat object: the typed fields and `summary` are all top-level siblings (no `data` wrapper — the strict schema rejects a nested `data` key).

- **Typed fields** — the fields in the analysis schema (`AiAnalysisData`), at top level. Always populate every required field; use `""` / `0` / `[]` / `false` / `"none"` for absent values. The nested `special_patterns` object MUST include all four booleans.
- **Typed fields** — the fields in the analysis schema (`AiAnalysisData`), at top level. Always populate every required field; use `""` / `0` / `[]` / `false` / `"none"` for absent values. The nested `special_patterns` object MUST include all four booleans. `stored_response_ops` (§8.3) is the one optional typed field: an array drawn from `["retrieve", "cancel", "delete"]`, `[]` or omitted when the source retains no stored-response operation.
- **`summary`** — short prose for the user / sidebar, a top-level field alongside the typed fields. ~1–3 sentences. Mention framework, file count, key special patterns.
- **`errors`** — string log of resolution decisions and warnings: rule-of-thumb / defaulted entries from §7.2 Tier 2/3, model-ID corrections from §10, the Vertex substring from §7.1.2, and any non-fatal scan failures. **Multiple entries: join with `"; "` (semicolon + space) on a single line.** Use `"none"` if nothing notable.

Expand Down
86 changes: 74 additions & 12 deletions plugins/aws-startup-advisor/agents/llm2bedrock-code-rewriter.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ Conservative scope — only universally-junk patterns; `.venv/` / `node_modules/
## Strategy selection (check FIRST)

If your context has `Rewrite strategy: runtime_openai`, use the runtime OpenAI lane below.
For `Rewrite strategy: mantle`, use the Mantle express lane. Otherwise use the Converse
rewrite. The selected `Target API surface` must match what the evaluator verified.
For `Rewrite strategy: runtime_messages`, use the Runtime Anthropic Messages lane.
For `Rewrite strategy: mantle`, use the Mantle express lane. Otherwise (an explicit `converse`
plan) use the Converse rewrite. The selected `Target API surface` must match what the
evaluator verified.

### Runtime OpenAI lane

Expand Down Expand Up @@ -176,6 +178,59 @@ In §12 keep `openai>=2.45.0,<3` and `aws-bedrock-token-generator>=1,<2`; do not
analyzer's generic OpenAI-to-boto3 dependency replacement to this lane. Apply confirmed deltas
in §9, then skip the Converse-specific §8 rewrite guidance.

### Runtime Anthropic Messages lane

Keep the Anthropic SDK and its Messages request/response shapes (`messages.create`,
`messages.stream`, `system=`, content blocks, tool use). Point the client at the runtime
endpoint `https://bedrock-runtime.{region}.amazonaws.com/anthropic` (the SDK appends
`/v1/messages`) with the exact validated profile ID from the plan, not a bare model ID
(except the documented eu-west-2 Opus 5.5 route) and not a Mantle URL. Public basis:
<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-messages-api.html> (read 2026-11-07).

The pinned Anthropic SDK takes a **string** credential only — `api_key` is the Bedrock bearer
token minted by `provide_token`, **never a callable**, and the token has a bounded lifetime.
Mint the token per client, create the client at the request boundary, and close it when the
request is done; never keep one client alive past the token lifetime. For Python:

```python
import anthropic
from aws_bedrock_token_generator import provide_token # aws-bedrock-token-generator

REGION = "<REGION>"


def bedrock_anthropic() -> anthropic.Anthropic:
"""One client per request boundary; the token is a string minted right here."""
return anthropic.Anthropic(
base_url=f"https://bedrock-runtime.{REGION}.amazonaws.com/anthropic",
api_key=provide_token(region=REGION),
)


with bedrock_anthropic() as client:
r = client.messages.create(model="<TARGET_MODEL_ID>", max_tokens=1024, messages=msgs)
text = "".join(block.text for block in r.content if block.type == "text")

# Streaming keeps the SDK's own helper:
with bedrock_anthropic() as client, client.messages.stream(
model="<TARGET_MODEL_ID>", max_tokens=1024, messages=msgs) as stream:
for chunk in stream.text_stream:
print(chunk, end="")
```

For a short CLI or one-shot script, `api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"]` is
acceptable (that token also expires within 12 hours); a server, worker, scheduled job, ECS
service or Lambda uses the factory above and `.env.example` does **not** set
`AWS_BEARER_TOKEN_BEDROCK`. Remove the old `ANTHROPIC_API_KEY` read.

Runtime permissions are `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` on
the inference-profile ARN and the foundation-model ARN(s) of its destination Regions, plus
`bedrock:GetInferenceProfile` on the profile ARN — not Mantle actions. In §12 keep `anthropic`
and add `aws-bedrock-token-generator>=1,<2`; do not apply an analyzer's generic
Anthropic-to-boto3 dependency replacement to this lane. Apply confirmed deltas in §9 (the
native `type: text` block shape and message history are preserved on this lane), then skip
the Converse-specific §8 rewrite guidance.

### Mantle express lane

The source SDK stays. Per client, change only three things:
Expand All @@ -186,7 +241,7 @@ The source SDK stays. Per client, change only three things:
| ---------------------------------------- | ------------------------------------------------------ |
| Proprietary OpenAI GPT (`openai.gpt-5*` / `openai.gpt-6*`) | `https://bedrock-mantle.<REGION>.api.aws/openai/v1` |
| Other OpenAI-compatible targets | `https://bedrock-mantle.<REGION>.api.aws/v1` |
| Anthropic SDK | `https://bedrock-mantle.<REGION>.api.aws/anthropic/v1` |
| Anthropic SDK | `https://bedrock-mantle.<REGION>.api.aws/anthropic` (the SDK appends `/v1/messages`) |

If your context has a `Mantle base path` line, use it verbatim — it is authoritative over this table.
- **Credential** → a Bedrock bearer token, NOT the original provider key. For a short CLI or one-shot script, read it from the `AWS_BEARER_TOKEN_BEDROCK` env var; for any long-running process use the auto-refreshing `provide_token` client shown below (the env-var form expires within 12 hours). Do not leave the old `api_key=os.environ["OPENAI_API_KEY"]` line in place.
Expand Down Expand Up @@ -250,16 +305,19 @@ client = anthropic.Anthropic()
import os
import anthropic
client = anthropic.Anthropic(
base_url="https://bedrock-mantle.us-east-1.api.aws/anthropic/v1",
auth_token=os.environ["AWS_BEARER_TOKEN_BEDROCK"],
base_url="https://bedrock-mantle.us-east-1.api.aws/anthropic",
api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"],
)
# Same base_url/api_key form as the public Messages API page
# (https://docs.aws.amazon.com/bedrock/latest/userguide/inference-messages-api.html, read 2026-11-07);
# the SDK appends /v1/messages and the anthropic-version header itself.
```

Preserve compatible SDK request/response shapes. A model version change still requires §9 target checks, including typed response parsing for Opus 5.5. Apply the Chat Completions → Responses reshape only when that API change was selected. Preserve the exact validated runtime profile ID or ARN. After applying the changes above, skip the Converse-specific guidance in the rest of §8; the §9 behavior-delta application still applies normally.

**Converse for a proprietary GPT target is family-dependent.** GPT-5.5 / GPT-5.4 (`openai.gpt-5.5`, `openai.gpt-5.4`) have no `bedrock-runtime` surface — a boto3 `converse()` call against them fails at runtime; if your context pairs one with the Converse path, stop and report the contradiction. GPT-5.6 and GPT-6 (Astra, Sol, Luna, 6.1 Sol) DO have a `bedrock-runtime` path via CRIS ids (`us.`/`in.`/`global.` prefixed): when the plan says `migration_path: runtime_openai_cris`, a Converse or Responses rewrite against the CRIS id is valid (base URL `bedrock-runtime.{region}.amazonaws.com/openai/v1` for the OpenAI-compatible APIs; note Guardrails are Converse-only and prompt caching Responses-only on runtime). For a Responses-based source app, the mantle express lane above remains the default and smallest change.
**Converse for a proprietary GPT target is id-form-dependent, not family-dependent.** A **bare** proprietary GPT id (`openai.gpt-5.5`, `openai.gpt-5.4`, `openai.gpt-5.6-*`, `openai.gpt-6-*`) is a `bedrock-mantle` id with no `bedrock-runtime` in-region form — a boto3 `converse()` call against a bare id fails at runtime; if your context pairs a bare id with the Converse path, stop and report the contradiction. GPT-5.6, GPT-6 (Astra, Sol, Luna, 6.1 Sol) **and GPT-5.5 / GPT-5.4** (model cards read 2026-11-06: `us.openai.gpt-5.5` / `global.openai.gpt-5.5`, `us.openai.gpt-5.4` / `global.openai.gpt-5.4`; Responses, Chat Completions and Converse on runtime, no Invoke) all have a `bedrock-runtime` path via CRIS ids (`us.`/`in.`/`global.` prefixed for GPT-5.6 Terra and Luna; `us.`/`global.` only for GPT-5.6 Sol, GPT-6, GPT-5.5 and GPT-5.4 — those cards publish no `in.` profile): when the plan says `migration_path: runtime_openai_cris`, a Converse, Responses or Chat Completions rewrite against the CRIS id is valid (base URL `bedrock-runtime.{region}.amazonaws.com/openai/v1` for the OpenAI-compatible APIs; Guardrails and prompt-caching API scope are per model card and are carried by `bedrock_models[].required_client_api`: GPT-6 Sol / Luna list Guardrails on Responses, Chat Completions, InvokeModel and Converse; GPT-6.1 Sol on Chat Completions, InvokeModel and Converse (not Responses); GPT-5.6 Sol / Terra / Luna, GPT-5.5, GPT-5.4 and GPT-6 Astra on Converse only; implicit prompt caching is Responses-only on runtime for GPT-5.5 / GPT-5.4 and on Responses, Chat Completions and Converse for GPT-5.6 / GPT-6 — cards read 2026-11-09). The Runtime OpenAI lane is the default for a compatible source; use the Mantle express lane only when the plan recorded a `mantle_*` path with a `mantle_selector`.

### Converse rewrite (default)
### Converse rewrite (explicit `converse` plans)

Choose the rewrite approach based on framework:

Expand Down Expand Up @@ -887,11 +945,15 @@ grep -rl "from openai\|import openai\|require.*openai\|from anthropic\|import an

If any files still contain source SDK references, fix them before proceeding. Test directories are NOT excluded from this scan on purpose: the source SDK package is being removed from the manifest, so a leftover `import openai` in a customer test means `pytest` ImportErrors on the customer's machine — §18.0 should have migrated those tests; if one appears here, go back and fix it.

**OpenAI-compatible lane exception:** when this run used `Rewrite strategy: mantle` or
`Rewrite strategy: runtime_openai`, the source-SDK imports are expected to remain, so this
residual scan does not apply. Verify the selected endpoint's `base_url`, Bedrock credentials
and model identifiers instead: bare IDs for Mantle, exact validated profiles for runtime.
The runtime lane must retain the Chat/Responses API verified by the evaluator.
**Source-SDK lane exception:** when this run used `Rewrite strategy: mantle`,
`Rewrite strategy: runtime_openai` or `Rewrite strategy: runtime_messages`, the source-SDK
imports are expected to remain, so this residual scan does not apply. Verify the selected
endpoint's `base_url`, Bedrock credentials and model identifiers instead: bare IDs for Mantle,
exact validated profiles for runtime. The runtime OpenAI lane must retain the Chat/Responses
API verified by the evaluator. For `runtime_messages`, Anthropic imports are expected: verify
the `base_url` ends at `bedrock-runtime.<REGION>.amazonaws.com/anthropic`, the credential is a
string Bedrock token (no callable, no `ANTHROPIC_API_KEY`), and the model is the exact
validated profile ID.

- **Short CLI / one-shot script:** `base_url` set to the Mantle path and `api_key=os.environ["AWS_BEARER_TOKEN_BEDROCK"]`.
- **Server, worker, scheduled job, ECS service, or Lambda:** `BedrockOpenAI(..., bedrock_token_provider=lambda: provide_token(...))` (or the equivalent auto-refreshing client for the SDK in use), **no** `AWS_BEARER_TOKEN_BEDROCK` read in code, and `.env.example` does **not** set it.
Expand Down
Loading
Loading