mirror of
https://github.com/aws/agent-toolkit-for-aws.git
synced 2026-11-26 05:15:43 +08:00
feat(aws-startup-advisor): derive mantle_selector from ai_constraints.mantle_requirements in Design and disclose the bedrock-runtime assumption
Design no longer infers the Bedrock endpoint from the source API, the model or a
guess: gcp-to-aws and azure-to-aws design-ai.md gain Step 0.8, which reads
preferences.json -> ai_constraints.mantle_requirements (Clarify Q22b / Q10.5),
derives bedrock_models[].mantle_selector only from a detected|user entry (plus
the catalog for mantle_only_model_or_api), records the cited entry as
bedrock_models[].mantle_requirement on every mantle_* row, and writes the
verbatim endpoint_assumption sentence ("No Mantle-only requirement was recorded
for <workload_id>; bedrock-runtime selected. ... re-run Clarify.") on every
runtime row. Generate echoes whichever field is present in the script/adapter
header; the llm-to-bedrock report renders an Endpoint line from a new
"Endpoint basis:" context line and cites the public Responses API page for the
Runtime background=true 400.
Design: skills/gcp-to-aws/references/phases/design/design-ai.md (Step 0.8,
Part 5, Part 6 table, Validation Checklist, Present Summary item 6)
skills/azure-to-aws/references/phases/design/design-ai.md (Step 0.8,
Parts 3/5, Completion gate, Present summary)
Schema: skills/shared/ai/schema-design-aws-ai.md (bedrock_models[] bullet,
new "mantle_requirement and endpoint_assumption" section, 2 checklist
items) + vendored copies in gcp-to-aws/azure-to-aws references/vendored/ai
skills/gcp-to-aws/references/shared/schema-design-aws-ai.md
skills/azure-to-aws/references/shared/schema-design-aws-ai.md
Generate: skills/gcp-to-aws/references/phases/generate/generate-artifacts-ai.md
skills/gcp-to-aws/references/phases/generate/generate-ai.md
skills/azure-to-aws/references/phases/generate/generate-artifacts-ai.md
Report: skills/llm-to-bedrock/SKILL.md (Endpoint policy paragraph, B1 tuple,
Endpoint basis: context line)
agents/llm2bedrock-report-generator.md (Executive Summary Endpoint
line, Model Mapping notes, Limitations)
Fixtures: fixtures/aws-design-ai/multi-provider-direct (detected web_search
Mantle row + runtime endpoint_assumption), openrouter-gateway-multi-
upstream (in_region_processing mantle_requirement + 2 assumptions),
new runtime-default-no-requirement (runtime-only design)
Tests: tests/test_mantle_requirements_design_contract.py (17 tests)
Verification (all run on this commit's tree):
- python3 tools/sync-vendored.py && --check: PASS, 64 files (2 re-synced)
- python3 scripts/validate-artifacts.py --fixtures: PASS, 101 artifacts, 0 errors,
baseline unchanged (MISSING_REQUIRED=6, UNKNOWN_KEY=44)
- mise -C plugins/aws-startup-advisor run ci: exit 0 — lint:md 0 errors/823
files, lint:artifacts PASS, lint:vendored-parity PASS, lint:skill-refs PASS
(1532 refs), model-id/staleness/catalog-drift/pricing/consent PASS,
test 1496 passed + 222 subtests, test:telemetry 311 passed,
test:heroku-source-review PASS
- skills/llm-to-bedrock/scripts: 655 passed (unchanged)
- skills/agent-advisor/scripts: 570 passed (no file under agent-advisor changed)
- python3 tools/validate.py: all validations passed; git diff --check clean
This commit is contained in:
@@ -752,12 +752,13 @@ banner. Do NOT use the plain ✅ banner just because
|
||||
- **Migration Track:** Track 2 (AI-Only — no infrastructure changes)
|
||||
- **Deliverable:** Git branch `<branch_name>` (the rewriter's returned `branch_name` — may be collision-suffixed, e.g. `bedrock-migration-2`)
|
||||
- **Side-by-side validation:** <one of: `Yes — live same-model baseline` / `Yes — live substitute-model baseline (<live_source_baseline_used_model> instead of <source_model_id>)` / `No — static baselines only` / `N/A — connectivity only (same-family)` / `N/A — no golden cases`> (matches the banner block chosen above)
|
||||
- **Endpoint:** <from the `Endpoint basis:` context line — `bedrock-runtime` or `bedrock-mantle (<selector>, <source>)` per target; when a target is on bedrock-runtime, quote its `endpoint_assumption` sentence verbatim on the next line; when the context line is absent render `bedrock-runtime (plan predates mantle_requirements; re-run Clarify to record a Mantle-only requirement)`>
|
||||
|
||||
### Model Mapping
|
||||
|
||||
| Source Model | Bedrock Model | Notes |
|
||||
| ---------------- | ----------------- | ------- |
|
||||
| <source_model_1> | <bedrock_model_1> | <notes> |
|
||||
| <source_model_1> | <bedrock_model_1> | <notes — for a Mantle target: `mantle (<mantle_selector>; <mantle_requirement.source>; <mantle_requirement.evidence>)` from the `Endpoint basis:` line; for a runtime target: `bedrock-runtime`> |
|
||||
|
||||
### Overall Status: <READY TO MERGE / NEEDS REVIEW / BLOCKED>
|
||||
|
||||
@@ -975,6 +976,8 @@ This evaluation was based on **<coverage_level>**:
|
||||
|
||||
<Honest list of what wasn't tested or verified>
|
||||
|
||||
- **Endpoint choice:** the bedrock-runtime / bedrock-mantle decision above rests on the Mantle-only requirements Clarify recorded (a detected code signal the user confirmed, or the user's own answer) — not on an inspection of every request this app sends. bedrock-runtime rejects `background=true` with a 400 (https://docs.aws.amazon.com/bedrock/latest/userguide/inference-responses-api.html, read 2026-11-07); if a workload turns out to need background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify rather than editing the generated client.
|
||||
|
||||
### Evaluation methodology disclosure
|
||||
|
||||
- **Judge model:** `<judge_model from evaluator's return>`. The
|
||||
|
||||
+10
-2
@@ -58,7 +58,7 @@
|
||||
"target_aws_service": null,
|
||||
"capability": "text_generation",
|
||||
"capability_confidence": "high",
|
||||
"rationale": "OpenAI-sourced support bot moves to GPT-5.6 Terra on Bedrock Mantle, same provider lineage.",
|
||||
"rationale": "OpenAI-sourced support bot moves to GPT-5.6 Terra on Bedrock Mantle, same provider lineage; Discover detected the provider-run Web Search tool (src/ai/openai_client.py:14) and the user confirmed it in Clarify, so Mantle is required.",
|
||||
"confidence_warning": null
|
||||
}
|
||||
],
|
||||
@@ -79,6 +79,7 @@
|
||||
"migration_complexity": "low",
|
||||
"model_change": true,
|
||||
"migration_path": "direct",
|
||||
"endpoint_assumption": "No Mantle-only requirement was recorded for wl_anthropic_chat; bedrock-runtime selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.",
|
||||
"quota_risk": "low"
|
||||
},
|
||||
{
|
||||
@@ -93,7 +94,14 @@
|
||||
"migration_complexity": "low",
|
||||
"model_change": true,
|
||||
"migration_path": "mantle_openai_responses",
|
||||
"mantle_selector": "in_region_processing",
|
||||
"required_client_api": "responses",
|
||||
"mantle_selector": "web_search",
|
||||
"mantle_requirement": {
|
||||
"workload_id": "wl_openai_support_bot",
|
||||
"selector": "web_search",
|
||||
"source": "detected",
|
||||
"evidence": "src/ai/openai_client.py:14 tools=[{\"type\": \"web_search\"}]"
|
||||
},
|
||||
"quota_risk": "low"
|
||||
}
|
||||
],
|
||||
|
||||
+8
@@ -129,6 +129,7 @@
|
||||
"migration_complexity": "medium",
|
||||
"model_change": true,
|
||||
"migration_path": "direct",
|
||||
"endpoint_assumption": "No Mantle-only requirement was recorded for wl_router_chat_primary; bedrock-runtime selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.",
|
||||
"quota_risk": "low"
|
||||
},
|
||||
{
|
||||
@@ -143,6 +144,7 @@
|
||||
"migration_complexity": "medium",
|
||||
"model_change": true,
|
||||
"migration_path": "direct",
|
||||
"endpoint_assumption": "No Mantle-only requirement was recorded for wl_router_chat_cheap; bedrock-runtime selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.",
|
||||
"quota_risk": "low"
|
||||
},
|
||||
{
|
||||
@@ -158,6 +160,12 @@
|
||||
"model_change": true,
|
||||
"migration_path": "mantle_openai_responses",
|
||||
"mantle_selector": "in_region_processing",
|
||||
"mantle_requirement": {
|
||||
"workload_id": "wl_router_fallback",
|
||||
"selector": "in_region_processing",
|
||||
"source": "user",
|
||||
"region": "us-east-1"
|
||||
},
|
||||
"quota_risk": "medium"
|
||||
}
|
||||
],
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"phase": "design",
|
||||
"focus": "ai",
|
||||
"timestamp": "2026-11-08T02:20:00Z",
|
||||
"source_profile": "ai-workload-profile.json",
|
||||
"metadata": {
|
||||
"ai_sources": [
|
||||
{
|
||||
"provider": "openai",
|
||||
"source_service": "openai_api",
|
||||
"model_families": ["gpt"],
|
||||
"model_evidence": "observed",
|
||||
"models": ["gpt-4o"],
|
||||
"model_observations": [
|
||||
{
|
||||
"normalized_model": "gpt-4o",
|
||||
"raw_model": "gpt-4o",
|
||||
"model_family": "gpt",
|
||||
"evidence": [{"provenance": "code", "confidence": "high", "detail": "src/ai/openai_client.py:9"}]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"gateways": [],
|
||||
"bedrock_models_selected": ["us.openai.gpt-5.6-terra"],
|
||||
"regional_validation": "checked"
|
||||
},
|
||||
"design_blocks": [
|
||||
{
|
||||
"workload_id": "wl_openai_support_bot",
|
||||
"model_id": "gpt-4o",
|
||||
"target_bedrock_model": "us.openai.gpt-5.6-terra",
|
||||
"target_aws_service": null,
|
||||
"capability": "text_generation",
|
||||
"capability_confidence": "high",
|
||||
"rationale": "OpenAI-sourced support bot moves to GPT-5.6 Terra on the bedrock-runtime CRIS path; Clarify recorded no Mantle-only requirement, so the default endpoint applies.",
|
||||
"confidence_warning": null
|
||||
}
|
||||
],
|
||||
"ai_architecture": {
|
||||
"honest_assessment": "strong_migrate",
|
||||
"honest_assessment_reason": null,
|
||||
"tiered_strategy": null,
|
||||
"bedrock_models": [
|
||||
{
|
||||
"source_model_id": "gpt-4o",
|
||||
"aws_model_id": "us.openai.gpt-5.6-terra",
|
||||
"capabilities_matched": ["text_generation"],
|
||||
"capability_gaps": [],
|
||||
"honest_assessment": "strong_migrate",
|
||||
"source_provider_price": "2.50/10.00 per 1M tokens",
|
||||
"bedrock_price": "2.20/13.20 per 1M tokens",
|
||||
"price_comparison": "mixed",
|
||||
"migration_complexity": "low",
|
||||
"model_change": true,
|
||||
"migration_path": "runtime_openai_cris",
|
||||
"required_client_api": "responses",
|
||||
"endpoint_assumption": "No Mantle-only requirement was recorded for wl_openai_support_bot; bedrock-runtime selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.",
|
||||
"quota_risk": "low"
|
||||
}
|
||||
],
|
||||
"capability_mapping": {
|
||||
"text_generation": {"parity": "full", "notes": "The runtime OpenAI-compatible Responses API covers the detected usage."}
|
||||
},
|
||||
"code_migration": {
|
||||
"primary_pattern": "direct_sdk",
|
||||
"framework": "none",
|
||||
"files_to_modify": ["src/ai/openai_client.py"],
|
||||
"dependency_changes": "openai>=2.45.0 with aws_bedrock_token_generator for the OpenAI client; base URL and model id change only."
|
||||
},
|
||||
"infrastructure": [],
|
||||
"services_to_migrate": []
|
||||
},
|
||||
"regional_warnings": [],
|
||||
"multi_model_warnings": [],
|
||||
"agentic_design": null
|
||||
}
|
||||
+51
-7
@@ -98,6 +98,40 @@ region with geographic `eu.` inference profiles (`global.` forbidden); `pci`/`so
|
||||
CloudTrail on Bedrock API calls + the Part 5 logging lines. Every constraint that changed a
|
||||
choice adds a `regional_warnings[]` entry or a Part 5 line, and the summary names the regime.
|
||||
|
||||
## Step 0.8: Endpoint selection from Clarify's Mantle requirements
|
||||
|
||||
Read `preferences.json` → `ai_constraints.mantle_requirements` (Clarify Q22b, or Q10.5 in the
|
||||
AI-only flow; absent on older runs = no requirement recorded, treat as one
|
||||
`{ "workload_id": "*", "selector": "none", "source": "none" }` entry). The endpoint of every
|
||||
`bedrock_models[]` row is decided here and only here — never from the source API, the model
|
||||
family, or a guess (`references/vendored/ai/bedrock-endpoint-policy.md`). Full field shapes:
|
||||
`references/shared/schema-design-aws-ai.md` § mantle_selector.
|
||||
|
||||
Per workload (`workloads[]` from `preferences.json`, else the profile; `*` applies to every row):
|
||||
|
||||
1. Match `value[]` entries whose `workload_id` is the workload's id or `*`, whose `selector` is
|
||||
one of `background_inference | server_side_tools | web_search | projects | workspaces |
|
||||
in_region_processing`, and whose `source` is `detected` or `user`. `none` matches nothing.
|
||||
2. **Match → Mantle path for the source API** (`mantle_openai_responses` / `mantle_openai_chat` /
|
||||
`mantle_messages`) with `mantle_selector` = the matched selector (several → first in the order
|
||||
above, name the rest in `rationale`) and `mantle_requirement` copied from the entry:
|
||||
`{ workload_id, selector, source, evidence? (when detected), region? (iff in_region_processing) }`.
|
||||
`in_region_processing` still obeys the CRIS-only gate in
|
||||
`references/vendored/ai/ai-openai-to-bedrock.md`: Mantle only when `bedrock-runtime` serves the
|
||||
model in that `region` through a CRIS profile alone; otherwise runtime in-Region.
|
||||
3. **`mantle_only_model_or_api`** is never a Clarify value — Design derives it from the catalog
|
||||
(`ai-openai-to-bedrock.md` / `openai-on-bedrock.md` access paths) and records
|
||||
`mantle_requirement.source: "catalog"` with the catalog row as `evidence`.
|
||||
4. **No match → `bedrock-runtime` default** (`runtime_openai_cris` / `runtime_messages` /
|
||||
`converse` / `gpt-oss` / `direct`) and the row records `endpoint_assumption`, exactly:
|
||||
`No Mantle-only requirement was recorded for <workload_id>; bedrock-runtime selected. If this
|
||||
workload needs background inference, server-side tools, Projects/Workspaces, or single-Region
|
||||
processing, re-run Clarify.` — `<workload_id>` = the `design_blocks[].workload_id` whose
|
||||
`model_id` equals the row's `source_model_id` (several → comma-joined).
|
||||
|
||||
Exactly one of `mantle_requirement` / `endpoint_assumption` is present on every row; Generate
|
||||
echoes it in the script/adapter header and the llm-to-bedrock report quotes it.
|
||||
|
||||
## Part 1: Bedrock model selection
|
||||
|
||||
**New-target eligibility — before every selection or same-model shortcut, including the
|
||||
@@ -193,7 +227,7 @@ Partial/None.
|
||||
## Part 3: Integration pattern → effort
|
||||
|
||||
Map `integration.pattern`: `direct_sdk` (Azure OpenAI/OpenAI, model on Bedrock, region carries
|
||||
it) → Runtime OpenAI API on `bedrock-runtime` CRIS (Mantle only with a `mantle_selector`), minimal;
|
||||
it) → Runtime OpenAI API on `bedrock-runtime` CRIS (Mantle only with a `mantle_selector` from Step 0.8), minimal;
|
||||
`direct_sdk` → Bedrock SDK/Converse, medium; `framework`
|
||||
→ LangChain/LlamaIndex + Bedrock, low; `rest_api` → Bedrock REST, medium; `mixed` → per-model.
|
||||
|
||||
@@ -223,8 +257,10 @@ base URL (`https://bedrock-runtime.{region}.amazonaws.com/openai/v1`), credentia
|
||||
Bedrock token or API key), model ID (the CRIS profile), and IAM (`bedrock:InvokeModel*`) change.
|
||||
The **Mantle** path (`migration_path: "mantle_openai_responses"` / `"mantle_openai_chat"`, base URL
|
||||
`.../openai/v1` on `bedrock-mantle`, `bedrock-mantle:*` IAM) is recorded only when the row also
|
||||
carries `bedrock_models[].mantle_selector` (`references/vendored/ai/bedrock-endpoint-policy.md`);
|
||||
API continuity alone never selects Mantle. Read `references/shared/openai-on-bedrock.md` for exact
|
||||
carries `bedrock_models[].mantle_selector` (from Step 0.8 — derived from
|
||||
`ai_constraints.mantle_requirements` and cited in `mantle_requirement`;
|
||||
`references/vendored/ai/bedrock-endpoint-policy.md`); API continuity alone never selects Mantle.
|
||||
Every runtime row carries the Step 0.8 `endpoint_assumption` sentence. Read `references/shared/openai-on-bedrock.md` for exact
|
||||
values. **A Chat Completions source is a
|
||||
supported near-drop-in for GPT-6 and GPT-5.6** (both list Chat Completions on mantle and runtime
|
||||
CRIS per their model cards) — keep `chat.completions.create` unless a Responses-only feature or
|
||||
@@ -283,9 +319,9 @@ deployment names need verified model identity, not a guessed GPT family.
|
||||
Anthropic-SDK sources → keep the Anthropic SDK on the `bedrock-runtime` Messages endpoint:
|
||||
`migration_path: "runtime_messages"` with `required_client_api: "messages"` by default;
|
||||
`"converse"` (boto3 rewrite) only on explicit request or for a Converse-only feature;
|
||||
`"mantle_messages"` only with a `mantle_selector`. Record `code_migration.openrouter_path`
|
||||
`"mantle_messages"` only with a `mantle_selector` (from Step 0.8, a `workspaces` entry). Record `code_migration.openrouter_path`
|
||||
when a router was detected (`same_model_runtime|same_model_mantle|direct|litellm|keep_openrouter`;
|
||||
`same_model_runtime` is the default same-model route, `same_model_mantle` needs a `mantle_selector`).
|
||||
`same_model_runtime` is the default same-model route, `same_model_mantle` needs a `mantle_selector` from Step 0.8).
|
||||
|
||||
## Part 6: Write output
|
||||
|
||||
@@ -298,7 +334,14 @@ Write `aws-design-ai.json` to `$MIGRATION_DIR/` per `references/shared/schema-de
|
||||
## Completion gate (fail closed)
|
||||
|
||||
Before returning control to `design.md`, require `aws-design-ai.json` to exist and pass the
|
||||
Validation Checklist in `references/shared/schema-design-aws-ai.md`. If it fails: STOP and
|
||||
Validation Checklist in `references/shared/schema-design-aws-ai.md`, including:
|
||||
|
||||
- Every `mantle_*` row's `mantle_selector` is derived from an `ai_constraints.mantle_requirements`
|
||||
entry (or the catalog for `mantle_only_model_or_api`) and the row carries `mantle_requirement`
|
||||
citing it (`selector` equal to `mantle_selector`).
|
||||
- Every non-`mantle_*` row carries the `endpoint_assumption` sentence naming its workload.
|
||||
|
||||
If it fails: STOP and
|
||||
output "design-ai did not produce a valid aws-design-ai.json; do not complete Phase 3."
|
||||
|
||||
> **`_assert` has no teeth.** This gate is prose the model both produces and evaluates — CI
|
||||
@@ -309,7 +352,8 @@ output "design-ai did not produce a valid aws-design-ai.json; do not complete Ph
|
||||
|
||||
Overall honest assessment; the source→Bedrock model comparison (price + assessment per model);
|
||||
integration pattern and complexity; capability gaps; and — prominently, if `weak_migrate`/
|
||||
`recommend_stay` — the reason. Name any compliance regime that shaped the design.
|
||||
`recommend_stay` — the reason. Name any compliance regime that shaped the design. Endpoint per
|
||||
workload — `bedrock-mantle (<selector>, <source>)` or the `endpoint_assumption` sentence verbatim.
|
||||
|
||||
## Status — implemented (AI design route)
|
||||
|
||||
|
||||
+4
@@ -48,6 +48,10 @@ Read `aws-design-ai.json → ai_architecture.code_migration.migration_path` and
|
||||
> adapter. Mantle is used only when Design recorded a `mantle_selector`
|
||||
> (`references/vendored/ai/bedrock-endpoint-policy.md`). The `direct` adapter path is the exception
|
||||
> (cross-family swap, or a Converse feature no same-model path can serve), not the default.
|
||||
> For a `runtime_openai_cris` or `runtime_messages` row, echo the row's `endpoint_assumption`
|
||||
> sentence in the generated script/adapter header comment; for a `mantle_*` row, echo that
|
||||
> selector and its `mantle_requirement` (workload, source, evidence) there instead, so the
|
||||
> endpoint choice stays traceable to the Clarify answer.
|
||||
|
||||
## Step 1M: `migrate_to_mantle.sh` (mantle path)
|
||||
|
||||
|
||||
+24
-2
@@ -105,8 +105,9 @@ Traditional-AI capabilities (AWS AI service, not Bedrock): `document_extraction`
|
||||
`bedrock_price`, `price_comparison`, `migration_complexity`, `model_change` (bool),
|
||||
`migration_path` (see below), `quota_risk` (`low|medium|high`), `required_client_api`
|
||||
(see below), `mantle_selector` (REQUIRED on every `mantle_*` row, absent otherwise — see
|
||||
below). Traditional-AI capabilities do NOT appear here — they are `design_blocks[]` rows
|
||||
with `target_aws_service`.
|
||||
below), `mantle_requirement` (REQUIRED on every `mantle_*` row) and `endpoint_assumption`
|
||||
(REQUIRED on every non-`mantle_*` row) — see § mantle_selector. Traditional-AI capabilities do
|
||||
NOT appear here — they are `design_blocks[]` rows with `target_aws_service`.
|
||||
- **`capability_mapping`** — per capability that is `true` in the profile's
|
||||
`integration.capabilities_summary`: `{ parity: "full|partial|none", notes }`.
|
||||
- **`code_migration`** — `migration_path` (the selected API/endpoint path consumed by Generate),
|
||||
@@ -163,6 +164,23 @@ leaving the `bedrock-runtime` default (definitions in `vendored/ai/bedrock-endpo
|
||||
API continuity (the app already calls Responses, Chat Completions or Messages) is not a selector.
|
||||
Absent on `runtime_*`, `converse`, `gpt-oss` and `direct` rows.
|
||||
|
||||
**How it is derived (`mantle_requirement` / `endpoint_assumption`).** `design-ai.md` Step 0.8
|
||||
reads `preferences.json → ai_constraints.mantle_requirements.value[]` (Clarify Q22b / Q10.5;
|
||||
absent on older runs = no requirement recorded). A workload with a matching entry (its own
|
||||
`workload_id` or `*`) whose `selector` is one of `background_inference | server_side_tools |
|
||||
web_search | projects | workspaces | in_region_processing` and whose `source` is `detected` or
|
||||
`user` takes the Mantle path for its source API with that `mantle_selector`, and the row records
|
||||
`mantle_requirement` — object, REQUIRED on every `mantle_*` row, absent otherwise:
|
||||
`{ workload_id, selector, source, evidence?, region? }` (`selector` equals `mantle_selector`;
|
||||
`source` ∈ `detected | user | catalog`; `evidence` present when `source` is `detected` or
|
||||
`catalog`; `region` present iff `selector` is `in_region_processing`). `mantle_only_model_or_api`
|
||||
comes from the model catalog with `source: "catalog"`, never from Clarify. Every other row keeps
|
||||
`bedrock-runtime` and records `endpoint_assumption` — string, REQUIRED on every non-`mantle_*`
|
||||
row, exactly: `No Mantle-only requirement was recorded for <workload_id>; bedrock-runtime
|
||||
selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or
|
||||
single-Region processing, re-run Clarify.` (`<workload_id>` = the `design_blocks[].workload_id`
|
||||
whose `model_id` equals the row's `source_model_id`; several → comma-joined).
|
||||
|
||||
## required_client_api (per `bedrock_models[]` entry)
|
||||
|
||||
`responses | converse | chat_completions | invoke | messages` — records the client API surface the
|
||||
@@ -250,6 +268,10 @@ rubric file (`ai.md`, `ai-azure-openai-to-bedrock.md`, or a `vendored/ai/*` ref)
|
||||
to a Claude/Nova substitute — and records `migration_path: "runtime_openai_cris"` by default.
|
||||
- [ ] Every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a
|
||||
`mantle_selector` from the enum above; no `runtime_*`/`converse` row carries one.
|
||||
- [ ] Every `mantle_*` row carries `mantle_requirement` with `selector == mantle_selector`
|
||||
(derived in Step 0.8 from `ai_constraints.mantle_requirements`, or the catalog for
|
||||
`mantle_only_model_or_api`); every non-`mantle_*` row carries the `endpoint_assumption`
|
||||
sentence naming its workload.
|
||||
- [ ] `regional_warnings` and `multi_model_warnings` are present (`[]` when clean).
|
||||
- [ ] If `agentic_profile.is_agentic == true`: `agentic_design` is present with
|
||||
`migration_approach` matching `preferences.json`; a `harness` source with an
|
||||
|
||||
+68
-3
@@ -178,9 +178,12 @@ Traditional-AI capabilities (AWS AI service, not Bedrock): `document_extraction`
|
||||
`migration_path` (see below), `quota_risk` (`low|medium|high`), `required_client_api`
|
||||
(`responses | chat_completions | converse | invoke | messages` — the client API surface the
|
||||
generated code must use; for `runtime_openai_cris` it is the API the source app already
|
||||
calls, never an implicit Converse), and `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below). Traditional-AI capabilities do NOT appear here — they are
|
||||
`design_blocks[]` rows with `target_aws_service`.
|
||||
calls, never an implicit Converse), `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below), `mantle_requirement` (object, REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — the Clarify entry or catalog row the selector was derived from; see below)
|
||||
and `endpoint_assumption` (string, REQUIRED on every row whose `migration_path` does NOT start
|
||||
with `mantle_` — the verbatim bedrock-runtime disclosure; see below). Traditional-AI
|
||||
capabilities do NOT appear here — they are `design_blocks[]` rows with `target_aws_service`.
|
||||
- **`capability_mapping`** — per capability that is `true` in the profile's
|
||||
`integration.capabilities_summary`: `{ parity: "full|partial|none", notes }`.
|
||||
- **`code_migration`** — `primary_pattern` (matches profile `integration.pattern`),
|
||||
@@ -226,6 +229,61 @@ leaving the `bedrock-runtime` default (definitions in `vendored/ai/bedrock-endpo
|
||||
API continuity (the app already calls Responses, Chat Completions or Messages) is not a selector.
|
||||
Absent on `runtime_*`, `converse`, `gpt-oss` and `direct` rows.
|
||||
|
||||
## mantle_requirement and endpoint_assumption (how mantle_selector is derived)
|
||||
|
||||
Design never infers a `mantle_selector` from the source API, the model, or a guess. It reads
|
||||
`preferences.json → ai_constraints.mantle_requirements.value[]` (written by Clarify — full flow
|
||||
Q22b, AI-only Q10.5; absent on older runs = no requirement recorded) and applies this rule per
|
||||
workload:
|
||||
|
||||
- A workload (matched by its own `workload_id`, or by an entry whose `workload_id` is `*`) with an
|
||||
entry whose `selector` is one of `background_inference | server_side_tools | web_search |
|
||||
projects | workspaces | in_region_processing` and whose `source` is `detected` or `user` takes
|
||||
the Mantle path for its source API — `mantle_openai_responses` for a Responses source,
|
||||
`mantle_openai_chat` for a Chat Completions source, `mantle_messages` for an Anthropic SDK
|
||||
source — with `mantle_selector` = that selector. Several matching entries → the first in the
|
||||
policy-table order `background_inference, server_side_tools, web_search, projects, workspaces,
|
||||
in_region_processing` becomes `mantle_selector`; name the others in the row's `rationale`.
|
||||
`in_region_processing` applies only when `bedrock-runtime` serves the model in the entry's
|
||||
`region` through a CRIS profile alone (the CRIS-only gate in `ai-openai-to-bedrock.md`);
|
||||
otherwise the workload stays on `bedrock-runtime` in that Region.
|
||||
- `mantle_only_model_or_api` is never a Clarify value: Design derives it from the catalog
|
||||
(`ai-openai-to-bedrock.md` / `openai-on-bedrock.md` access-path tables) when the selected model
|
||||
or API exists only on `bedrock-mantle`, and records `mantle_requirement.source: "catalog"`.
|
||||
- Every other workload keeps the `bedrock-runtime` default and its row records
|
||||
`endpoint_assumption` verbatim (below). A `none` entry, a default entry, or no entry at all is a
|
||||
runtime lane by design, not an inference.
|
||||
|
||||
**`bedrock_models[].mantle_requirement`** — object, REQUIRED on every row whose `migration_path`
|
||||
starts with `mantle_`, absent otherwise:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"workload_id": "wl_3a1f2c", // the workloads[].workload_id the entry applied to, or "*"
|
||||
"selector": "web_search", // same value as the row's mantle_selector
|
||||
"source": "detected", // detected | user | catalog
|
||||
"evidence": "src/ai/openai_client.py:14 tools=[{\"type\": \"web_search\"}]", // present when source is detected (file:line construct) or catalog (the catalog file/row)
|
||||
"region": "us-east-1" // present iff selector is in_region_processing
|
||||
}
|
||||
```
|
||||
|
||||
`source: detected | user` entries are copied from the matching
|
||||
`ai_constraints.mantle_requirements.value[]` entry (same `workload_id`, `selector`, `evidence`,
|
||||
`region`); `source: "catalog"` is written only by Design for `mantle_only_model_or_api`.
|
||||
|
||||
**`bedrock_models[].endpoint_assumption`** — string, REQUIRED on every row whose
|
||||
`migration_path` does NOT start with `mantle_` (`runtime_openai_cris`, `runtime_messages`,
|
||||
`converse`, `gpt-oss`, `direct`), exactly:
|
||||
|
||||
> No Mantle-only requirement was recorded for `<workload_id>`; bedrock-runtime selected. If this
|
||||
> workload needs background inference, server-side tools, Projects/Workspaces, or single-Region
|
||||
> processing, re-run Clarify.
|
||||
|
||||
where `<workload_id>` is the `design_blocks[].workload_id` whose `model_id` equals the row's
|
||||
`source_model_id` (several workloads → comma-joined ids). Generate echoes the sentence in the
|
||||
generated script/adapter header and the llm-to-bedrock report quotes it, so the user sees that
|
||||
the runtime choice rests on a recorded answer, not on a silent default.
|
||||
|
||||
## regional_validation
|
||||
|
||||
`checked` (`aws___get_regional_availability` on the AWS MCP Server confirmed model/region
|
||||
@@ -294,6 +352,13 @@ rubric file (`ai.md`, a provider-to-Bedrock mapping guide, or a `vendored/ai/*`
|
||||
and records `migration_path: "runtime_openai_cris"` by default.
|
||||
- [ ] Every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a
|
||||
`mantle_selector` from the enum above; no `runtime_*`/`converse` row carries one.
|
||||
- [ ] Every `mantle_*` row carries a `mantle_requirement` whose `selector` equals the row's
|
||||
`mantle_selector`, whose `source` is `detected | user | catalog` (`catalog` iff the selector
|
||||
is `mantle_only_model_or_api`), and whose `region` is present iff the selector is
|
||||
`in_region_processing`; the selector was derived from an
|
||||
`ai_constraints.mantle_requirements` entry (or the catalog), never from the source API.
|
||||
- [ ] Every non-`mantle_*` row carries the `endpoint_assumption` sentence verbatim, naming the
|
||||
`design_blocks[].workload_id`(s) whose `model_id` equals the row's `source_model_id`.
|
||||
- [ ] `regional_warnings` and `multi_model_warnings` are present (`[]` when clean).
|
||||
- [ ] If `agentic_profile.is_agentic == true`: `agentic_design` is present with
|
||||
`migration_approach` matching `preferences.json`; a `harness` source whose origin resolves
|
||||
|
||||
+28
-4
@@ -27,7 +27,7 @@ Read `$MIGRATION_DIR/preferences.json` → `ai_constraints` (if present). If abs
|
||||
`references/shared/openai-on-bedrock.md` (the fact base: model IDs, endpoint paths, region matrix, quotas,
|
||||
caching). OpenAI's proprietary GPT models run on Bedrock, so the source model is often itself the target — the
|
||||
mapping guide's Tier 0 path is the default, not a cross-family swap.
|
||||
- `"anthropic"` → load `references/vendored/ai/ai-anthropic-to-bedrock.md` (Anthropic SDK → Bedrock Runtime Messages (default) / Converse alternative; the Anthropic SDK stays and is repointed at `https://bedrock-runtime.{region}.amazonaws.com/anthropic` — record `migration_path: "runtime_messages"` with `required_client_api: "messages"` by default, `"converse"` only on explicit request or for a Converse-only feature, `"mantle_messages"` only with a `mantle_selector`; do NOT use ai-openai-to-bedrock.md for Anthropic SDK users)
|
||||
- `"anthropic"` → load `references/vendored/ai/ai-anthropic-to-bedrock.md` (Anthropic SDK → Bedrock Runtime Messages (default) / Converse alternative; the Anthropic SDK stays and is repointed at `https://bedrock-runtime.{region}.amazonaws.com/anthropic` — record `migration_path: "runtime_messages"` with `required_client_api: "messages"` by default, `"converse"` only on explicit request or for a Converse-only feature, `"mantle_messages"` only with a `mantle_selector` **recorded by Step 0.8 (a `workspaces` entry in `ai_constraints.mantle_requirements`)**; do NOT use ai-openai-to-bedrock.md for Anthropic SDK users)
|
||||
- `"both"` → `both` never means exactly "Gemini+OpenAI" — per
|
||||
`discover-anthropic-api.md` Step 4.5, `both` is also reached when Anthropic
|
||||
usage joins a Gemini-or-OpenAI codebase, so it can mean "Gemini+Anthropic"
|
||||
@@ -105,6 +105,26 @@ Record what was applied: every constraint that changed a model choice or region
|
||||
|
||||
---
|
||||
|
||||
## Step 0.8: Endpoint Selection from Clarify's Mantle Requirements
|
||||
|
||||
Read `preferences.json` → `ai_constraints.mantle_requirements` (written by Clarify Q22b, or Q10.5 in the AI-only flow). **Absent on older runs = no requirement recorded** — treat it like a single `{ "workload_id": "*", "selector": "none", "source": "none" }` entry. The endpoint of every `bedrock_models[]` row is decided HERE and only here; the source API, the model family, and your own judgment about what the app "probably" needs are not inputs (`references/vendored/ai/bedrock-endpoint-policy.md`: API continuity alone never selects Mantle).
|
||||
|
||||
**Derivation rule — apply per workload (`workloads[]` from `preferences.json`, falling back to the profile; when the profile has no `workloads[]`, every entry is `*` and applies to every row):**
|
||||
|
||||
1. Collect the `mantle_requirements.value[]` entries whose `workload_id` equals the workload's id or is `*`, and whose `selector` is one of `background_inference | server_side_tools | web_search | projects | workspaces | in_region_processing` with `source` ∈ `detected | user`. Entries with `selector: "none"` or `source: "none"` match nothing.
|
||||
2. **Any match → the Mantle path for the workload's source API:** `"mantle_openai_responses"` for a Responses source, `"mantle_openai_chat"` for a Chat Completions source, `"mantle_messages"` for an Anthropic SDK source. Set `bedrock_models[].mantle_selector` to the matched selector; when several entries match, take the first in the policy-table order `background_inference, server_side_tools, web_search, projects, workspaces, in_region_processing` and name the others in the row's `rationale`. Copy the matched entry into `bedrock_models[].mantle_requirement` — `{ workload_id, selector, source, evidence?, region? }` where `evidence` is present when `source` is `detected` (the Clarify entry's `file:line construct`) and `region` is present iff `selector` is `in_region_processing`.
|
||||
- `in_region_processing` still obeys the existing CRIS-only gate in `references/vendored/ai/ai-openai-to-bedrock.md`: it selects Mantle only when `bedrock-runtime` serves the selected model in the entry's `region` through a CRIS profile alone; when a runtime in-Region form exists, the workload stays on `bedrock-runtime` in that Region and the row records the `endpoint_assumption` below with a `rationale` note that the Region need is met on runtime.
|
||||
3. **`mantle_only_model_or_api` is never a Clarify value.** When the selected model or API exists only on `bedrock-mantle` per the catalog (`references/vendored/ai/ai-openai-to-bedrock.md` / `references/shared/openai-on-bedrock.md` access-path tables), record the Mantle path with `mantle_selector: "mantle_only_model_or_api"` and `mantle_requirement: { "workload_id": "<id>", "selector": "mantle_only_model_or_api", "source": "catalog", "evidence": "<catalog file § row>" }`.
|
||||
4. **No match → the `bedrock-runtime` default** (`"runtime_openai_cris"` / `"runtime_messages"` / `"converse"` / `"gpt-oss"` / `"direct"` per Parts 1 and 5) and the row records `bedrock_models[].endpoint_assumption`, exactly:
|
||||
|
||||
> No Mantle-only requirement was recorded for `<workload_id>`; bedrock-runtime selected. If this workload needs background inference, server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.
|
||||
|
||||
where `<workload_id>` is the `design_blocks[].workload_id` whose `model_id` equals the row's `source_model_id` (several workloads on one row → comma-joined ids). When the constraint was defaulted (`chosen_by: "default"`), the report caveat "Mantle-only requirements were not confirmed by the user; bedrock-runtime assumed" from Clarify stays in `metadata.report_caveats[]`.
|
||||
|
||||
Exactly one of `mantle_requirement` / `endpoint_assumption` is present on every `bedrock_models[]` row. Generate echoes whichever is present in the generated script/adapter header, and the llm-to-bedrock report quotes it.
|
||||
|
||||
---
|
||||
|
||||
## Part 1: Bedrock Model Selection
|
||||
|
||||
**New-target eligibility — before every selection or same-model shortcut, including the
|
||||
@@ -395,7 +415,7 @@ For each detected `integration.pattern` and `ai_source`, generate before/after m
|
||||
| Direct SDK (OpenAI), same model | OpenAI | Selected Mantle API (selector-gated) | Only with `mantle_selector`: base URL → `.../openai/v1` on Mantle, Bedrock credential, `openai.gpt-*` model ID, `bedrock-mantle:*` IAM |
|
||||
| Direct SDK | Vertex AI | boto3 Converse API | `generate_content()` → `converse()` |
|
||||
| Direct SDK | OpenAI | boto3 Converse API | `completions.create()` → `converse()` (use only for a need no same-model path serves, e.g. Knowledge Bases) |
|
||||
| Direct SDK | Anthropic | Runtime Anthropic Messages (default) | Keep `anthropic.Anthropic`; base URL → `https://bedrock-runtime.{region}.amazonaws.com/anthropic`, string Bedrock token, `global.`/Geo Claude profile ID, `bedrock:InvokeModel*` IAM; `migration_path: "runtime_messages"` + `required_client_api: "messages"`. `"converse"` (boto3 `messages.create()` → `converse()`) only on explicit request / Converse-only feature; `"mantle_messages"` only with a `mantle_selector` |
|
||||
| Direct SDK | Anthropic | Runtime Anthropic Messages (default) | Keep `anthropic.Anthropic`; base URL → `https://bedrock-runtime.{region}.amazonaws.com/anthropic`, string Bedrock token, `global.`/Geo Claude profile ID, `bedrock:InvokeModel*` IAM; `migration_path: "runtime_messages"` + `required_client_api: "messages"`. `"converse"` (boto3 `messages.create()` → `converse()`) only on explicit request / Converse-only feature; `"mantle_messages"` only with a `mantle_selector` **recorded by Step 0.8 (a `workspaces` entry)** |
|
||||
| LangChain | ChatVertexAI / ChatOpenAI | ChatBedrock | Swap import and model_id |
|
||||
| LlamaIndex | Vertex / OpenAI LLM | BedrockConverse | Swap import |
|
||||
| LLM Router (LiteLLM) | Any | Config change | `model="bedrock/<model_id>"` (1 line) |
|
||||
@@ -411,7 +431,9 @@ ID becomes the CRIS profile and IAM is `bedrock:InvokeModel*`. A `mantle_*` path
|
||||
(`"mantle_openai_chat"` for a Chat source, `"mantle_openai_responses"` for a Responses source — e.g.
|
||||
Astra on Standard Mantle in `us-east-1` or `us-west-2`) is recorded **only** when the row also
|
||||
records `bedrock_models[].mantle_selector` from `references/vendored/ai/bedrock-endpoint-policy.md`
|
||||
(the selector enum is defined there and only there); then keep the OpenAI SDK, use
|
||||
(the selector enum is defined there and only there), derived in Step 0.8 from
|
||||
`ai_constraints.mantle_requirements` (never from the source API, the model, or a guess) and cited
|
||||
in the row's `mantle_requirement`; then keep the OpenAI SDK, use
|
||||
`/openai/v1` on Mantle, Bedrock credentials and Mantle IAM. API continuity alone never selects
|
||||
Mantle. Do not reshape Astra Chat solely because it is proprietary GPT. Record `model_change: false` only when
|
||||
the exact source model is retained; a Pro-to-Astra upgrade is a model change requiring eval.
|
||||
@@ -522,7 +544,7 @@ Write `aws-design-ai.json` to `$MIGRATION_DIR/`.
|
||||
| `ai_architecture.honest_assessment` | string | `"strong_migrate"`, `"moderate_migrate"`, `"weak_migrate"`, `"recommend_stay"`, `"not_applicable"` (per-workload only — traditional-AI capabilities `document_extraction`/`image_analysis`/`speech_transcription`; never the overall assessment) |
|
||||
| `ai_architecture.honest_assessment_reason` | string/null | Required when `honest_assessment == "recommend_stay"`. The specific non-cost blocker (region, Realtime API, separate-service capability, Assistants API feature, unsupported API surface). Null otherwise. |
|
||||
| `ai_architecture.tiered_strategy` | object/null | Tiered model routing (null for low/medium volume) |
|
||||
| `ai_architecture.bedrock_models` | array | Per-model: `gcp_model_id`, `aws_model_id`, `capabilities_matched[]`, `capability_gaps[]`, `honest_assessment`, `source_provider_price`, `bedrock_price`, `price_comparison`, `migration_complexity` |
|
||||
| `ai_architecture.bedrock_models` | array | Per-model: `gcp_model_id`, `aws_model_id`, `capabilities_matched[]`, `capability_gaps[]`, `honest_assessment`, `source_provider_price`, `bedrock_price`, `price_comparison`, `migration_complexity`, `migration_path`, `mantle_selector` + `mantle_requirement` (every `mantle_*` row, from Step 0.8), `endpoint_assumption` (every non-`mantle_*` row, the Step 0.8 sentence) |
|
||||
| `ai_architecture.capability_mapping` | object | Per-capability: `parity` (full/partial/none), `notes` |
|
||||
| `ai_architecture.code_migration` | object | `primary_pattern`, `framework`, `files_to_modify[]`, `dependency_changes`, `migration_path`; per-model `required_client_api` selects the runtime API |
|
||||
| `ai_architecture.infrastructure` | array | GCP resource → AWS equivalent mappings with confidence |
|
||||
@@ -545,6 +567,7 @@ Write `aws-design-ai.json` to `$MIGRATION_DIR/`.
|
||||
- [ ] If `ai_source` includes `"openai"`: every model that `shared/openai-on-bedrock.md` lists as available on Bedrock, and whose target region carries it, is mapped to **itself** with `model_change: false` — not to a Claude/Nova substitute
|
||||
- [ ] If `honest_assessment == "recommend_stay"`: `honest_assessment_reason` names a non-cost blocker (cost parity alone is never sufficient for an OpenAI source)
|
||||
- [ ] Every same-model proprietary GPT row records `migration_path: "runtime_openai_cris"` by default; every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a `mantle_selector` from `references/vendored/ai/bedrock-endpoint-policy.md`, and no `runtime_*`/`converse` row carries one
|
||||
- [ ] Every `mantle_*` row's `mantle_selector` is derived from an `ai_constraints.mantle_requirements` entry (or the catalog for `mantle_only_model_or_api`) and the row carries `mantle_requirement` citing it; every non-`mantle_*` row carries the `endpoint_assumption` sentence naming its workload
|
||||
- [ ] No `bedrock_models[]` entry pairs a **bare** proprietary GPT id (including bare
|
||||
`openai.gpt-5.5` / `openai.gpt-5.4`) with a Converse/`bedrock-runtime` migration path.
|
||||
GPT-5.6, GPT-6, GPT-5.5 and GPT-5.4 MAY use `migration_path: "runtime_openai_cris"` on
|
||||
@@ -581,3 +604,4 @@ After writing `aws-design-ai.json`, present under 25 lines:
|
||||
3. Integration pattern and migration complexity
|
||||
4. Capability gaps (if any)
|
||||
5. If weak_migrate or recommend_stay: flag prominently with cost justification
|
||||
6. Endpoint per workload — `bedrock-mantle (<selector>, <source>)` or the `endpoint_assumption` sentence verbatim
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ Check `preferences.json` → `ai_constraints.ai_framework` to determine the migr
|
||||
|
||||
**OpenAI SDK users keeping the same model (config path for a Responses source; small reshape for a Chat Completions source)** — `ai_framework` = `direct` AND `ai_source` = `openai` AND (`migration_path` == `"runtime_openai_cris"` (the default) OR `migration_path` **starts with** `mantle` (`mantle`, `mantle_openai_responses`, `mantle_openai_chat`, selector-gated)):
|
||||
|
||||
- `runtime_openai_cris` (the default — GPT-5.6/GPT-6/GPT-5.5/GPT-5.4 via `bedrock-runtime` CRIS): point the client at `https://bedrock-runtime.{region}.amazonaws.com/openai/v1` — **not** the mantle URL. Update the model string to the CRIS inference-profile ID the selected model's card lists (`us.`/`in.`/`global.` for GPT-5.6 Terra and Luna; `us.`/`global.` only for GPT-5.6 Sol, GPT-6, GPT-5.5 and GPT-5.4), not the bare ID. Grant standard `bedrock:InvokeModel*` actions against the CRIS inference-profile ARN — **not** `bedrock-mantle:*`. For every runtime Responses / Chat Completions target — any proprietary GPT CRIS id by id form: GPT-5.6 Sol / Terra / Luna, the GPT-6 family, and GPT-5.5 / GPT-5.4 (`us.openai.gpt-5.5` / `global.openai.gpt-5.5`, `us.openai.gpt-5.4` / `global.openai.gpt-5.4`), or their `inference-profile/` ARNs — also grant `bedrock:InvokeModel` on `arn:aws:bedrock:{region}:{account}:project/default` alongside the inference-profile ARN: the Responses API authorizes the default project separately from the inference target (<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-responses-api.html>, read 2026-11-07) and each model card repeats it for its runtime CRIS ids; `iam_policy.py --target <aws_model_id>=<required_client_api>` (one pair per row, each row's own API) emits this third ARN for exactly the `responses` / `chat_completions` rows — a GPT secondary beside a Claude Messages primary included — and omits it for a `converse` or `messages` row. A source that keeps `client.responses.retrieve(id)` (or `.cancel` / `.delete`) also needs `bedrock:GetInvoke` (`CancelInvoke` / `DeleteInvoke`, only the retained ops) on that same `project/default` ARN — managing a stored response authorizes those actions on the project (same page, "Permissions", read 2026-11-08); `iam_policy.py --stored-response-ops retrieve[,cancel,delete]` emits them for a runtime `responses` row only, never for a `converse` / `messages` / `chat_completions` row. Read `aws-design-ai.json` → `ai_architecture.bedrock_models[].required_client_api` — the API the source app already calls — and emit that surface (`responses.create`, `chat.completions.create`, or Converse when Design recorded `converse` for a Guardrails or application-inference-profile need); for a region-only move it is simply the source's own API.
|
||||
- `mantle` / `mantle_openai_responses` / `mantle_openai_chat` (only when Design recorded a `mantle_selector`, see `references/vendored/ai/bedrock-endpoint-policy.md`): point the client at `https://bedrock-mantle.{region}.api.aws/openai/v1` — note the `openai/v1` segment for proprietary GPT models; a bare `/v1` 404s. Swap the credential for a Bedrock API key or the auto-refreshing token provider — **not** the existing OpenAI key. Update the model string to the bare Bedrock model ID (`openai.gpt-*` for a same-model move). Grant the `bedrock-mantle:*` actions; `bedrock:InvokeModel` does not authorize these models.
|
||||
- `runtime_openai_cris` (the default — GPT-5.6/GPT-6/GPT-5.5/GPT-5.4 via `bedrock-runtime` CRIS): point the client at `https://bedrock-runtime.{region}.amazonaws.com/openai/v1` — **not** the mantle URL. Update the model string to the CRIS inference-profile ID the selected model's card lists (`us.`/`in.`/`global.` for GPT-5.6 Terra and Luna; `us.`/`global.` only for GPT-5.6 Sol, GPT-6, GPT-5.5 and GPT-5.4), not the bare ID. Grant standard `bedrock:InvokeModel*` actions against the CRIS inference-profile ARN — **not** `bedrock-mantle:*`. For every runtime Responses / Chat Completions target — any proprietary GPT CRIS id by id form: GPT-5.6 Sol / Terra / Luna, the GPT-6 family, and GPT-5.5 / GPT-5.4 (`us.openai.gpt-5.5` / `global.openai.gpt-5.5`, `us.openai.gpt-5.4` / `global.openai.gpt-5.4`), or their `inference-profile/` ARNs — also grant `bedrock:InvokeModel` on `arn:aws:bedrock:{region}:{account}:project/default` alongside the inference-profile ARN: the Responses API authorizes the default project separately from the inference target (<https://docs.aws.amazon.com/bedrock/latest/userguide/inference-responses-api.html>, read 2026-11-07) and each model card repeats it for its runtime CRIS ids; `iam_policy.py --target <aws_model_id>=<required_client_api>` (one pair per row, each row's own API) emits this third ARN for exactly the `responses` / `chat_completions` rows — a GPT secondary beside a Claude Messages primary included — and omits it for a `converse` or `messages` row. A source that keeps `client.responses.retrieve(id)` (or `.cancel` / `.delete`) also needs `bedrock:GetInvoke` (`CancelInvoke` / `DeleteInvoke`, only the retained ops) on that same `project/default` ARN — managing a stored response authorizes those actions on the project (same page, "Permissions", read 2026-11-08); `iam_policy.py --stored-response-ops retrieve[,cancel,delete]` emits them for a runtime `responses` row only, never for a `converse` / `messages` / `chat_completions` row. Read `aws-design-ai.json` → `ai_architecture.bedrock_models[].required_client_api` — the API the source app already calls — and emit that surface (`responses.create`, `chat.completions.create`, or Converse when Design recorded `converse` for a Guardrails or application-inference-profile need); for a region-only move it is simply the source's own API. The guide's endpoint line quotes the row's `endpoint_assumption` sentence verbatim, so the reader sees the runtime choice rests on Clarify's recorded answer.
|
||||
- `mantle` / `mantle_openai_responses` / `mantle_openai_chat` (only when Design recorded a `mantle_selector`, see `references/vendored/ai/bedrock-endpoint-policy.md`): point the client at `https://bedrock-mantle.{region}.api.aws/openai/v1` — note the `openai/v1` segment for proprietary GPT models; a bare `/v1` 404s. Swap the credential for a Bedrock API key or the auto-refreshing token provider — **not** the existing OpenAI key. Update the model string to the bare Bedrock model ID (`openai.gpt-*` for a same-model move). Grant the `bedrock-mantle:*` actions; `bedrock:InvokeModel` does not authorize these models. The guide's endpoint line names the row's `mantle_requirement` (selector, source, evidence) so the Mantle choice stays traceable to the Clarify entry or catalog row.
|
||||
- **Config-only if the source already calls `responses.create`.** A Chat Completions source for GPT-6 or GPT-5.6 may keep `chat.completions.create`/`choices[0].message` parsing unchanged — Chat Completions is supported on both mantle and runtime CRIS for these models, so reshape to Responses is optional (only for a Responses-only feature or demonstrated constraint). GPT-5.5/GPT-5.4 follow the same rule — their model cards (read 2026-11-06) list Chat Completions on both mantle and runtime, so the reshape is optional for them too; probe the selected API against the target account before committing, as for any model.
|
||||
- Test in staging, validate responses
|
||||
|
||||
|
||||
+5
-4
@@ -56,11 +56,12 @@ Check `preferences.json` → `ai_constraints.ai_framework.value` and `aws-design
|
||||
variant of the same-model script (Step 1M, using the `us.`/`global.`-prefixed inference-profile
|
||||
ID, the `bedrock-runtime` base URL `https://bedrock-runtime.{region}.amazonaws.com/openai/v1`,
|
||||
`bedrock:InvokeModel*` IAM and the row's `required_client_api`) + setup (Step 3) + test harness
|
||||
(Step 2). Skip provider adapter (Step 1).
|
||||
- `migration_path` starts with `"mantle"` AND is one of the three OpenAI-SDK spellings — exactly `"mantle"`, `"mantle_openai_chat"` or `"mantle_openai_responses"` (`"mantle_messages"` is NOT this branch; it has its own entry below) → Generate Mantle setup (Step 1M) + setup (Step 3) + test harness (Step 2). Skip provider adapter (Step 1). Design records `"mantle_openai_responses"` or `"mantle_openai_chat"` only together with `bedrock_models[].mantle_selector` (see `references/vendored/ai/bedrock-endpoint-policy.md`); echo that selector in the generated script's header so the Mantle choice stays traceable. Treat the `"mantle_openai_responses"` spelling as this same Mantle path.
|
||||
(Step 2). Skip provider adapter (Step 1). Echo the row's `endpoint_assumption` sentence in the
|
||||
generated script's header comment so the bedrock-runtime choice stays traceable to Clarify.
|
||||
- `migration_path` starts with `"mantle"` AND is one of the three OpenAI-SDK spellings — exactly `"mantle"`, `"mantle_openai_chat"` or `"mantle_openai_responses"` (`"mantle_messages"` is NOT this branch; it has its own entry below) → Generate Mantle setup (Step 1M) + setup (Step 3) + test harness (Step 2). Skip provider adapter (Step 1). Design records `"mantle_openai_responses"` or `"mantle_openai_chat"` only together with `bedrock_models[].mantle_selector` (see `references/vendored/ai/bedrock-endpoint-policy.md`); echo that selector and its `mantle_requirement` (workload, source, evidence) in the generated script's header so the Mantle choice stays traceable. Treat the `"mantle_openai_responses"` spelling as this same Mantle path.
|
||||
- `migration_path` = `"gpt-oss"` → Generate provider adapter (Step 1) targeting the gpt-oss model on Bedrock via the Converse API + setup (Step 3) + test harness (Step 2). Use the Bedrock model ID from `aws-design-ai.json` → `ai_architecture.bedrock_models[].aws_model_id` (the gpt-oss model ID). Do NOT generate a Mantle script — gpt-oss uses the Converse API directly.
|
||||
- `migration_path` = `"runtime_messages"` (Anthropic source; Design's default for an Anthropic SDK app) → Generate provider adapter (Step 1) whose Bedrock provider class keeps the Anthropic SDK at the runtime base URL `https://bedrock-runtime.{region}.amazonaws.com/anthropic` with a string Bedrock token (`provide_token(region=...)` minted per client) and the row's `global.`/Geo Claude profile ID + setup (Step 3, `bedrock:InvokeModel*` and `bedrock:GetInferenceProfile` IAM) + test harness (Step 2). `required_client_api` is `"messages"`; do NOT generate a Mantle script and do NOT rewrite to Converse.
|
||||
- `migration_path` = `"mantle_messages"` (Anthropic source, only with `bedrock_models[].mantle_selector`, normally `workspaces`; matched by this entry ONLY, never by the OpenAI-SDK Mantle branch above) → Generate provider adapter (Step 1) with the same Anthropic-SDK adapter shape as `runtime_messages` but at the Mantle base URL `https://bedrock-mantle.{region}.api.aws/anthropic` with the bare `anthropic.claude-*` ID and `bedrock-mantle:*` IAM (Step 3); `required_client_api` stays `"messages"`; echo the selector in the adapter header. Do NOT generate `migrate_to_mantle.sh` (Step 1M) for it.
|
||||
- `migration_path` = `"runtime_messages"` (Anthropic source; Design's default for an Anthropic SDK app) → Generate provider adapter (Step 1) whose Bedrock provider class keeps the Anthropic SDK at the runtime base URL `https://bedrock-runtime.{region}.amazonaws.com/anthropic` with a string Bedrock token (`provide_token(region=...)` minted per client) and the row's `global.`/Geo Claude profile ID + setup (Step 3, `bedrock:InvokeModel*` and `bedrock:GetInferenceProfile` IAM) + test harness (Step 2). `required_client_api` is `"messages"`; do NOT generate a Mantle script and do NOT rewrite to Converse. Echo the row's `endpoint_assumption` sentence in the generated adapter's header comment.
|
||||
- `migration_path` = `"mantle_messages"` (Anthropic source, only with `bedrock_models[].mantle_selector`, normally `workspaces`; matched by this entry ONLY, never by the OpenAI-SDK Mantle branch above) → Generate provider adapter (Step 1) with the same Anthropic-SDK adapter shape as `runtime_messages` but at the Mantle base URL `https://bedrock-mantle.{region}.api.aws/anthropic` with the bare `anthropic.claude-*` ID and `bedrock-mantle:*` IAM (Step 3); `required_client_api` stays `"messages"`; echo that selector and its `mantle_requirement` (workload, source, evidence) in the adapter header. Do NOT generate `migrate_to_mantle.sh` (Step 1M) for it.
|
||||
- `"converse"`, `"direct"`, or absent → Generate provider adapter (Step 1) + setup (Step 3) + test harness (Step 2). `"converse"` is an explicit boto3 Converse rewrite (Design records it on request or for a Converse-only feature); do NOT generate a Mantle script for it.
|
||||
- `"llm_router"`, `"api_gateway"`, `"voice_platform"`, or `"framework"` → Skip Step 1, generate gateway config (Step 3B) instead. Step 3B's OpenRouter subroute can still replace that gateway config with Step 1M (`same_model_runtime` → the CRIS variant, `same_model_mantle` → the Mantle variant) or the provider adapter (`direct`); do not decide those from `migration_path` alone.
|
||||
|
||||
|
||||
+16
@@ -95,6 +95,19 @@ same vocabulary as the shared contract (`references/vendored/ai/schema-design-aw
|
||||
endpoint; each such row MUST carry `mantle_selector`, one of `background_inference |
|
||||
server_side_tools | web_search | projects | workspaces | mantle_only_model_or_api |
|
||||
in_region_processing`. API continuity alone is not a selector.
|
||||
- `bedrock_models[].mantle_requirement` — object, REQUIRED on every `mantle_*` row, absent
|
||||
otherwise: `{ workload_id, selector, source, evidence?, region? }` — `selector` equals the row's
|
||||
`mantle_selector`; `source` ∈ `detected | user | catalog` (`detected`/`user` entries are copied
|
||||
from `preferences.json → ai_constraints.mantle_requirements.value[]`, the Clarify Q22b / Q10.5
|
||||
answer `design-ai.md` Step 0.8 reads; `catalog` only for `mantle_only_model_or_api`, derived by
|
||||
Design from the model catalog); `evidence` present when `source` is `detected` or `catalog`;
|
||||
`region` present iff `selector` is `in_region_processing`.
|
||||
- `bedrock_models[].endpoint_assumption` — string, REQUIRED on every row whose `migration_path`
|
||||
does NOT start with `mantle_`, exactly: `No Mantle-only requirement was recorded for
|
||||
<workload_id>; bedrock-runtime selected. If this workload needs background inference,
|
||||
server-side tools, Projects/Workspaces, or single-Region processing, re-run Clarify.` where
|
||||
`<workload_id>` is the `design_blocks[].workload_id` whose `model_id` equals the row's
|
||||
`source_model_id` (several → comma-joined).
|
||||
- `converse`, `gpt-oss`, `direct` — Bedrock-native paths; never paired with a **bare**
|
||||
proprietary `openai.gpt-*` id.
|
||||
- `code_migration.openrouter_path` (router detected) — `same_model_runtime` (default same-model
|
||||
@@ -106,6 +119,9 @@ same vocabulary as the shared contract (`references/vendored/ai/schema-design-aw
|
||||
- [ ] `metadata.ai_source` matches `summary.ai_source` from `ai-workload-profile.json`.
|
||||
- [ ] Every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a
|
||||
`mantle_selector`; a same-model proprietary GPT row records `runtime_openai_cris` by default.
|
||||
- [ ] Every `mantle_*` row carries `mantle_requirement` with `selector == mantle_selector`
|
||||
(derived from `ai_constraints.mantle_requirements` or the catalog); every non-`mantle_*`
|
||||
row carries the `endpoint_assumption` sentence naming its workload.
|
||||
- [ ] Every `design_blocks[]` row has exactly one of `target_bedrock_model` /
|
||||
`target_aws_service` non-null (XOR).
|
||||
- [ ] Every traditional-AI row (`document_extraction`/`image_analysis`/`speech_transcription`)
|
||||
|
||||
+68
-3
@@ -178,9 +178,12 @@ Traditional-AI capabilities (AWS AI service, not Bedrock): `document_extraction`
|
||||
`migration_path` (see below), `quota_risk` (`low|medium|high`), `required_client_api`
|
||||
(`responses | chat_completions | converse | invoke | messages` — the client API surface the
|
||||
generated code must use; for `runtime_openai_cris` it is the API the source app already
|
||||
calls, never an implicit Converse), and `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below). Traditional-AI capabilities do NOT appear here — they are
|
||||
`design_blocks[]` rows with `target_aws_service`.
|
||||
calls, never an implicit Converse), `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below), `mantle_requirement` (object, REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — the Clarify entry or catalog row the selector was derived from; see below)
|
||||
and `endpoint_assumption` (string, REQUIRED on every row whose `migration_path` does NOT start
|
||||
with `mantle_` — the verbatim bedrock-runtime disclosure; see below). Traditional-AI
|
||||
capabilities do NOT appear here — they are `design_blocks[]` rows with `target_aws_service`.
|
||||
- **`capability_mapping`** — per capability that is `true` in the profile's
|
||||
`integration.capabilities_summary`: `{ parity: "full|partial|none", notes }`.
|
||||
- **`code_migration`** — `primary_pattern` (matches profile `integration.pattern`),
|
||||
@@ -226,6 +229,61 @@ leaving the `bedrock-runtime` default (definitions in `vendored/ai/bedrock-endpo
|
||||
API continuity (the app already calls Responses, Chat Completions or Messages) is not a selector.
|
||||
Absent on `runtime_*`, `converse`, `gpt-oss` and `direct` rows.
|
||||
|
||||
## mantle_requirement and endpoint_assumption (how mantle_selector is derived)
|
||||
|
||||
Design never infers a `mantle_selector` from the source API, the model, or a guess. It reads
|
||||
`preferences.json → ai_constraints.mantle_requirements.value[]` (written by Clarify — full flow
|
||||
Q22b, AI-only Q10.5; absent on older runs = no requirement recorded) and applies this rule per
|
||||
workload:
|
||||
|
||||
- A workload (matched by its own `workload_id`, or by an entry whose `workload_id` is `*`) with an
|
||||
entry whose `selector` is one of `background_inference | server_side_tools | web_search |
|
||||
projects | workspaces | in_region_processing` and whose `source` is `detected` or `user` takes
|
||||
the Mantle path for its source API — `mantle_openai_responses` for a Responses source,
|
||||
`mantle_openai_chat` for a Chat Completions source, `mantle_messages` for an Anthropic SDK
|
||||
source — with `mantle_selector` = that selector. Several matching entries → the first in the
|
||||
policy-table order `background_inference, server_side_tools, web_search, projects, workspaces,
|
||||
in_region_processing` becomes `mantle_selector`; name the others in the row's `rationale`.
|
||||
`in_region_processing` applies only when `bedrock-runtime` serves the model in the entry's
|
||||
`region` through a CRIS profile alone (the CRIS-only gate in `ai-openai-to-bedrock.md`);
|
||||
otherwise the workload stays on `bedrock-runtime` in that Region.
|
||||
- `mantle_only_model_or_api` is never a Clarify value: Design derives it from the catalog
|
||||
(`ai-openai-to-bedrock.md` / `openai-on-bedrock.md` access-path tables) when the selected model
|
||||
or API exists only on `bedrock-mantle`, and records `mantle_requirement.source: "catalog"`.
|
||||
- Every other workload keeps the `bedrock-runtime` default and its row records
|
||||
`endpoint_assumption` verbatim (below). A `none` entry, a default entry, or no entry at all is a
|
||||
runtime lane by design, not an inference.
|
||||
|
||||
**`bedrock_models[].mantle_requirement`** — object, REQUIRED on every row whose `migration_path`
|
||||
starts with `mantle_`, absent otherwise:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"workload_id": "wl_3a1f2c", // the workloads[].workload_id the entry applied to, or "*"
|
||||
"selector": "web_search", // same value as the row's mantle_selector
|
||||
"source": "detected", // detected | user | catalog
|
||||
"evidence": "src/ai/openai_client.py:14 tools=[{\"type\": \"web_search\"}]", // present when source is detected (file:line construct) or catalog (the catalog file/row)
|
||||
"region": "us-east-1" // present iff selector is in_region_processing
|
||||
}
|
||||
```
|
||||
|
||||
`source: detected | user` entries are copied from the matching
|
||||
`ai_constraints.mantle_requirements.value[]` entry (same `workload_id`, `selector`, `evidence`,
|
||||
`region`); `source: "catalog"` is written only by Design for `mantle_only_model_or_api`.
|
||||
|
||||
**`bedrock_models[].endpoint_assumption`** — string, REQUIRED on every row whose
|
||||
`migration_path` does NOT start with `mantle_` (`runtime_openai_cris`, `runtime_messages`,
|
||||
`converse`, `gpt-oss`, `direct`), exactly:
|
||||
|
||||
> No Mantle-only requirement was recorded for `<workload_id>`; bedrock-runtime selected. If this
|
||||
> workload needs background inference, server-side tools, Projects/Workspaces, or single-Region
|
||||
> processing, re-run Clarify.
|
||||
|
||||
where `<workload_id>` is the `design_blocks[].workload_id` whose `model_id` equals the row's
|
||||
`source_model_id` (several workloads → comma-joined ids). Generate echoes the sentence in the
|
||||
generated script/adapter header and the llm-to-bedrock report quotes it, so the user sees that
|
||||
the runtime choice rests on a recorded answer, not on a silent default.
|
||||
|
||||
## regional_validation
|
||||
|
||||
`checked` (`aws___get_regional_availability` on the AWS MCP Server confirmed model/region
|
||||
@@ -294,6 +352,13 @@ rubric file (`ai.md`, a provider-to-Bedrock mapping guide, or a `vendored/ai/*`
|
||||
and records `migration_path: "runtime_openai_cris"` by default.
|
||||
- [ ] Every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a
|
||||
`mantle_selector` from the enum above; no `runtime_*`/`converse` row carries one.
|
||||
- [ ] Every `mantle_*` row carries a `mantle_requirement` whose `selector` equals the row's
|
||||
`mantle_selector`, whose `source` is `detected | user | catalog` (`catalog` iff the selector
|
||||
is `mantle_only_model_or_api`), and whose `region` is present iff the selector is
|
||||
`in_region_processing`; the selector was derived from an
|
||||
`ai_constraints.mantle_requirements` entry (or the catalog), never from the source API.
|
||||
- [ ] Every non-`mantle_*` row carries the `endpoint_assumption` sentence verbatim, naming the
|
||||
`design_blocks[].workload_id`(s) whose `model_id` equals the row's `source_model_id`.
|
||||
- [ ] `regional_warnings` and `multi_model_warnings` are present (`[]` when clean).
|
||||
- [ ] If `agentic_profile.is_agentic == true`: `agentic_design` is present with
|
||||
`migration_approach` matching `preferences.json`; a `harness` source whose origin resolves
|
||||
|
||||
@@ -509,6 +509,15 @@ continuity alone never selects Mantle — keeping the OpenAI or Anthropic SDK is
|
||||
lane. See `skills/shared/ai/bedrock-endpoint-policy.md` (vendored at
|
||||
`$ASSESS_BASE/references/vendored/ai/bedrock-endpoint-policy.md`) for the public sources.
|
||||
|
||||
**How this skill learns a Mantle requirement.** Phase A's delegated Discover records
|
||||
code-visible selectors as `mantle_signals`; Clarify's Mantle-only requirements block (full flow
|
||||
Q22b, AI-only Q10.5) confirms them or asks outright and writes
|
||||
`preferences.json → ai_constraints.mantle_requirements`; Design derives
|
||||
`bedrock_models[].mantle_selector` only from that field (plus the catalog for
|
||||
`mantle_only_model_or_api`) and records `mantle_requirement` on Mantle rows and the
|
||||
`endpoint_assumption` sentence on every runtime row. A row with no recorded requirement is a
|
||||
runtime lane by design, not an inference.
|
||||
|
||||
---
|
||||
|
||||
## Phase A — Assess (runs $ASSESS_SKILL's own AI-path files, inline)
|
||||
@@ -710,7 +719,9 @@ work to the telemetry hooks.
|
||||
Read `$MIGRATION_DIR/aws-design-ai.json` and extract:
|
||||
|
||||
- `ai_architecture.bedrock_models[]` → array of `{source_model, aws_model_id, use_case,
|
||||
migration_path, required_client_api, mantle_selector}` (the last three may be absent on older plans)
|
||||
migration_path, required_client_api, mantle_selector, mantle_requirement, endpoint_assumption}`
|
||||
(the last five may be absent on older plans; `mantle_requirement` sits on Mantle rows,
|
||||
`endpoint_assumption` on runtime rows — keep both for the C6 `Endpoint basis:` line)
|
||||
- Collect all `aws_model_id` values into `$TARGET_MODELS` (array). Keep the `use_case` AND the
|
||||
`required_client_api` of each row: B4 passes every row to preflight as its own
|
||||
`<aws_model_id>=<required_client_api>` pair, so a Claude Messages primary and a GPT Chat or Nova
|
||||
@@ -997,6 +1008,7 @@ Resolved target model id: <override for the primary chat model — omit if none>
|
||||
Scripts directory (pinned uv toolchain): <$SCRIPTS>
|
||||
Report date suffix: <saved suffix from run-context — C5/C6 dispatches only>
|
||||
Usage baseline path: <$BEDROCK_RUN_DIR/usage-baseline.json — C5/C6 dispatches only, omit line if the file is absent>
|
||||
Endpoint basis: <per target, semicolon-separated: "<aws_model_id>: bedrock-mantle (<mantle_selector>; <mantle_requirement.source>; <mantle_requirement.evidence>)" or the row's endpoint_assumption sentence verbatim — C6 dispatch only, omit line when every bedrock_models[] row lacks both fields (older plan)>
|
||||
Source baseline available: <true|false>
|
||||
Source provider env file: <path — omit if none>
|
||||
User-supplied log files: <comma-joined — omit if none>
|
||||
|
||||
@@ -178,9 +178,12 @@ Traditional-AI capabilities (AWS AI service, not Bedrock): `document_extraction`
|
||||
`migration_path` (see below), `quota_risk` (`low|medium|high`), `required_client_api`
|
||||
(`responses | chat_completions | converse | invoke | messages` — the client API surface the
|
||||
generated code must use; for `runtime_openai_cris` it is the API the source app already
|
||||
calls, never an implicit Converse), and `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below). Traditional-AI capabilities do NOT appear here — they are
|
||||
`design_blocks[]` rows with `target_aws_service`.
|
||||
calls, never an implicit Converse), `mantle_selector` (REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — see below), `mantle_requirement` (object, REQUIRED on every `mantle_*` row,
|
||||
absent otherwise — the Clarify entry or catalog row the selector was derived from; see below)
|
||||
and `endpoint_assumption` (string, REQUIRED on every row whose `migration_path` does NOT start
|
||||
with `mantle_` — the verbatim bedrock-runtime disclosure; see below). Traditional-AI
|
||||
capabilities do NOT appear here — they are `design_blocks[]` rows with `target_aws_service`.
|
||||
- **`capability_mapping`** — per capability that is `true` in the profile's
|
||||
`integration.capabilities_summary`: `{ parity: "full|partial|none", notes }`.
|
||||
- **`code_migration`** — `primary_pattern` (matches profile `integration.pattern`),
|
||||
@@ -226,6 +229,61 @@ leaving the `bedrock-runtime` default (definitions in `vendored/ai/bedrock-endpo
|
||||
API continuity (the app already calls Responses, Chat Completions or Messages) is not a selector.
|
||||
Absent on `runtime_*`, `converse`, `gpt-oss` and `direct` rows.
|
||||
|
||||
## mantle_requirement and endpoint_assumption (how mantle_selector is derived)
|
||||
|
||||
Design never infers a `mantle_selector` from the source API, the model, or a guess. It reads
|
||||
`preferences.json → ai_constraints.mantle_requirements.value[]` (written by Clarify — full flow
|
||||
Q22b, AI-only Q10.5; absent on older runs = no requirement recorded) and applies this rule per
|
||||
workload:
|
||||
|
||||
- A workload (matched by its own `workload_id`, or by an entry whose `workload_id` is `*`) with an
|
||||
entry whose `selector` is one of `background_inference | server_side_tools | web_search |
|
||||
projects | workspaces | in_region_processing` and whose `source` is `detected` or `user` takes
|
||||
the Mantle path for its source API — `mantle_openai_responses` for a Responses source,
|
||||
`mantle_openai_chat` for a Chat Completions source, `mantle_messages` for an Anthropic SDK
|
||||
source — with `mantle_selector` = that selector. Several matching entries → the first in the
|
||||
policy-table order `background_inference, server_side_tools, web_search, projects, workspaces,
|
||||
in_region_processing` becomes `mantle_selector`; name the others in the row's `rationale`.
|
||||
`in_region_processing` applies only when `bedrock-runtime` serves the model in the entry's
|
||||
`region` through a CRIS profile alone (the CRIS-only gate in `ai-openai-to-bedrock.md`);
|
||||
otherwise the workload stays on `bedrock-runtime` in that Region.
|
||||
- `mantle_only_model_or_api` is never a Clarify value: Design derives it from the catalog
|
||||
(`ai-openai-to-bedrock.md` / `openai-on-bedrock.md` access-path tables) when the selected model
|
||||
or API exists only on `bedrock-mantle`, and records `mantle_requirement.source: "catalog"`.
|
||||
- Every other workload keeps the `bedrock-runtime` default and its row records
|
||||
`endpoint_assumption` verbatim (below). A `none` entry, a default entry, or no entry at all is a
|
||||
runtime lane by design, not an inference.
|
||||
|
||||
**`bedrock_models[].mantle_requirement`** — object, REQUIRED on every row whose `migration_path`
|
||||
starts with `mantle_`, absent otherwise:
|
||||
|
||||
```jsonc
|
||||
{
|
||||
"workload_id": "wl_3a1f2c", // the workloads[].workload_id the entry applied to, or "*"
|
||||
"selector": "web_search", // same value as the row's mantle_selector
|
||||
"source": "detected", // detected | user | catalog
|
||||
"evidence": "src/ai/openai_client.py:14 tools=[{\"type\": \"web_search\"}]", // present when source is detected (file:line construct) or catalog (the catalog file/row)
|
||||
"region": "us-east-1" // present iff selector is in_region_processing
|
||||
}
|
||||
```
|
||||
|
||||
`source: detected | user` entries are copied from the matching
|
||||
`ai_constraints.mantle_requirements.value[]` entry (same `workload_id`, `selector`, `evidence`,
|
||||
`region`); `source: "catalog"` is written only by Design for `mantle_only_model_or_api`.
|
||||
|
||||
**`bedrock_models[].endpoint_assumption`** — string, REQUIRED on every row whose
|
||||
`migration_path` does NOT start with `mantle_` (`runtime_openai_cris`, `runtime_messages`,
|
||||
`converse`, `gpt-oss`, `direct`), exactly:
|
||||
|
||||
> No Mantle-only requirement was recorded for `<workload_id>`; bedrock-runtime selected. If this
|
||||
> workload needs background inference, server-side tools, Projects/Workspaces, or single-Region
|
||||
> processing, re-run Clarify.
|
||||
|
||||
where `<workload_id>` is the `design_blocks[].workload_id` whose `model_id` equals the row's
|
||||
`source_model_id` (several workloads → comma-joined ids). Generate echoes the sentence in the
|
||||
generated script/adapter header and the llm-to-bedrock report quotes it, so the user sees that
|
||||
the runtime choice rests on a recorded answer, not on a silent default.
|
||||
|
||||
## regional_validation
|
||||
|
||||
`checked` (`aws___get_regional_availability` on the AWS MCP Server confirmed model/region
|
||||
@@ -294,6 +352,13 @@ rubric file (`ai.md`, a provider-to-Bedrock mapping guide, or a `vendored/ai/*`
|
||||
and records `migration_path: "runtime_openai_cris"` by default.
|
||||
- [ ] Every `bedrock_models[]` row whose `migration_path` starts with `mantle_` carries a
|
||||
`mantle_selector` from the enum above; no `runtime_*`/`converse` row carries one.
|
||||
- [ ] Every `mantle_*` row carries a `mantle_requirement` whose `selector` equals the row's
|
||||
`mantle_selector`, whose `source` is `detected | user | catalog` (`catalog` iff the selector
|
||||
is `mantle_only_model_or_api`), and whose `region` is present iff the selector is
|
||||
`in_region_processing`; the selector was derived from an
|
||||
`ai_constraints.mantle_requirements` entry (or the catalog), never from the source API.
|
||||
- [ ] Every non-`mantle_*` row carries the `endpoint_assumption` sentence verbatim, naming the
|
||||
`design_blocks[].workload_id`(s) whose `model_id` equals the row's `source_model_id`.
|
||||
- [ ] `regional_warnings` and `multi_model_warnings` are present (`[]` when clean).
|
||||
- [ ] If `agentic_profile.is_agentic == true`: `agentic_design` is present with
|
||||
`migration_approach` matching `preferences.json`; a `harness` source whose origin resolves
|
||||
|
||||
@@ -0,0 +1,213 @@
|
||||
"""Guard: Design derives mantle_selector from Clarify's answer and discloses the runtime assumption.
|
||||
|
||||
PR #585 made `bedrock-runtime` the default endpoint and defined the `mantle_selector` enum, but
|
||||
nothing told Design where a selector comes from: a plugin reading Terraform or no source code at
|
||||
all cannot see whether an app needs background inference (`bedrock-runtime` rejects
|
||||
`background=true` with a 400 — https://docs.aws.amazon.com/bedrock/latest/userguide/inference-responses-api.html,
|
||||
read 2026-11-07), provider-run tools, Projects/Workspaces or single-Region processing. Discover
|
||||
now records code-visible signals, Clarify confirms them or asks (Q22b / Q10.5) and writes
|
||||
`preferences.json → ai_constraints.mantle_requirements`, and Design derives every
|
||||
`bedrock_models[].mantle_selector` from that field alone (plus the catalog for
|
||||
`mantle_only_model_or_api`), citing the entry in `mantle_requirement` and writing the verbatim
|
||||
`endpoint_assumption` sentence on every runtime row. These checks pin the Design/Generate/report
|
||||
text, the three schema docs and their vendored copies, and the neutral design fixtures.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
PLUGIN_ROOT = Path(__file__).resolve().parent.parent
|
||||
SKILLS = PLUGIN_ROOT / "skills"
|
||||
|
||||
DESIGN_AI_FILES = {
|
||||
"gcp": SKILLS / "gcp-to-aws" / "references" / "phases" / "design" / "design-ai.md",
|
||||
"azure": SKILLS / "azure-to-aws" / "references" / "phases" / "design" / "design-ai.md",
|
||||
}
|
||||
SCHEMA_DOCS = {
|
||||
"shared": SKILLS / "shared" / "ai" / "schema-design-aws-ai.md",
|
||||
"gcp-shadow": SKILLS / "gcp-to-aws" / "references" / "shared" / "schema-design-aws-ai.md",
|
||||
"azure-shadow": SKILLS / "azure-to-aws" / "references" / "shared" / "schema-design-aws-ai.md",
|
||||
"gcp-vendored": SKILLS / "gcp-to-aws" / "references" / "vendored" / "ai" / "schema-design-aws-ai.md",
|
||||
"azure-vendored": SKILLS / "azure-to-aws" / "references" / "vendored" / "ai" / "schema-design-aws-ai.md",
|
||||
}
|
||||
GENERATE_FILES = {
|
||||
"gcp-artifacts": SKILLS / "gcp-to-aws" / "references" / "phases" / "generate" / "generate-artifacts-ai.md",
|
||||
"azure-artifacts": SKILLS / "azure-to-aws" / "references" / "phases" / "generate" / "generate-artifacts-ai.md",
|
||||
"gcp-guide": SKILLS / "gcp-to-aws" / "references" / "phases" / "generate" / "generate-ai.md",
|
||||
}
|
||||
LLM_TO_BEDROCK_SKILL = SKILLS / "llm-to-bedrock" / "SKILL.md"
|
||||
REPORT_GENERATOR = PLUGIN_ROOT / "agents" / "llm2bedrock-report-generator.md"
|
||||
DESIGN_FIXTURES = sorted((PLUGIN_ROOT / "fixtures" / "aws-design-ai").glob("*/aws-design-ai.json"))
|
||||
|
||||
SELECTOR_ENUM = [
|
||||
"background_inference",
|
||||
"server_side_tools",
|
||||
"web_search",
|
||||
"projects",
|
||||
"workspaces",
|
||||
"mantle_only_model_or_api",
|
||||
"in_region_processing",
|
||||
]
|
||||
ASSUMPTION_PREFIX = "No Mantle-only requirement was recorded for "
|
||||
ASSUMPTION_SUFFIX = "re-run Clarify."
|
||||
REQUIREMENT_SOURCES = {"detected", "user", "catalog"}
|
||||
|
||||
|
||||
def _read(path: Path) -> str:
|
||||
return path.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def _section(text: str, start: str, end: str) -> str:
|
||||
return text.split(start, 1)[1].split(end, 1)[0]
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (a) design-ai.md
|
||||
|
||||
|
||||
@pytest.mark.parametrize("skill", sorted(DESIGN_AI_FILES))
|
||||
def test_design_ai_derives_the_selector_from_clarify_and_discloses_the_runtime_assumption(skill: str) -> None:
|
||||
text = _read(DESIGN_AI_FILES[skill])
|
||||
assert "Step 0.8" in text, f"{skill}: design-ai.md has no Step 0.8 endpoint-selection step"
|
||||
for token in (
|
||||
"ai_constraints.mantle_requirements",
|
||||
"mantle_requirement",
|
||||
"endpoint_assumption",
|
||||
ASSUMPTION_PREFIX.strip(),
|
||||
"re-run Clarify",
|
||||
):
|
||||
assert token in text, f"{skill}: design-ai.md lacks {token!r}"
|
||||
step08 = _section(text, "Step 0.8", "## Part 1")
|
||||
assert "mantle_only_model_or_api" in step08 and "catalog" in step08, (
|
||||
f"{skill}: Step 0.8 must say mantle_only_model_or_api is catalog-derived"
|
||||
)
|
||||
assert "in_region_processing" in step08 and "ai-openai-to-bedrock.md" in step08, (
|
||||
f"{skill}: Step 0.8 must keep in_region_processing on the CRIS-only gate"
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (b) schema docs
|
||||
|
||||
|
||||
@pytest.mark.parametrize("doc", sorted(SCHEMA_DOCS))
|
||||
def test_schema_docs_document_mantle_requirement_and_endpoint_assumption(doc: str) -> None:
|
||||
text = _read(SCHEMA_DOCS[doc])
|
||||
assert "mantle_requirement" in text, f"{doc}: schema doc lacks mantle_requirement"
|
||||
assert "endpoint_assumption" in text, f"{doc}: schema doc lacks endpoint_assumption"
|
||||
assert re.search(r"detected\s*\|\s*user\s*\|\s*catalog", text), (
|
||||
f"{doc}: schema doc lacks the mantle_requirement.source vocabulary detected | user | catalog"
|
||||
)
|
||||
for value in SELECTOR_ENUM:
|
||||
assert value in text, f"{doc}: mantle_selector enum value {value} missing"
|
||||
|
||||
|
||||
def test_vendored_schema_docs_are_byte_identical_to_the_canonical() -> None:
|
||||
canonical = SCHEMA_DOCS["shared"].read_bytes()
|
||||
for key in ("gcp-vendored", "azure-vendored"):
|
||||
assert SCHEMA_DOCS[key].read_bytes() == canonical, f"{key} drifted — run tools/sync-vendored.py"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (c) generate
|
||||
|
||||
|
||||
@pytest.mark.parametrize("doc", sorted(GENERATE_FILES))
|
||||
def test_generate_echoes_the_requirement_or_the_assumption(doc: str) -> None:
|
||||
text = _read(GENERATE_FILES[doc])
|
||||
assert "endpoint_assumption" in text, f"{doc}: generate file does not echo endpoint_assumption"
|
||||
assert "mantle_requirement" in text, f"{doc}: generate file does not echo mantle_requirement"
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (d) llm-to-bedrock
|
||||
|
||||
|
||||
def test_llm_to_bedrock_skill_explains_how_a_mantle_requirement_is_learned() -> None:
|
||||
text = _read(LLM_TO_BEDROCK_SKILL)
|
||||
policy = _section(text, "## Endpoint policy (bedrock-runtime default)", "## Phase A")
|
||||
for token in ("ai_constraints.mantle_requirements", "Q22b", "Q10.5", "mantle_signals", "mantle_requirement", "endpoint_assumption"):
|
||||
assert token in policy, f"llm-to-bedrock Endpoint policy lacks {token!r}"
|
||||
context = _section(text, "### The context block", "### C0 — Run-context gate")
|
||||
assert "Endpoint basis:" in context, "context block has no 'Endpoint basis:' line"
|
||||
assert "C6" in context.split("Endpoint basis:")[1][:400], "Endpoint basis line must scope itself to the C6 dispatch"
|
||||
b1 = _section(text, "### B1 — Read Assess outputs", "### B2")
|
||||
assert "mantle_requirement" in b1 and "endpoint_assumption" in b1, "B1 must extract both fields from bedrock_models[]"
|
||||
|
||||
|
||||
def test_report_generator_renders_the_endpoint_and_reads_the_endpoint_basis_line() -> None:
|
||||
text = _read(REPORT_GENERATOR)
|
||||
assert "**Endpoint:**" in text, "report Executive Summary has no Endpoint line"
|
||||
assert "Endpoint basis:" in text, "report generator does not read the Endpoint basis: context line"
|
||||
assert "endpoint_assumption" in text and "mantle_requirement" in text
|
||||
limitations = _section(text, "## Limitations", "### Evaluation methodology disclosure")
|
||||
assert "inference-responses-api.html" in limitations and re.search(r"read 20\d\d-\d\d-\d\d", limitations), (
|
||||
"Limitations must cite the public Responses API page with a read date"
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (e) fixtures
|
||||
|
||||
|
||||
def _workloads_for(design: dict, source_model_id: str) -> set[str]:
|
||||
return {b["workload_id"] for b in design["design_blocks"] if b["model_id"] == source_model_id}
|
||||
|
||||
|
||||
@pytest.mark.parametrize("fixture", DESIGN_FIXTURES, ids=lambda p: p.parent.name)
|
||||
def test_fixture_rows_carry_a_requirement_or_the_assumption(fixture: Path) -> None:
|
||||
design = json.loads(_read(fixture))
|
||||
workload_ids = {b["workload_id"] for b in design["design_blocks"]}
|
||||
rows = design["ai_architecture"]["bedrock_models"]
|
||||
assert rows, f"{fixture}: no bedrock_models rows"
|
||||
for row in rows:
|
||||
label = f"{fixture.parent.name}:{row['aws_model_id']}"
|
||||
if row["migration_path"].startswith("mantle_"):
|
||||
assert "endpoint_assumption" not in row, f"{label}: mantle row must not carry endpoint_assumption"
|
||||
req = row.get("mantle_requirement")
|
||||
assert isinstance(req, dict), f"{label}: mantle row lacks mantle_requirement"
|
||||
assert set(req) <= {"workload_id", "selector", "source", "evidence", "region"}, f"{label}: unknown key in mantle_requirement"
|
||||
assert req["selector"] == row["mantle_selector"], f"{label}: mantle_requirement.selector != mantle_selector"
|
||||
assert req["source"] in REQUIREMENT_SOURCES, f"{label}: bad mantle_requirement.source"
|
||||
assert req["workload_id"] in workload_ids | {"*"}, f"{label}: mantle_requirement.workload_id is not a design_blocks id"
|
||||
if req["source"] in {"detected", "catalog"}:
|
||||
assert req.get("evidence"), f"{label}: {req['source']} requirement needs evidence"
|
||||
assert ("region" in req) == (req["selector"] == "in_region_processing"), (
|
||||
f"{label}: region must be present iff selector is in_region_processing"
|
||||
)
|
||||
assert (req["source"] == "catalog") == (req["selector"] == "mantle_only_model_or_api"), (
|
||||
f"{label}: source catalog iff selector mantle_only_model_or_api"
|
||||
)
|
||||
else:
|
||||
assert "mantle_requirement" not in row, f"{label}: runtime row must not carry mantle_requirement"
|
||||
sentence = row.get("endpoint_assumption")
|
||||
assert isinstance(sentence, str), f"{label}: runtime row lacks endpoint_assumption"
|
||||
assert sentence.startswith(ASSUMPTION_PREFIX), f"{label}: endpoint_assumption has the wrong prefix"
|
||||
assert sentence.endswith(ASSUMPTION_SUFFIX), f"{label}: endpoint_assumption has the wrong suffix"
|
||||
named = sentence[len(ASSUMPTION_PREFIX):].split(";", 1)[0]
|
||||
named_ids = {w.strip() for w in named.split(",")}
|
||||
expected = _workloads_for(design, row["source_model_id"])
|
||||
assert named_ids and named_ids <= expected, (
|
||||
f"{label}: endpoint_assumption names {named_ids}, not a workload whose model_id is {row['source_model_id']!r}"
|
||||
)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------- (f) corpus coverage
|
||||
|
||||
|
||||
def test_fixture_corpus_covers_a_detected_web_search_row_and_a_runtime_only_design() -> None:
|
||||
detected_web_search = False
|
||||
runtime_only = False
|
||||
for fixture in DESIGN_FIXTURES:
|
||||
rows = json.loads(_read(fixture))["ai_architecture"]["bedrock_models"]
|
||||
for row in rows:
|
||||
req = row.get("mantle_requirement") or {}
|
||||
if (
|
||||
row["migration_path"] == "mantle_openai_responses"
|
||||
and row.get("mantle_selector") == "web_search"
|
||||
and req.get("source") == "detected"
|
||||
):
|
||||
detected_web_search = True
|
||||
if rows and not any(r["migration_path"].startswith("mantle_") for r in rows):
|
||||
runtime_only = True
|
||||
assert detected_web_search, "no fixture row is mantle_openai_responses + web_search + source detected"
|
||||
assert runtime_only, "no fixture has only runtime rows (runtime-default-no-requirement)"
|
||||
Reference in New Issue
Block a user