Exposing Tools Through Amazon Bedrock AgentCore Gateway (Part 2)
Part 2: moved the AWS ops agent's tools out-of-process onto Bedrock AgentCore Gateway. The four Strands tools (EC2 lister, public-S3 checker, cost-by-service, IAM MFA audit) became one Lambda, dispatched by tool name, with a hand-written JSON schema replacing Strands' docstring auto-conversion. Stood up a Gateway with Cognito auth, registered the Lambda as a target exposing all four as MCP tools. A second agent now calls the Gateway instead of local imports — same results as Part 1.
Why Bother? What Gateway Actually Buys You
In Part 1, the four tools lived inside the same Python process as the agent — `import tools` and they’re just there. That’s simple, and for four tools it’s genuinely fine. Gateway exists for a different situation: when you want tools to be independently deployable, shareable across multiple agents, or written in a different language than your agent — without the agent’s code needing to change to use them.
Part 1 (in-process):Strands Agent → tools.py (imported directly) → boto3 → AWS APIs
Part 2 (this post):Strands Agent → MCP Client → AgentCore Gateway → Lambda → boto3 → AWS APIs
Three new pieces sit between the agent and AWS — Cognito proves the agent is allowed to call the Gateway, the Gateway is the managed front door that speaks MCP, and the same four checks now run as an independent Lambda function instead of inside the agent’s own code. Any other agent that can get a Cognito token could call this same Gateway and reuse these same tools.
A term you’ll need: MCP (Model Context Protocol) is an open standard for exposing tools to AI agents over a network connection, instead of as local function calls. Gateway speaks MCP on one side (to your agent) and translates that into calls against whatever’s actually implementing the tool — in this case, a Lambda function — on the other side.
Step 1: Write the Lambda Function
Rather than four separate Lambda functions (which would mean four IAM roles and four things to redeploy), this uses AWS’s own documented pattern for Gateway Lambda targets: one function, dispatched by tool name.
def lambda_handler(event, context): # Gateway prefixes the tool name with the target name, delimited by "___" delimiter = "___" original_tool_name = context.client_context.custom["bedrockAgentCoreToolName"] tool_name = original_tool_name[original_tool_name.index(delimiter) + len(delimiter):]
handler = TOOL_DISPATCH.get(tool_name) if handler is None: return f"Unknown tool: {tool_name}"
return handler(event)Two things worth understanding before you write this yourself:
The `event` object is flat, not nested — if a tool’s input schema has a `region` property, `event` is simply `{“region”: “us-east-1”}`. No wrapper, straight from AWS’s official contract for Lambda targets.
The tool name arrives prefixed. Gateway calls tools by `{target_name}___{tool_name}` (with your target named, say, `awsopstools`, the model would be calling `awsopstools___list_ec2_instances`). Your handler has to strip that prefix off before matching against your own tool names — that’s what the `delimiter` logic above does.
The four functions being dispatched to are the exact same logic from Part 1’s `tools.py` — same boto3 calls, same return-string formatting — just without the `@tool` decorator, since that’s a Strands-specific thing that only matters for in-process tools.
Testing the Dispatch Logic Before It’s Ever Deployed
You don’t need an actual Lambda function running in AWS to test this — `lambda_handler` is just a Python function that takes `event` and `context`. Locally, you can fake the `context` object well enough to exercise the real dispatch logic (and the real boto3 calls against your actual AWS account) without deploying anything yet.
Save this as `test_gateway_dispatch.py` in the same folder as your project folder:
"""Local test for gateway_lambda.py's tool-name dispatch logic, using a mockedLambda context — no actual Lambda deployment needed yet."""
from types import SimpleNamespaceimport gateway_lambda
def make_context(tool_name: str): class FakeContext: client_context = SimpleNamespace( custom={"bedrockAgentCoreToolName": f"awsopstools___{tool_name}"} ) return FakeContext()
tests = [ ("list_ec2_instances", {}), ("find_public_s3_buckets", {}), ("list_iam_users_without_mfa", {}), ("get_cost_by_service", {"days": 7}), # costs $0.01 — Cost Explorer API pricing]
for tool_name, event in tests: print(f"--- {tool_name} ---") result = gateway_lambda.lambda_handler(event, make_context(tool_name)) print(result) print()Run it from your project folder, with your virtual environment active:
source .venv/bin/activatepython test_gateway_dispatch.pyWhat’s happening here: `make_context()` builds a fake object shaped exactly like the real `context` argument AWS Lambda passes in — specifically `context.client_context.custom[“bedrockAgentCoreToolName”]`, since that’s the one field `lambda_handler` actually reads. The prefix (`awsopstools___`) matches whatever you name your Gateway target in Step 4 — if you rename the target later, update it here too so the test still reflects reality.
Each of the four tools will run its real boto3 call against your actual AWS account and print the result — the same output you’d get calling the tools directly in Part 1, just routed through the dispatch function this time. If any of them error out, that’s the same class of error you’d see in Part 1 (usually a missing IAM permission) — fix it the same way, one exact permission at a time.
Press enter or click to view image in full size
Step 2: Define the Tool Schema
In Part 1, Strands read each tool’s docstring automatically to figure out its name, description, and parameters. Lambda functions don’t have that — you write the equivalent by hand, as a JSON tool schema. This is the thing the Gateway hands to the model so it knows what tools exist and how to call them — functionally the same job the docstrings did in Part 1, just written explicitly instead of inferred.
Where this actually gets used: you don’t do anything with this file yet — you’re just preparing it now. It gets pasted into the console in Step 5, when you register the Lambda function as a Gateway target. Keeping it as its own step here just makes it easier to reference and copy cleanly.
Save this as `gateway_tool_schema.json`:
[ { "name": "list_ec2_instances", "description": "List EC2 instances in a region with their state and type.", "inputSchema": { "type": "object", "properties": { "region": { "type": "string", "description": "AWS region to check, e.g. 'us-east-1'. Defaults to us-east-1 if omitted." } }, "required": [] } }, { "name": "find_public_s3_buckets", "description": "Check all S3 buckets in the account and flag ones that are publicly accessible.", "inputSchema": { "type": "object", "properties": {}, "required": [] } }, { "name": "get_cost_by_service", "description": "Get AWS spend broken down by service for the last N days.", "inputSchema": { "type": "object", "properties": { "days": { "type": "integer", "description": "Number of trailing days to report on. Defaults to 7 if omitted." } }, "required": [] } }, { "name": "list_iam_users_without_mfa", "description": "List IAM users that do not have any MFA device enabled.", "inputSchema": { "type": "object", "properties": {}, "required": [] } }]It’s a JSON array of four tool definitions — one per tool — each with a `name`, a `description` (this is what the model actually reads to decide when to call this tool, same role the docstring played in Part 1), and an `inputSchema` describing its parameters. The two zero-argument tools get an empty `properties` object; the other two each declare one optional property (`region`, `days`).
Step 3: Create the Lambda Function
3.1 — Create the IAM Role First
The Lambda needs permission to write logs and to make the same seven read-only AWS calls the tools always needed. Create this before creating the function itself, so you can attach it during creation instead of coming back to it.
Create an IAM role named aws-ops-tools-lambda-role and attach the below policy
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": ["logs:CreateLogGroup", "logs:CreateLogStream", "logs:PutLogEvents"], "Resource": "arn:aws:logs:us-east-1:<ACCOUNT_ID>:*" }, { "Effect": "Allow", "Action": [ "ec2:DescribeInstances", "s3:ListAllMyBuckets", "s3:GetBucketPublicAccessBlock", "s3:GetBucketAcl", "ce:GetCostAndUsage", "iam:ListUsers", "iam:ListMFADevices" ], "Resource": "*" } ]}Replace `<ACCOUNT_ID>` with your AWS account ID. The first statement is standard Lambda logging permissions — every Lambda function needs these to write to CloudWatch. The second is the exact same seven AWS-facing permissions from Part 1’s IAM policy; the tool logic didn’t change, only where it runs.
3.2 — Create the Function
- Open the Lambda Console → Functions → Create function.
- Choose Author from scratch.
- Function name: `aws-ops-tools-handler`.
- Runtime: Python 3.13.
- Architecture: either is fine — Lambda doesn’t require ARM64 the way AgentCore Runtime did in Part 1.
- Under Permissions, expand Change default execution role → Use an existing role → select `aws-ops-tools-lambda-role`.
- Click Create function.
Once lambda is created add the below code and deploy.
"""Single Lambda function backing all four Ops Agent tools as an AgentCoreGateway Lambda target. One function, dispatched by tool name."""
from datetime import datetime, timedelta, timezoneimport boto3
def list_ec2_instances(region: str = "us-east-1") -> str: ec2 = boto3.client("ec2", region_name=region) paginator = ec2.get_paginator("describe_instances") lines = [] for page in paginator.paginate(): for reservation in page["Reservations"]: for instance in reservation["Instances"]: name = next( (t["Value"] for t in instance.get("Tags", []) if t["Key"] == "Name"), "(unnamed)", ) lines.append( f"{instance['InstanceId']} | {name} | {instance['InstanceType']} " f"| {instance['State']['Name']}" ) if not lines: return f"No EC2 instances found in {region}." return f"EC2 instances in {region}:\n" + "\n".join(lines)
def find_public_s3_buckets() -> str: s3 = boto3.client("s3") buckets = s3.list_buckets()["Buckets"] if not buckets: return "No S3 buckets found in this account."
results = [] for bucket in buckets: name = bucket["Name"] try: pab = s3.get_public_access_block(Bucket=name)["PublicAccessBlockConfiguration"] fully_blocked = all(pab.values()) status = "private (public access block enabled)" if fully_blocked else "check needed (public access block not fully enabled)" except s3.exceptions.ClientError: status = "NO public access block configured — verify bucket policy/ACL manually" results.append(f"{name}: {status}")
return "S3 bucket public-access check:\n" + "\n".join(results)
def get_cost_by_service(days: int = 7) -> str: ce = boto3.client("ce", region_name="us-east-1") end = datetime.now(timezone.utc).date() start = end - timedelta(days=days)
response = ce.get_cost_and_usage( TimePeriod={"Start": start.isoformat(), "End": end.isoformat()}, Granularity="DAILY", Metrics=["UnblendedCost"], GroupBy=[{"Type": "DIMENSION", "Key": "SERVICE"}], )
totals = {} for day in response["ResultsByTime"]: for group in day["Groups"]: service = group["Keys"][0] amount = float(group["Metrics"]["UnblendedCost"]["Amount"]) totals[service] = totals.get(service, 0.0) + amount
if not totals: return f"No cost data found for the last {days} days."
lines = [f"{svc}: ${amt:.2f}" for svc, amt in sorted(totals.items(), key=lambda x: -x[1]) if amt > 0] return f"Cost by service, last {days} days:\n" + "\n".join(lines)
def list_iam_users_without_mfa() -> str: iam = boto3.client("iam") users = iam.list_users()["Users"] missing = [] for user in users: mfa = iam.list_mfa_devices(UserName=user["UserName"])["MFADevices"] if not mfa: missing.append(user["UserName"])
if not missing: return "All IAM users have at least one MFA device enabled." return "IAM users WITHOUT MFA enabled:\n" + "\n".join(missing)
TOOL_DISPATCH = { "list_ec2_instances": lambda event: list_ec2_instances(**event), "find_public_s3_buckets": lambda event: find_public_s3_buckets(), "get_cost_by_service": lambda event: get_cost_by_service(**event), "list_iam_users_without_mfa": lambda event: list_iam_users_without_mfa(),}
def lambda_handler(event, context): # Gateway prefixes the tool name with the target name, delimited by "___" delimiter = "___" original_tool_name = context.client_context.custom["bedrockAgentCoreToolName"] tool_name = original_tool_name[original_tool_name.index(delimiter) + len(delimiter):]
handler = TOOL_DISPATCH.get(tool_name) if handler is None: return f"Unknown tool: {tool_name}"
return handler(event)This is the complete file — the four tool functions (identical logic to Part 1’s `tools.py`, just without the `@tool` decorator), the `TOOL_DISPATCH` lookup table, and the `lambda_handler` entrypoint from Step 1 that routes each call to the right function.
Step 4: Create the Gateway
One naming detail worth getting right before you start: the Gateway itself and the target you add to it (Step 5) are named separately. It’s specifically the target’s name that becomes the `${target_name}___` prefix the Lambda function strips off in Step 1/3 — not the Gateway’s name. To avoid confusing the two, this post uses `aws-ops-agent-gateway` for the Gateway and `awsopstools` for the target (matching the `awsopstools___` prefix already baked into `gateway_lambda.py` and `test_gateway_dispatch.py`).
- Open the AgentCore console. In the left sidebar, click Gateways — it’s under the Build section, in the same area as Runtime (if you did Part 1’s deployment, you’ve been in this neighborhood before).
- Click Create Gateway.
- Define gateway details: name it `aws-ops-agent-gateway`, and let the console auto-create the Gateway’s execution role if it offers to — it needs `lambda:InvokeFunction` permission on `awsopstools-handler`, and letting the console generate the role saves you wiring that up by hand. Click Next.
- Configure Inbound Identity: under Inbound Auth type, choose Use JSON Web Tokens (JWT). Under JWT schema configuration, choose Quick create configurations with Cognito — recommended — this has the console create a Cognito user pool and app client for you automatically. Click Next.
That lands you on “Add targets” — continue to Step 5.
Step 5: Register the Lambda as a Gateway Target
This isn’t actually a separate action from Step 4 — the console folds it into the same “Create Gateway” wizard, as its third of four sub-steps: Define gateway details → Configure Inbound Identity → Add targets → Review and create. You’ll land on “Add targets” automatically after finishing Step 4’s inbound-auth screen — this section just covers what to do once you’re there.
The “Add targets” screen has two separate choices that are easy to conflate — a target protocol and a target type — and the second one defaults to the wrong option for this build:
- Select a target protocol: leave this on MCP target (it’s the default, and it’s already correct — “MCP target can be defined as an MCP server, API gateway, Lambda, or REST API to define MCP tools”).
- Target name: the console auto-fills something like `target-quick-start-6c9197`. Clear it and type `awsopstools` instead — this is the name that becomes the prefix on every tool call (`awsopstools___list_ec2_instances`, and so on), so it has to match exactly what `gateway_lambda.py`’s `delimiter` logic expects.
- Passthrough: leave on the default, Do not use passthrough — default aggregated.
- Target type: this is the one that needs changing — the console defaults to MCP server, not Lambda ARN. Click Lambda ARN (“Define this target with a Lambda function and S3 resource”). If you leave it on MCP server, the form asks for an external MCP endpoint URL and OAuth-client outbound auth — that’s for connecting to somebody else’s MCP server, not for using your own Lambda function.
- Once you’ve switched to Lambda ARN, select `awsopstools-handler` (the function from Step 3) and paste the tool schema JSON array from Step 2 into whatever field the console shows for it.
- Click Next / Add target, then finish the wizard’s final Review and create step.
After adding the target, click through the wizard’s final Review and create sub-step to actually create the Gateway. Wait for the Gateway’s own status, and then the target’s status, to both reach READY on the Gateway’s overview page (the target usually takes a bit longer, since it has to sync the tool schema).
Press enter or click to view image in full size
Once it’s ready, collect three values you’ll need in Step 6:
- The Gateway’s MCP endpoint URL — shown right on the Gateway’s overview page.
- From Amazon Cognito console → User pools → the pool the Gateway created → App integration tab: the app client’s Client ID and
- Client secret (click into the app client to reveal the secret).
- From that same App integration tab, under Domain: the token endpoint is `https://<your-domain>.auth.us-east-1.amazoncognito.com/oauth2/token`.
Step 6: Connect the Agent to the Gateway
This is the piece that replaces `from tools import …` from Part 1 — a second, separate agent file, `agent_gateway.py`, sitting next to (not replacing) the original `agent.py`. Two new ideas show up here that Part 1 didn’t need: fetching a Cognito access token, and connecting via MCP instead of a plain Python import.
6.1 — Install the One New Dependency
`agent_gateway.py` needs the `requests` library to talk to Cognito’s token endpoint — everything else it uses (`strands`, `mcp`) is already installed from Part 1.
pip install requests6.2 — Understand the Token Fetch
Since this is a machine (the agent) talking to Cognito, not a person logging into a website, it uses OAuth’s client credentials grant:send your client ID and secret, get back a short-lived access token, no browser or login screen involved.
def get_cognito_access_token() -> str: """Client-credentials grant — machine-to-machine, no user login involved.""" response = requests.post( COGNITO_TOKEN_URL, data={"grant_type": "client_credentials"}, auth=(COGNITO_CLIENT_ID, COGNITO_CLIENT_SECRET), headers={"Content-Type": "application/x-www-form-urlencoded"}, timeout=10, ) response.raise_for_status() return response.json()["access_token"]`auth=(COGNITO_CLIENT_ID, COGNITO_CLIENT_SECRET)` sends them as HTTP Basic auth — that’s what Cognito’s token endpoint expects for this grant type. `response.raise_for_status()` makes sure a bad client ID/secret pair fails loudly here, rather than surfacing later as a confusing connection error when the agent tries to actually use the token.
6.3 — Understand the MCP Connection
Strands’ `MCPClient` wraps the network connection to the Gateway. Passing it directly into `Agent(tools=[mcp_client])` — rather than calling `.list_tools_sync()` yourself first — lets Strands manage opening and closing that connection automatically, including on every tool call, not just once at startup.
mcp_client = MCPClient( lambda: streamablehttp_client(GATEWAY_URL, headers={"Authorization": f"Bearer {token}"})The `Authorization: Bearer <token>` header is how the Cognito access token from Step 6.2 actually gets presented to the Gateway on every request — this is the piece that satisfies the “Configure Inbound Identity” JWT check from Step 4.
6.4 — The Complete File
Save this as `agent_gateway.py`, in the same folder as `agent.py` and `tools.py`:
"""Gateway-backed variant of the Ops Agent: instead of importing tools.pydirectly, this connects to the AgentCore Gateway as an MCP client and letsthe agent discover the tools from there. Compare against agent.py, whichuses the tools in-process.
Requires four environment variables, from your Gateway + Cognito setup(Steps 4-5): GATEWAY_URL - the Gateway's MCP endpoint, e.g. https://<gateway-id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp COGNITO_TOKEN_URL - the Cognito user pool's token endpoint, e.g. https://<domain>.auth.us-east-1.amazoncognito.com/oauth2/token COGNITO_CLIENT_ID / COGNITO_CLIENT_SECRET - from the Cognito app client the Gateway created for machine-to-machine auth"""
import os
import requestsfrom mcp.client.streamable_http import streamablehttp_clientfrom strands import Agentfrom strands.models import BedrockModelfrom strands.tools.mcp import MCPClient
MODEL_ID = "amazon.nova-lite-v1:0"REGION = "us-east-1"
GATEWAY_URL = os.environ["GATEWAY_URL"]COGNITO_TOKEN_URL = os.environ["COGNITO_TOKEN_URL"]COGNITO_CLIENT_ID = os.environ["COGNITO_CLIENT_ID"]COGNITO_CLIENT_SECRET = os.environ["COGNITO_CLIENT_SECRET"]
SYSTEM_PROMPT = """You are an AWS operations assistant. You answer questionsabout the user's own AWS account using the tools available to you.
Rules:- Only use the provided tools to get information; never guess at account data.- If a tool call fails (e.g. missing permissions), tell the user exactly which permission looks like it's missing rather than making up an answer.- Keep answers concise and skimmable — bullet points over prose for lists.- If asked about security issues (public buckets, missing MFA), be direct about the risk, don't downplay it."""
def get_cognito_access_token() -> str: """Client-credentials grant — machine-to-machine, no user login involved.""" response = requests.post( COGNITO_TOKEN_URL, data={"grant_type": "client_credentials"}, auth=(COGNITO_CLIENT_ID, COGNITO_CLIENT_SECRET), headers={"Content-Type": "application/x-www-form-urlencoded"}, timeout=10, ) response.raise_for_status() return response.json()["access_token"]
def build_agent() -> Agent: token = get_cognito_access_token() mcp_client = MCPClient( lambda: streamablehttp_client(GATEWAY_URL, headers={"Authorization": f"Bearer {token}"}) ) model = BedrockModel(model_id=MODEL_ID, region_name=REGION) # Passing the MCPClient directly lets Strands manage the connection # lifecycle automatically, rather than manually opening/closing it. return Agent(model=model, system_prompt=SYSTEM_PROMPT, tools=[mcp_client])
def main() -> None: agent = build_agent() print("AWS Ops Agent (Gateway-backed) ready. Ask about your account (Ctrl+C to quit).") while True: try: prompt = input("> ") except (KeyboardInterrupt, EOFError): print("\nExiting.") break if not prompt.strip(): continue response = agent(prompt) print(response) print()
if __name__ == "__main__": main()Same system prompt, same model, same REPL loop as Part 1’s `agent.py` — nothing about the agent’s behavior changes here, only where its tools come from. That symmetry is deliberate: it makes Step 7’s side-by-side comparison meaningful, since any difference in output points at the Gateway path specifically, not at some unrelated change.
Notice the four `os.environ[…]` lines near the top — this file doesn’t hardcode the Gateway URL or Cognito credentials, it expects them as environment variables. Step 7 covers setting those.
Step 7: Test It End-to-End
7.1 — Find the Four Values
`agent_gateway.py` reads its configuration from four environment variables — nothing hardcoded, so the same file works no matter what you named things. Here’s exactly where each one comes from, all collected back in Step 5:
| Variable | Where to find it ||----------|------------------|| `GATEWAY_URL` | Gateway console → your gateway's overview page → **MCP endpoint URL** || `COGNITO_TOKEN_URL` | Cognito console → User pools → the pool the Gateway created → **App integration** tab → **Domain** section → append `/oauth2/token` || `COGNITO_CLIENT_ID` | Same App integration tab → the app client's **Client ID** || `COGNITO_CLIENT_SECRET` | Same app client → click into it → **Client secret** (you may need to click "Show" or "Generate" if it's hidden) |7.2 — Set the Environment Variables and Run It
export GATEWAY_URL="https://<gateway-id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"export COGNITO_TOKEN_URL="https://<your-domain>.auth.us-east-1.amazoncognito.com/oauth2/token"export COGNITO_CLIENT_ID="<client-id>"export COGNITO_CLIENT_SECRET="<client-secret>"
source .venv/bin/activatepython agent_gateway.pyIf this is set up correctly, you’ll see the same startup message Part 1’s `agent.py` prints — `AWS Ops Agent (Gateway-backed) ready.` — but getting there involves more happening behind the scenes than Part 1 did: a POST request to Cognito for a token, then an MCP connection to the Gateway to discover the four tools, before the prompt is ready.
7.3 — Ask the Same Question as Part 1
At the `>` prompt:
Are any of my S3 buckets public, and do all IAM users have MFA enabled?If everything’s wired correctly, you get the same real findings as Part 1 — same buckets, same users — just routed through Gateway → Lambda instead of an in-process import.
7.4 — If Something Goes Wrong
A few errors you’re likely to hit, and what they actually mean:
| Error | Likely cause ||-------|--------------|| `401` or `invalid_client` from the token request | `COGNITO_CLIENT_ID` or `COGNITO_CLIENT_SECRET` is wrong — re-copy them from the Cognito app client || Connection error / timeout reaching the Gateway | `GATEWAY_URL` is wrong, or the Gateway's status isn't **READY** yet || Agent responds but says it has no tools available, or can't find a tool | The target hasn't finished syncing — check the target's status on the Gateway's page; also confirm the target type is **Lambda ARN**, not **MCP server** (Step 5's default-option trap) || `AccessDenied` invoking the Lambda | The Gateway's execution role is missing `lambda:InvokeFunction` on `aws-ops-tools-handler` — same fix as the target-creation error from earlier in this build || `modelStreamErrorException: Model produced invalid sequence as part of ToolUse` | The target name has a hyphen in it. Nova Lite has to generate the full prefixed tool name as part of a tool call, and reliably fails when that name contains a hyphen — rename the target to something with only letters, numbers, and underscores (Step 1's naming rule) |Each of these is diagnosable from the actual error text, the same “add exactly what the error names” approach used throughout Part 1 — resist the urge to guess and grant broader permissions instead.
One limitation worth knowing about: the Cognito access token from a client-credentials grant expires — commonly after an hour. Fine for a demo session like this one; a long-running deployment would need to refresh the token periodically instead of fetching it once at startup.
What We Accomplished
In this part, we:
- Learned what AgentCore Gateway is for, and when it’s worth the extra moving parts over in-process tools
- Rewrote the four tools as a single Lambda function, dispatched by tool name — AWS’s own documented pattern, rather than four separate functions
- Hand-wrote the tool schema that replaces Strands’ automatic docstring-based tool discovery
- Created a Gateway with Cognito handling inbound authentication, and registered the Lambda as a target
- Built a second agent variant using Strands’ MCP client, and confirmed it produces identical real results to Part 1’s simpler version
Two working versions of the same agent now exist side by side — one simple and in-process, one Gateway-backed and independently deployable — with real, first-hand experience of what each trade-off actually costs in setup and moving parts.
What’s Next
- AgentCore Memory — short- and long-term context across conversations, so the agent remembers past findings between sessions
- AgentCore Identity, if this ever needs to act across more than one AWS account
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article