"""Minimal Responses API + AgentCore Gateway connector sketch (Python). Context: Bedrock server-side tool execution with AgentCore Gateway (Feb 2026). Replace ACCOUNT, REGION, GATEWAY_ID, MODEL_ID before use. Requires: boto3 configured with bedrock:InvokeModel (or Responses API perms for mantle). """ from __future__ import annotations import json import os import boto3 REGION = os.environ.get("AWS_REGION", "us-west-2") GATEWAY_ARN = os.environ[ "AGENTCORE_GATEWAY_ARN" ] # arn:aws:bedrock-agentcore:REGION:ACCOUNT:gateway/GATEWAY_ID MODEL_ID = os.environ.get("BEDROCK_MODEL_ID", "openai.gpt-oss-120b") # Pseudocode shaped to Bedrock docs: pass Gateway ARN as server-side tool connector. # Exact request field names follow current Responses / bedrock-mantle docs for your region. def invoke_with_gateway(prompt: str) -> dict: client = boto3.client("bedrock-runtime", region_name=REGION) request = { "model": MODEL_ID, "input": prompt, "tools": [ { "type": "agentcore_gateway", "gateway_arn": GATEWAY_ARN, } ], } # Prefer the Responses API endpoint documented for bedrock-mantle in your SDK version. # Fallback shown for local dry-runs — do not ship without aligning to current API: print(json.dumps({"dry_run_request": request}, indent=2)) return {"status": "dry-run", "note": "Wire to Responses create call per current SDK"} if __name__ == "__main__": print(invoke_with_gateway("List open orders over $500 for customer CUST-98765"))