Generated banner for Agent Advisor
Generated logo for Agent Advisor

Agent Advisor

AWSOfficialPublished by AWS

  • Skill
  • Workflow
  • Cloud and DevOps
  • Apache-2.0
  • Low risk
  • Has scripts

From the author

Entry point for AI-agent work on AWS: pick a runtime, plan a migration for existing workloads, and build an executable POC — one phased flow. Triggers on: which runtime for my agent, AgentCore vs ECS vs EKS vs Lambda, AgentCore vs Lambda MicroVMs, deploy an AI agent on AWS, agent architecture on AWS, I have an agent idea what do I build, move/migrate my agents to AWS, agent migration plan, add AgentCore services (memory, gateway, identity, policy, observability) to an agent already on AWS, Temporal on AWS (migrate/run Temporal workers on AWS, a service orchestrated by Temporal, Temporal Cloud vs self-hosted). Temporal Workflow code is never rewritten into Step Functions. Requires at least one agentic component — a purely non-agent system (plain services, batch jobs, HTTP endpoints, non-agent Temporal Activities) is out of scope, redirected to gcp-to-aws / heroku-to-aws / llm-to-bedrock. Not for: compute/data migration with no AI agent; pure LLM SDK rewrite (use llm-to-bedrock); per-model pricing.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

Agent Advisor provides a structured, multi-phase workflow to help users determine the optimal AWS runtime for their AI agents. It uses a deterministic scoring engine to evaluate requirements and guides users through a process that includes discovery, architectural design, cost estimation, and the creation of an executable proof-of-concept. The skill supports various AWS compute options, including AgentCore, ECS, EKS, and Lambda, and integrates with migration engines for existing workloads.

What it does

  • Recommends AWS runtimes for AI agents based on technical requirements.
  • Generates migration plans for existing AI workloads moving to AWS.
  • Provides architectural guidance for agentic systems.
  • Assembles executable proof-of-concept scaffolding.
  • Estimates coarse cost magnitudes for proposed agent deployments.
  • Integrates with external migration engines for workload transitions.

When to use it

  • When you need to decide which AWS runtime is best for a new AI agent.
  • When migrating an existing AI agent workload to AWS.
  • When you need to add services like memory, identity, or observability to an existing AWS agent.
  • When you require a structured plan and POC for deploying agents on AWS.

Advantages

  • Provides a deterministic, repeatable recommendation process.
  • Supports a wide range of AWS compute environments.
  • Offers a unified flow from initial idea to executable POC.
  • Adapts to both technical and business-focused user backgrounds.

Usage examples

“I have an agent idea, what do I build?”
The agent initiates the intake process to clarify your requirements and recommend an appropriate AWS architecture.
“Move my agents to AWS.”
The agent triggers the migration workflow to assess your existing workload and plan the transition to an AWS runtime.
“Which runtime for my agent, AgentCore vs ECS vs EKS vs Lambda?”
The agent runs a scoring analysis to compare these runtimes against your specific agentic needs.
“Add AgentCore services to an agent already on AWS.”
The agent enters the add-capabilities branch to guide you through integrating memory, gateway, and observability services.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/agent-advisor/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip agent-advisor.zip -d .agents/skills

Documentation by AWS

AWS Agent Advisor

Helps startups decide how and where to run AI agents on AWS. Deterministic scoring recommends a runtime; the conversation adapts to the user's technical background.

Definitions

  • "Load" = Read the file with the Read tool and follow it. Do not summarize or skip.

  • $RUN_DIR = the run directory under .agent-advisor/ (e.g. .agent-advisor/0630-1430/), created in Intake.

  • $PLUGIN = ${CLAUDE_PLUGIN_ROOT} (the installed plugin root). On Claude Code this token substitutes inline. If ${CLAUDE_PLUGIN_ROOT} does not resolve (some Cursor/Codex builds, or a literal ${CLAUDE_PLUGIN_ROOT} string showing up in a path error), fall back to the skill's own directory: this SKILL.md lives at <plugin>/skills/agent-advisor/SKILL.md, so the engine and its data are all inside this skill — scripts at ./scripts/..., runtime profiles at ./references/runtimes/..., and decision refs at ./references/decision-refs/... relative to it. Prefer ${CLAUDE_PLUGIN_ROOT}/skills/agent-advisor/...; use the relative fallback only when it fails to resolve.

Prerequisites

Phase Structure (frontmatter)

Phase, fragment, and assembler files carry a YAML frontmatter block that declares how each phase is composed — its inputs, triggers, fragments, assembler, artifacts, gates, and ordering. The execution contract is the vendored references/vendored/dsl/INTERPRETER.md: it defines every frontmatter key, the fragment/assembler model, the gate protocol (HANDOFF_OK / GATE_FAIL), and the interpreter loop. Load it first (once, at the start of a run), then execute each phase file's prose body. Elsewhere in this skill, INTERPRETER.md (without a path) refers to this loaded contract.

Execution

This skill is driven by the interpreter loop in INTERPRETER.md (§ The interpreter loop): it reads .phase-status.json, determines the current phase, runs each phase's _preconditions / fragments / _assemble / _postconditions, advances on HANDOFF_OK via _advances_to, and validates state. The backbone (intake → discover → clarify → confirm → design → estimate → generate → migration-plan → poc → complete) and the one sidebar branch (add-capabilities) are derived from the phase files' frontmatter — they are not restated here.

Cold start (entry phase). With no run under .agent-advisor/ carrying a .phase-status.json, begin at references/phases/intake/intake.md — this skill's entry phase (the one carrying _init: true). On a warm start, current_phase in .phase-status.json is authoritative (INTERPRETER.md § The interpreter loop).

Skill bindings (INTERPRETER.md § Skill bindings). This skill declares:

  • Run root: .agent-advisor/ — $RUN_DIR is this skill's name for the run directory (.agent-advisor/[MMDD-HHMM]/). Intake's own prose performs the _init bootstrap.

  • State shape: § State file below (advisor-specific keys such as entry_point, audience, recommendation_reviewed, migration_plan_ctx, migration_plan_unavailable); the shared state schema is not vendored.

  • Run seed (optional): $RUN_DIR/seed.json, else .agent-advisor/seed.json at the run root (schema scripts/schemas/seed.json) supplies machine-readable answers for a non-interactive run — the Clarify dimensions, the two gate answers, the POC mode, the live-probe answer, and a co_recommend tie-break. It is the HIGHEST-precedence source for every value it carries (clarify.md Step 2.5), which is what makes a repeated run's score comparable: the deterministic engine gets byte-identical input. A gate the seed omits is declined; a dimension the seed omits falls through to detection, then prose, then an assumed value that MUST be recorded in $RUN_DIR/UNANSWERED.md. With no seed, the interactive flow is unchanged.

  • Resolved statuses: skipped (routing resolved the phase without running it), plus not_applicable for migration_plan only.

  • Conditional backbone routing: the entry-point routing below. When a routing rule marks a phase not-applicable, set it skipped and advance through its _advances_to in the same state write.

Routing & gates (orchestration)

Sidebar placement and conditional backbone routing are orchestration prose owned by this file (INTERPRETER.md § Skill bindings, § Backbone vs sidebar).

Entry-point routing:

  • build_scratch → skip Discover; Clarify → Confirm → Design → Estimate → Generate → Gate 2 → POC (any winning runtime). No migration plan (nothing existing to migrate).

  • build_deploy → Discover (if code) → Clarify → Confirm → Design → Estimate → Generate → Gate 1 → Migration Plan (if existing non-AWS AI workload detected and user confirms) → Gate 2 → POC (any winning runtime).

  • migrate → Discover (if code) → Clarify → Confirm → Design → Estimate (target-state run cost; migration TCO comparison stays with the Migration Plan engine) → Generate → Gate 1 → Migration Plan (in-skill, reusing the sibling gcp-to-aws skill) → Gate 2 → POC (any winning runtime, when the plan was produced). Declining Gate 1 keeps the classic handoff: pointer to /aws-startup-advisor:llm-to-bedrock with handoff-summary.md.

  • add_capabilities → load references/phases/add-capabilities/add-capabilities.md and follow it (no runtime scoring; writes capabilities-recommendation.md). This is a self-contained branch — it does NOT pass through Clarify / Confirm / Design / Estimate / Generate, so the phase gate below never applies to it.

  • Temporal detection routes into migrate with temporal units pre-seeded (see discover).

Gate semantics (backbone tail):

  • Gate 1 → migration_plan runs only when generate is done AND recommendation_reviewed == true (generate.md Step 5.5) AND entry point ∈ {migrate, build_deploy} AND the run is migration-eligible (generate.md Step 6) AND the user confirmed Gate 1. Otherwise resolve it: not_applicable (build_scratch / no migratable workload) or skipped (declined) — and advance.

  • Gate 2 → poc runs only when phases.poc == "in_progress" (set when the user answers Gate 2 "yes" — asked in generate.md Step 7 or migration-plan.md Step 6) AND recommendation_reviewed == true. Any winning runtime (agentcore / ecs / eks / lambda / lambda_microvms) — the POC shape follows the verdict (poc.md Step 3 dispatch on references/decision-refs/poc-shapes.md). Gate 2 is only offered when migration_plan ∈ {completed, skipped, not_applicable} — or in_progress on build_deploy only (Stage 2 failed/aborted; fallback POC from design.json per migration-plan.md failure handling); for entry point migrate, only when migration_plan == "completed" (the POC implements the plan) OR when the stage resolved not_applicable with migration_plan_unavailable == "engine_absent" — a standalone deployment that does not bundle the migration engine, where Gate 2 is offered by migration-plan.md Step -1 and the POC is design-backed. A migrate-POC with no plan for any OTHER reason (the user declined) has nothing to implement.

  • Persisting Gate 2 as phases.poc = "in_progress" BEFORE poc.md loads makes the confirmation resumable: if the session breaks between the "yes" and the load, the interpreter re-enters poc without re-asking. (A declared deviation from INTERPRETER.md § The interpreter loop step 5's gate-then-in_progress ordering — the user's confirmation is the entry event worth persisting.)

Phase gate: Do NOT load design.md / estimate.md / generate.md unless $RUN_DIR/.phase-status.json exists and BOTH phases.clarify == "completed" AND phases.confirm == "completed". Confirm confirms the deployment model, the service set, and (for a co_recommend tie) the user's chosen_runtime — Design and the diagram depend on its confirm.json output, so it must not be skipped. If the user asks to skip Clarify or Pass 2, refuse briefly and run it.

State file (.phase-status.json)

{
  "run_id": "0630-1430",
  "entry_point": "build_scratch",
  "audience": "technical",
  "current_phase": "clarify",
  "phases": {
    "intake": "completed",
    "discover": "skipped",
    "clarify": "in_progress",
    "confirm": "pending",
    "design": "pending",
    "estimate": "pending",
    "generate": "pending",
    "migration_plan": "pending",
    "poc": "pending"
  }
}

Status values: pending → in_progress → completed, plus skipped. Use read-merge-write: read before each update, change only the advancing keys, keep prior phases.

recommendation_reviewed (top level, boolean) is set to true by generate.md Step 5.5 when the user explicitly confirms they have seen the recommendation. Gate 1, Gate 2, and the migration_plan / poc states all require it — no gate may be asked while it is absent.

migration_plan additionally uses not_applicable (build_scratch, or no migratable workload detected). When Stage 2 runs, migration_plan_ctx is added at the top level: {"repo": "<abs path to target repo>", "migration_dir": "<abs path to .migration/<id>/>"} — Stage 3 reads gcp-to-aws artifacts ONLY via this recorded path, never by re-globbing.

Files

FilePurpose
references/vendored/dsl/INTERPRETER.mdVendored DSL execution contract (interpreter loop + gate protocol)
references/phases/intake/intake.mdEntry point + technical background + open context
references/phases/discover/discover.mdLightweight code detection
references/phases/clarify/clarify.mdClarify orchestrator + answer mapping to scoring keys
references/phases/clarify/clarify-technical.mdTechnical-background question wording
references/phases/clarify/clarify-business.mdBusiness-background question wording
references/phases/confirm/confirm.mdWinner-specific follow-ups
references/phases/design/design.mdAssemble recommendation; Migrate handoff branch
references/phases/estimate/estimate.mdCoarse cost magnitude
references/phases/generate/generate.mdLayered recommendation doc + scaffolding
references/phases/migration-plan/migration-plan.mdStage 2: full migration plan via the sibling gcp-to-aws engine
references/decision-refs/temporal.mdTemporal rules: Tier 1/2 tables, adapter, runbooks, commercials (consumed by discover/clarify/design/generate)
references/decision-refs/poc-shapes.mdPer-runtime POC deploy shapes (ECS/EKS/Lambda/MicroVMs/Temporal)
references/decision-refs/*.mdRuntime service cards, model defaults, freshness
references/decision-refs/workload-classes.mdDeterministic verdicts for non-agent workload units (batch/service/io)
references/runtimes/*.jsonRuntime registry (read by scoring.py)
scripts/scoring.pyDeterministic scoring engine
scripts/test_temporal_decision_refs.pyContent lock for the Temporal decision reference
scripts/test_poc_shapes.pyContent lock for the POC deploy shapes
scripts/test_workload_classes.pyContent lock for workload-classes.md (verdicts table)
scripts/test_unit_grouping.pyUnit grouping + pattern matching (workload-class assignment)
scripts/test_collapse_invariant.pyCollapse-invariant ordering enforcement (A→B implies [B] ⊆ [A] outputs)

Maturity and readiness contract

Intake persists target_maturity (prototype, private_beta, or production) in run state. Clarify carries it and the readable readiness record into answers.json. Current-run verification evidence remains exclusively in the sibling $RUN_DIR/current-run-verifications.json artifact: never copy it into seed.json or answers.json. Design and Generate may consume that artifact only after validating its schema and matching run_id, and may carry forward verified outcomes but not the raw evidence records. Load references/decision-refs/maturity-readiness.md whenever target maturity is selected. A cached volatile fact may inform discovery, but only a record verified in this run can make a verification-required constraint final; otherwise the score remains provisional with deferred verification requirements.

Contextual offers (final step)

Before you finish: your answer is not complete until you have run the Contextual offers (final step) below.

This is a mandatory closing step of every final recommendation — complete it before you consider your answer done. Run this offer check inline yourself; do not depend on loading another skill. The recommendation is decided on merit first; this step never changes, re-ranks, or re-opens it, and the offer is looked up only after the advice is final.

  1. Read ../knowledge-base-for-startups/references/offers.md — the offer index (Offer · Summary · Keywords), one row per offer.

  2. Judge relevance against what the founder actually surfaced this session. Surface an offer only if one holds: a named-product match (you recommended a specific partner product by name and it has a row); a direct intent/component match (an offer's Keywords directly serve a concrete workload, a component in the final recommendation, or a need the founder raised). Keep a high bar — if the match is weak, or you would be inferring an unstated need, append nothing. Never surface an offer that competes with a product or provider the founder already uses or decided to keep (e.g. existing auth provider → no Auth0 unless they are already on Auth0, and then only as a credit on it; existing vector DB such as Pinecone → no Qdrant).

  3. If (and only if) one offer clears the bar, open only its detail file ../knowledge-base-for-startups/references/offers/<slug>.md and append exactly one quiet, dismissible italic line — stating the value and condensing eligibility faithfully from that file (drop no qualifying criterion; never fabricate), with the redeem link built from the canonical source_url plus a source attribution param — append ?source=ide-startupAdvisor-<host> (or &source=... if the url already has a query string), filling <host> from your execution environment (Claude Code → claude; AWS Startup Advisor IDE extension / VS Code → vscode; Cursor → cursor; Kiro → kiro; Codex → codex), or the generic ide-startupAdvisor when you cannot tell. Only append the query param; never change the destination. When an offer clears the bar you MUST append that single offer line as the last step; do not omit it. The offer is never the pick — only a line under the AWS pick — and stage gates in the references apply (e.g. no Datadog line for an early-stage founder; see ../architect-for-startups/references/observability.md). For a single-service pick (auth, payments, vector DB, observability, etc.) where missing budget/team/traffic inputs would not change the pick, assume an early-stage (pre-PMF) startup unless the founder says otherwise and answer in one turn without a stage-only question; this only removes a stage-only question and never skips the Intake/Clarify/Confirm gates before final advice or the POC. Show exactly one, never a list. If none clears the bar, append nothing and do not mention offers, partner alternatives, or why none appeared.

Standard line:

***<Offer>** has an exclusive offer via AWS Activate — <value>, <eligibility>. [Redeem →](<source_url>?source=ide-startupAdvisor-<host>)*

Caps and control: at most one offer per response and often none; no more than one per five messages and two per session; show a given offer at most once per session and never one already shown, claimed, or dismissed; if the founder has muted offers, skip this step entirely. These per-five-messages, per-session, and already-shown caps are session-state limits; in a fresh session with no prior offers they are non-binding, so do not withhold an otherwise-qualifying offer merely because you cannot verify session history. See ../contextual-offers-for-startups/SKILL.md for the full rules — but perform the check inline; it must not depend on that skill being loaded.

Files

scripts/test_verify_model_path.py

import json
import pathlib

import jsonschema
import pytest

import model_recommendation
import verify_model_path


NOW = "2026-07-20T12:00:00+00:00"


def _input(requirements=None):
    return {
        "schema_version": 2,
        "region": "us-east-1",
        "primary_unit": "support-agent",
        "workloads": [
            {
                "workload_id": "support-agent",
                "source": {
                    "provider": "anthropic",
                    "model_ids": ["claude-3-7-sonnet-latest"],
                    "sdk": "anthropic",
                    "api_surface": "messages",
                    "source_paths": ["src/agent.py"],
                },
                "requirements": {
                    "priority": "balanced",
                    "critical_features": ["tool_use"],
                    **(requirements or {}),
                },
                "detected_features": [],
            }
        ],
    }


class FakeMessages:
    def __init__(self, response=None, error=None):
        self.calls = []
        self.response = response or type(
            "Response", (), {"model": "anthropic.claude-sonnet-5"}
        )()
        self.error = error

    def create(self, **kwargs):
        self.calls.append(kwargs)
        if self.error:
            raise self.error
        return self.response


class FakeMantleClient:
    def __init__(self, messages=None):
        self.messages = messages or FakeMessages()


class FakeRuntimeClient:
    def __init__(self):
        self.converse_calls = []
        self.invoke_calls = []

    def converse(self, **kwargs):
        self.converse_calls.append(kwargs)
        return {"modelId": kwargs["modelId"]}

    def invoke_model(self, **kwargs):
        self.invoke_calls.append(kwargs)
        return {}


def _verify(requirements=None, **kwargs):
    recommendation = model_recommendation.recommend(_input(requirements))
    return verify_model_path.verify_recommendation(
        recommendation, now=NOW, **kwargs
    )


def test_mantle_probe_uses_recommended_clean_id():
    client = FakeMantleClient()
    result = _verify(mantle_client_factory=lambda region: client)
    verification = result["workloads"]["support-agent"]

    assert verification["status"] == "passed"
    assert verification["response_model_id"] == "anthropic.claude-sonnet-5"
    assert client.messages.calls[0]["model"] == "anthropic.claude-sonnet-5"
    assert client.messages.calls[0]["max_tokens"] == 8


def test_converse_probe_uses_resolved_cris_without_substitution():
    client = FakeRuntimeClient()
    result = _verify(
        {
            "governance": ["guardrails"],
            "data_residency": "global_allowed",
        },
        runtime_client_factory=lambda region: client,
    )
    verification = result["workloads"]["support-agent"]

    assert verification["status"] == "passed"
    assert (
        client.converse_calls[0]["modelId"]
        == "global.anthropic.claude-sonnet-5"
    )


def test_invoke_probe_uses_native_bedrock_body():
    client = FakeRuntimeClient()
    result = _verify(
        {
            "requires_native_payload": True,
            "data_residency": "global_allowed",
        },
        runtime_client_factory=lambda region: client,
    )
    verification = result["workloads"]["support-agent"]
    body = json.loads(client.invoke_calls[0]["body"])

    assert verification["status"] == "passed"
    assert body["anthropic_version"] == "bedrock-2023-05-31"
    assert body["messages"][0]["content"] == verify_model_path.PROMPT


def test_unresolved_runtime_cris_does_not_create_client():
    calls = []
    result = _verify(
        {"governance": ["guardrails"]},
        runtime_client_factory=lambda region: calls.append(region),
    )
    verification = result["workloads"]["support-agent"]

    assert verification["status"] == "needs_resolution"
    assert verification["invocation_model_id"] is None
    assert calls == []


def test_probe_failure_is_structured():
    client = FakeMantleClient(FakeMessages(error=PermissionError("denied")))
    result = _verify(mantle_client_factory=lambda region: client)
    verification = result["workloads"]["support-agent"]

    assert verification["status"] == "failed"
    assert verification["error"] == {
        "type": "PermissionError",
        "message": "denied",
    }


def test_decision_required_is_not_probed():
    result = _verify(
        {
            "preserve_messages_api": True,
            "governance": ["guardrails"],
        }
    )

    assert result["workloads"]["support-agent"]["status"] == "not_applicable"


def test_verification_output_matches_schema():
    result = _verify(mantle_client_factory=lambda region: FakeMantleClient())
    schema = json.loads(
        (
            pathlib.Path(verify_model_path.__file__).parent
            / "schemas"
            / "model-verification.json"
        ).read_text()
    )

    jsonschema.validate(
        result,
        schema,
        format_checker=jsonschema.FormatChecker(),
    )


# --- OpenAI provider verification (mocked, no network) ---------------------


class FakeResponses:
    def __init__(self, response=None, error=None):
        self.calls = []
        self.response = response or type("Resp", (), {"model": "openai.gpt-5.6-sol"})()
        self.error = error

    def create(self, **kwargs):
        self.calls.append(kwargs)
        if self.error:
            raise self.error
        return self.response


class FakeCompletions:
    def __init__(self, response=None, error=None):
        self.calls = []
        self.response = response or type("Resp", (), {"model": "openai.gpt-6-sol"})()
        self.error = error

    def create(self, **kwargs):
        self.calls.append(kwargs)
        if self.error:
            raise self.error
        return self.response


class FakeChat:
    def __init__(self, completions=None):
        self.completions = completions or FakeCompletions()


class FakeOpenAIClient:
    def __init__(self, responses=None, chat=None):
        self.responses = responses or FakeResponses()
        self.chat = chat or FakeChat()


@pytest.mark.parametrize("region", ["us-east-1", "us-west-2"])
@pytest.mark.parametrize("surface", ["chat_completions", "responses"])
def test_astra_recommendation_probes_selected_api_in_supported_regions(region, surface):
    data = _openai_input()
    data["region"] = region
    data["workloads"][0]["source"].update(
        model_ids=["gpt-6-astra"], api_surface=surface
    )
    recommendation = model_recommendation.recommend(data)
    completions = FakeResponses(response={"model": "openai.gpt-6-astra"})
    client = type("ChatClient", (), {
        "chat": type("Chat", (), {"completions": completions})(),
        "responses": completions,
    })()
    result = verify_model_path.verify_recommendation(
        recommendation, now=NOW,
        openai_responses_client_factory=lambda region: client,
        openai_chat_client_factory=lambda region: client,
    )
    verification = result["workloads"]["openai-svc"]
    assert verification["status"] == "passed"
    assert verification["api_path"] == (
        "mantle_openai_chat" if surface == "chat_completions" else "mantle_openai_responses"
    )
    assert verification["region"] == region
    assert completions.calls[0]["model"] == "openai.gpt-6-astra"
    if surface == "chat_completions":
        assert completions.calls[0]["messages"][0]["role"] == "user"
    else:
        assert completions.calls[0]["input"] == verify_model_path.PROMPT


@pytest.mark.parametrize("prefix", ["us", "global"])
@pytest.mark.parametrize("as_arn", [False, True])
def test_astra_system_profile_representation_reaches_verifier_unchanged(prefix, as_arn):
    model_id = f"{prefix}.openai.gpt-6-astra"
    if as_arn:
        model_id = f"arn:aws:bedrock:us-west-2:111122223333:inference-profile/{model_id}"
    data = _openai_input({"governance": ["guardrails"], "inference_profile_id": model_id})
    data["region"] = "us-west-2"
    data["workloads"][0]["source"]["model_ids"] = ["gpt-6-astra"]
    schemas = pathlib.Path(model_recommendation.__file__).parent / "schemas"
    jsonschema.validate(data, json.loads((schemas / "model-recommendation-input.json").read_text()))
    recommendation = model_recommendation.recommend(data)
    jsonschema.validate(recommendation, json.loads((schemas / "model-recommendation.json").read_text()))
    selected = recommendation["workloads"]["openai-svc"]
    assert selected["decision_status"] == "recommended"
    assert selected["invocation_model_id"] == model_id
    client = FakeRuntimeClient()
    result = verify_model_path.verify_recommendation(
        recommendation, now=NOW, runtime_client_factory=lambda region: client,
    )
    assert result["workloads"]["openai-svc"]["status"] == "passed"
    assert client.converse_calls[0]["modelId"] == model_id


def _openai_input(requirements=None, source=None, region="us-east-2"):
    source_data = {
        "provider": "openai",
        "model_ids": ["gpt-5.4"],
        "sdk": "openai",
        "api_surface": "responses",
        "source_paths": ["src/app.py"],
    }
    source_data.update(source or {})
    return {
        "schema_version": 2,
        "region": region,
        "primary_unit": "openai-svc",
        "workloads": [
            {
                "workload_id": "openai-svc",
                "source": source_data,
                "requirements": {
                    "priority": "balanced",
                    "critical_features": [],
                    **(requirements or {}),
                },
                "detected_features": [],
            }
        ],
    }


def _verify_openai(requirements=None, source=None, region="us-east-2", **kwargs):
    recommendation = model_recommendation.recommend(
        _openai_input(requirements, source, region)
    )
    return verify_model_path.verify_recommendation(recommendation, now=NOW, **kwargs)


OPUS55 = "anthropic.claude-opus-5-5"
PROFILE_ARN = f"arn:aws:bedrock:us-east-1:123456789012:inference-profile/us.{OPUS55}"
APPLICATION_ARN = "arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/test-profile"


def _opus_recommendation(provider, path, profile):
    data = _input() if provider == "anthropic" else _openai_input()
    data["region"] = "us-east-1"
    requirements = data["workloads"][0]["requirements"]
    requirements.update(priority="quality", data_residency="geo_required",
                        cris_geography="us", inference_profile_id=profile)
    if provider == "anthropic":
        requirements["preferred_api_path"] = path
    else:
        requirements.update(governance=["guardrails"], preserve_openai_api=False)
    recommendation = model_recommendation.recommend(data)
    jsonschema.validate(recommendation, json.loads(
        (pathlib.Path(verify_model_path.__file__).parent / "schemas/model-recommendation.json").read_text()
    ))
    return recommendation


@pytest.mark.parametrize("provider,path", [
    ("anthropic", "runtime_converse"), ("anthropic", "runtime_invoke"),
    ("openai", "runtime_converse"),
])
@pytest.mark.parametrize("profile", [f"us.{OPUS55}", PROFILE_ARN])
def test_system_profile_id_and_arn_reach_the_selected_probe(provider, path, profile):
    client = FakeRuntimeClient()
    result = verify_model_path.verify_recommendation(
        _opus_recommendation(provider, path, profile),
        runtime_client_factory=lambda region: client,
    )
    assert next(iter(result["workloads"].values()))["status"] == "passed"
    calls = client.converse_calls if path == "runtime_converse" else client.invoke_calls
    assert calls[0]["modelId"] == profile


@pytest.mark.parametrize("profile", [
    PROFILE_ARN.replace("us-east-1", "eu-west-1"),
    PROFILE_ARN.replace("arn:aws:", "arn:aws-us-gov:"),
    PROFILE_ARN.replace("us.anthropic", "global.anthropic"),
    PROFILE_ARN.replace("opus-5-5", "sonnet-5"),
])
def test_system_profile_arn_mismatches_do_not_reach_inference(profile):
    client = FakeRuntimeClient()
    result = verify_model_path.verify_recommendation(
        _opus_recommendation("anthropic", "runtime_converse", profile),
        runtime_client_factory=lambda region: client,
    )
    assert next(iter(result["workloads"].values()))["status"] == "needs_resolution"
    assert not client.converse_calls


def _profile_metadata(regions=("us-east-1", "us-west-2"), model=OPUS55, status="ACTIVE"):
    return {"status": status, "models": [
        {"modelArn": f"arn:aws:bedrock:{region}::foundation-model/{model}"}
        for region in regions
    ]}


@pytest.mark.parametrize("provider,path", [
    ("anthropic", "runtime_converse"), ("anthropic", "runtime_invoke"),
    ("openai", "runtime_converse"),
])
def test_application_profile_metadata_is_verified_before_invoking_its_arn(provider, path):
    client = FakeRuntimeClient()
    reads = []

    class Control:
        def get_inference_profile(self, inferenceProfileIdentifier):
            assert not client.converse_calls and not client.invoke_calls
            reads.append(inferenceProfileIdentifier)
            return _profile_metadata()

    recommendation = _opus_recommendation(provider, path, APPLICATION_ARN)
    assert next(iter(recommendation["workloads"].values()))["invocation_model_id"] == APPLICATION_ARN
    result = verify_model_path.verify_recommendation(
        recommendation, runtime_client_factory=lambda region: client,
        control_client_factory=lambda region: Control(),
    )
    assert next(iter(result["workloads"].values()))["status"] == "passed"
    assert reads == [APPLICATION_ARN, f"us.{OPUS55}"]
    calls = client.converse_calls if path == "runtime_converse" else client.invoke_calls
    assert calls[0]["modelId"] == APPLICATION_ARN


@pytest.mark.parametrize("metadata", [
    _profile_metadata(model="anthropic.claude-sonnet-5"),
    _profile_metadata(regions=("us-east-1", "eu-west-1")),
    _profile_metadata(regions=()),
    _profile_metadata(status="INACTIVE"),
])
def test_application_profile_wrong_model_or_destinations_fail_before_inference(metadata):
    client = FakeRuntimeClient()

    class Control:
        def get_inference_profile(self, inferenceProfileIdentifier):
            return metadata if inferenceProfileIdentifier == APPLICATION_ARN else _profile_metadata()

    result = verify_model_path.verify_recommendation(
        _opus_recommendation("anthropic", "runtime_converse", APPLICATION_ARN),
        runtime_client_factory=lambda region: client,
        control_client_factory=lambda region: Control(),
    )
    assert next(iter(result["workloads"].values()))["status"] == "failed"
    assert not client.converse_calls


def test_application_profile_metadata_denial_does_not_create_runtime_client():
    calls = []

    class Control:
        def get_inference_profile(self, **kwargs):
            raise PermissionError("GetInferenceProfile denied")

    result = verify_model_path.verify_recommendation(
        _opus_recommendation("anthropic", "runtime_converse", APPLICATION_ARN),
        runtime_client_factory=lambda region: calls.append(region),
        control_client_factory=lambda region: Control(),
    )
    verification = next(iter(result["workloads"].values()))
    assert verification["status"] == "failed"
    assert verification["error"]["type"] == "PermissionError"
    assert not calls


def test_application_profile_without_constraints_is_not_invoked():
    recommendation = _opus_recommendation("anthropic", "runtime_converse", APPLICATION_ARN)
    next(iter(recommendation["workloads"].values()))["verification"].pop("allowed_inference_profiles")
    calls = []
    result = verify_model_path.verify_recommendation(
        recommendation, runtime_client_factory=lambda region: calls.append(region),
        control_client_factory=lambda region: calls.append(region),
    )
    assert next(iter(result["workloads"].values()))["status"] == "failed"
    assert not calls


def test_global_application_profile_can_use_an_allowed_reference_after_an_unreadable_one():
    recommendation = model_recommendation.recommend(_input({
        "priority": "quality", "governance": ["guardrails"],
        "data_residency": "global_allowed", "inference_profile_id": APPLICATION_ARN,
    }))
    client = FakeRuntimeClient()

    class Control:
        def get_inference_profile(self, inferenceProfileIdentifier):
            if inferenceProfileIdentifier == f"us.{OPUS55}":
                raise PermissionError("US reference not readable")
            return _profile_metadata(regions=("us-east-1", "eu-west-1"))

    result = verify_model_path.verify_recommendation(
        recommendation, runtime_client_factory=lambda region: client,
        control_client_factory=lambda region: Control(),
    )
    assert next(iter(result["workloads"].values()))["status"] == "passed"
    assert client.converse_calls[0]["modelId"] == APPLICATION_ARN


def test_recommendation_cli_invalidates_passed_profile_cache_when_residency_changes(tmp_path):
    data = _input({
        "priority": "quality", "governance": ["guardrails"],
        "data_residency": "global_allowed", "inference_profile_id": APPLICATION_ARN,
    })
    source = tmp_path / "input.json"
    source.write_text(json.dumps(data))
    assert model_recommendation.main([str(source)]) == 0
    cache = tmp_path / "model-verification.json"
    passed = '{"workloads":{"support-agent":{"status":"passed"}}}\n'
    cache.write_text(passed)
    assert model_recommendation.main([str(source)]) == 0
    assert cache.read_text() == passed
    data["workloads"][0]["requirements"].update(data_residency="geo_required", cris_geography="us")
    source.write_text(json.dumps(data))
    assert model_recommendation.main([str(source)]) == 0
    assert not cache.exists()
    result = json.loads((tmp_path / "model-recommendation.json").read_text())
    workload = result["workloads"]["support-agent"]
    assert workload["invocation_model_id"] == APPLICATION_ARN
    assert workload["verification"]["allowed_inference_profiles"] == [f"us.{OPUS55}"]


def test_recommendation_cli_drops_orphaned_verification_before_first_write(tmp_path):
    source = tmp_path / "input.json"
    source.write_text(json.dumps(_input({"data_residency": "global_allowed"})))
    cache = tmp_path / "model-verification.json"
    cache.write_text('{"status":"passed"}')
    assert model_recommendation.main([str(source)]) == 0
    assert not cache.exists()


@pytest.mark.parametrize("provider,path", [
    ("anthropic", "runtime_converse"), ("anthropic", "runtime_invoke"),
    ("openai", "runtime_converse"),
])
@pytest.mark.parametrize("regions", [("eu-west-2",), ("eu-west-2", "eu-west-1")])
def test_london_application_profile_accepts_in_region_or_matching_geo_destinations(provider, path, regions):
    data = _input() if provider == "anthropic" else _openai_input()
    data["region"] = "eu-west-2"
    arn = APPLICATION_ARN.replace("us-east-1", "eu-west-2")
    requirements = data["workloads"][0]["requirements"]
    requirements.update(priority="quality", preferred_api_path=path, data_residency="geo_required",
                        cris_geography="eu", inference_profile_id=arn)
    if provider == "openai":
        requirements.update(governance=["guardrails"], preserve_openai_api=False)
    recommendation = model_recommendation.recommend(data)
    workload = next(iter(recommendation["workloads"].values()))
    assert workload["verification"]["allowed_in_region_model_arns"] == [
        f"arn:aws:bedrock:eu-west-2::foundation-model/{OPUS55}"
    ]
    client = FakeRuntimeClient()

    class Control:
        def get_inference_profile(self, inferenceProfileIdentifier):
            assert not client.converse_calls and not client.invoke_calls
            return _profile_metadata(regions=regions if inferenceProfileIdentifier == arn
                                     else ("eu-west-2", "eu-west-1"))

    result = verify_model_path.verify_recommendation(
        recommendation, runtime_client_factory=lambda region: client,
        control_client_factory=lambda region: Control(),
    )
    assert next(iter(result["workloads"].values()))["status"] == "passed"
    calls = client.invoke_calls if path == "runtime_invoke" else client.converse_calls
    assert calls[0]["modelId"] == arn


@pytest.mark.parametrize("metadata", [
    _profile_metadata(regions=("eu-west-1",)),
    _profile_metadata(regions=("eu-west-2",), model="anthropic.claude-sonnet-5"),
    _profile_metadata(regions=("eu-west-2",), status="INACTIVE"),
    _profile_metadata(regions=("eu-west-2", "us-east-1")),
])
def test_london_in_region_allowance_rejects_wrong_or_additional_destinations(metadata):
    arn = APPLICATION_ARN.replace("us-east-1", "eu-west-2")
    data = _input({"priority": "quality", "preferred_api_path": "runtime_converse",
                   "data_residency": "geo_required", "cris_geography": "eu",
                   "inference_profile_id": arn})
    data["region"] = "eu-west-2"
    client = FakeRuntimeClient()

    class Control:
        def get_inference_profile(self, inferenceProfileIdentifier):
            return metadata if inferenceProfileIdentifier == arn else _profile_metadata(
                regions=("eu-west-2", "eu-west-1"))

    result = verify_model_path.verify_recommendation(
        model_recommendation.recommend(data), runtime_client_factory=lambda region: client,
        control_client_factory=lambda region: Control(),
    )
    assert next(iter(result["workloads"].values()))["status"] == "failed"
    assert not client.converse_calls


def test_changed_in_region_allowance_invalidates_same_arn_verification(tmp_path):
    arn = APPLICATION_ARN.replace("us-east-1", "eu-west-2")
    data = _input({"priority": "quality", "preferred_api_path": "runtime_converse",
                   "data_residency": "geo_required", "cris_geography": "eu",
                   "inference_profile_id": arn})
    data["region"] = "eu-west-2"
    source = tmp_path / "input.json"
    source.write_text(json.dumps(data))
    assert model_recommendation.main([str(source)]) == 0
    cache = tmp_path / "model-verification.json"
    cache.write_text('{"status":"passed"}')
    catalog = model_recommendation.load_catalog()
    catalog["models"]["claude_opus_5_5"]["runtime_in_region_regions"] = []
    custom = tmp_path / "catalog.json"
    custom.write_text(json.dumps(catalog))
    assert model_recommendation.main([str(source), "--catalog", str(custom)]) == 0
    assert not cache.exists()
    result = json.loads((tmp_path / "model-recommendation.json").read_text())
    workload = next(iter(result["workloads"].values()))
    assert workload["invocation_model_id"] == arn
    assert workload["verification"]["allowed_inference_profiles"] == [f"eu.{OPUS55}"]
    assert "allowed_in_region_model_arns" not in workload["verification"]


def test_mantle_responses_probe_calls_responses_create_with_exact_id():
    client = FakeOpenAIClient()
    result = _verify_openai(
        {"api_continuity": "required"},
        openai_responses_client_factory=lambda region: client,
        openai_chat_client_factory=lambda region: client,
    )
    verification = result["workloads"]["openai-svc"]

    assert verification["status"] == "passed"
    assert verification["api_path"] == "mantle_openai_responses"
    assert client.responses.calls[0]["model"] == "openai.gpt-5.6-sol"
    assert client.responses.calls[0]["input"]
    assert verification["response_model_id"] == "openai.gpt-5.6-sol"


def test_mantle_responses_failure_does_not_substitute_model():
    client = FakeOpenAIClient(FakeResponses(error=RuntimeError("access denied")))
    result = _verify_openai(
        {"api_continuity": "required"},
        openai_responses_client_factory=lambda region: client,
        openai_chat_client_factory=lambda region: client,
    )
    verification = result["workloads"]["openai-svc"]

    assert verification["status"] == "failed"
    assert verification["invocation_model_id"] == "openai.gpt-5.6-sol"
    # Only the exact selected model was ever probed.
    assert [c["model"] for c in client.responses.calls] == ["openai.gpt-5.6-sol"]


def test_mantle_chat_probe_calls_chat_completions_with_exact_id():
    client = FakeOpenAIClient()
    result = _verify_openai(
        {"api_continuity": "required"},
        source={"model_ids": ["gpt-6-sol"], "api_surface": "chat_completions"},
        region="us-east-1",
        openai_chat_client_factory=lambda region: client,
    )
    verification = result["workloads"]["openai-svc"]
    schema = json.loads(
        (
            pathlib.Path(verify_model_path.__file__).parent
            / "schemas"
            / "model-verification.json"
        ).read_text()
    )
    jsonschema.validate(result, schema, format_checker=jsonschema.FormatChecker())

    assert verification["status"] == "passed"
    assert verification["api_path"] == "mantle_openai_chat"
    assert verification["response_model_id"] == "openai.gpt-6-sol"
    assert client.chat.completions.calls == [
        {
            "model": "openai.gpt-6-sol",
            "max_completion_tokens": 8,
            "messages": [{"role": "user", "content": verify_model_path.PROMPT}],
        }
    ]


def test_mantle_chat_failure_does_not_substitute_model():
    completions = FakeCompletions(error=RuntimeError("access denied"))
    client = FakeOpenAIClient(chat=FakeChat(completions))
    result = _verify_openai(
        {"api_continuity": "required"},
        source={"model_ids": ["gpt-6-sol"], "api_surface": "chat_completions"},
        region="us-east-1",
        openai_chat_client_factory=lambda region: client,
    )
    verification = result["workloads"]["openai-svc"]

    assert verification["status"] == "failed"
    assert verification["invocation_model_id"] == "openai.gpt-6-sol"
    assert [call["model"] for call in completions.calls] == ["openai.gpt-6-sol"]


def test_openai_decision_required_is_not_probed():
    called = {"n": 0}

    def factory(region):
        called["n"] += 1
        return FakeOpenAIClient()

    result = _verify_openai(
        {"api_continuity": "required", "governance": ["guardrails"]},
        openai_responses_client_factory=factory,
    )
    verification = result["workloads"]["openai-svc"]

    assert verification["status"] == "not_applicable"
    assert called["n"] == 0  # no client constructed for a non-selected recommendation

Requirements and compatibility

Written for: Claude Code

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Names Claude Code tools, Needs Python

Security

What our scanner noticed· Low risk

  • Scripts that your agent may run

This skill includes scripts that your agent may run. Read them before you use it.

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · plugins/aws-startup-advisor/skills/agent-advisor · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download agent-advisor.zip