Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN uv pip install --no-cache -r requirements.txt
RUN useradd -m -u 1000 bedrock_agentcore
USER bedrock_agentcore

COPY basic_agent.py cost_logger.py factory.py composition.py mcp_clients.py mantle_client.py model_profiles.py resilience.py session.py streaming.py ./
COPY basic_agent.py cost_logger.py errors.py factory.py composition.py mcp_clients.py mantle_client.py model_profiles.py resilience.py session.py streaming.py ./
COPY prompts/ prompts/
COPY modes/ modes/
COPY tools/ tools/
Expand Down
18 changes: 17 additions & 1 deletion agent/mantle_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,28 @@ async def aclose(self):


def mantle_model(model_id: str, region: str = "us-east-1"):
"""Create a Strands OpenAIModel pointing at bedrock-mantle with SigV4 auth.
"""Create a Strands model pointing at bedrock-mantle with AWS-native auth.

Models that only support the Responses API (see
``model_profiles.MANTLE_RESPONSES_MODELS``, e.g. GPT-5.6 Terra) use
Strands' native ``OpenAIResponsesModel`` with ``bedrock_mantle_config``
(bearer token minted per request). All other models use the legacy
Chat Completions path with a SigV4-signed httpx transport.

Usage:
from mantle_client import mantle_model
model = mantle_model("openai.gpt-5.4", region="us-east-1")
"""
from model_profiles import MANTLE_RESPONSES_MODELS

if model_id in MANTLE_RESPONSES_MODELS:
from strands.models.openai_responses import OpenAIResponsesModel

return OpenAIResponsesModel(
bedrock_mantle_config={"region": region},
model_id=model_id,
)

from strands.models.openai import OpenAIModel

class _MantleOpenAIModel(OpenAIModel):
Expand Down
9 changes: 9 additions & 0 deletions agent/model_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,18 @@ def to_bedrock_kwargs(self) -> dict:
# Models served via bedrock-mantle (OpenAI-compatible endpoint, not Converse API).
# model_id → list of supported regions (first entry is the fallback).
MANTLE_MODELS: dict[str, list[str]] = {
"openai.gpt-5.6-terra": ["us-east-1", "us-east-2", "us-west-2"],
"openai.gpt-5.5": ["us-east-1", "us-east-2"],
"openai.gpt-5.4": ["us-east-1", "us-east-2", "us-west-2"],
}

# Mantle models that only support the Responses API (no Chat Completions).
# GPT-5.6 model cards: Responses ✅ / Chat Completions ❌ — calling
# /chat/completions returns 400 Bad Request.
MANTLE_RESPONSES_MODELS: set[str] = {
"openai.gpt-5.6-terra",
}


def resolve_mantle_region(model_id: str, deploy_region: str | None = None) -> str:
"""Resolve the best mantle region for a model.
Expand Down Expand Up @@ -136,6 +144,7 @@ def resolve_mantle_region(model_id: str, deploy_region: str | None = None) -> st
# Amazon Nova
"us.amazon.nova-2-lite-v1:0": NOVA_2_DEFAULT,
# OpenAI GPT (bedrock-mantle)
"openai.gpt-5.6-terra": GPT_DEFAULT,
"openai.gpt-5.5": GPT_DEFAULT,
"openai.gpt-5.4": GPT_DEFAULT,
}
Expand Down
2 changes: 1 addition & 1 deletion agent/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Dependencies for Strands Agent. AI model access requires appropriate
# IAM permissions and Bedrock model access grants.
strands-agents[otel,openai]>=1.30.0
strands-agents[otel,openai]>=1.47.0
mcp>=1.23.1
bedrock-agentcore[strands-agents]>=1.0.6
aws-opentelemetry-distro>=0.10.0
Expand Down
1 change: 1 addition & 0 deletions infra/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ model:
- "global.anthropic.claude-opus-4-6-v1"
- "global.anthropic.claude-haiku-4-5-20251001-v1:0"
- "us.amazon.nova-2-lite-v1:0"
- "openai.gpt-5.6-terra" # bedrock-mantle (us-east-1, us-east-2, us-west-2)
- "openai.gpt-5.5" # bedrock-mantle (us-east-1, us-east-2)
- "openai.gpt-5.4" # bedrock-mantle (us-east-1, us-east-2, us-west-2)

Expand Down
6 changes: 4 additions & 2 deletions infra/lib/agent-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ export class AgentStack extends cdk.Stack {
resources: ["*"],
})
);
// bedrock-mantle (OpenAI-compatible endpoint) for models like GPT-5.4/5.5
// bedrock-mantle (OpenAI-compatible endpoint) for models like GPT-5.4/5.5/5.6.
// CreateInference: legacy SigV4 path (Chat Completions).
// CallWithBearerToken: Responses API path (bearer token, e.g. GPT-5.6 Terra).
role.addToPolicy(
new iam.PolicyStatement({
actions: ["bedrock-mantle:CreateInference"],
actions: ["bedrock-mantle:CreateInference", "bedrock-mantle:CallWithBearerToken"],
resources: ["*"],
})
);
Expand Down
4 changes: 4 additions & 0 deletions infra/lib/model-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ export const MODEL_METADATA: Record<string, ModelMetadata> = {
composable: false,
},
// --- OpenAI GPT ---
"openai.gpt-5.6-terra": {
displayName: "GPT-5.6 Terra",
description: "Balanced performance competitive with GPT-5.5 at half the cost",
},
"openai.gpt-5.5": {
displayName: "GPT-5.5",
description: "OpenAI's most capable model, advanced coding and agentic tasks",
Expand Down
Loading