docs: module 7 walkthrough — adding a gateway target - #29
Merged
Conversation
Module 7 is where the platform becomes something a participant extends, and it had narration but no instructions. Written from the two targets that already work in this repo rather than invented: the web-search built-in connector and the sample-tool Lambda. docs/GATEWAY_TARGETS.md covers both paths — connector (no code) and Lambda (your own logic) — and leads with the table that decides which one you want. The details it spends space on are the ones that cost real debugging here: - The connector config only survives synth via add_property_override: the L1 property mapping predates connector targets and silently drops the key, so the target deploys with no connector and the tool never appears. - A connector needs its own action on the gateway role (bedrock-agentcore:InvokeWebSearch on arn:...:aws:tool/web-search.v1, with a literal "aws" where an account id goes). Missing it deploys fine and fails at call time. - Connectors are regional, so gate them like app.py does rather than failing the deploy elsewhere. - A Lambda tool gets its name from context.client_context.custom ["bedrockAgentCoreToolName"] as "<target>___<tool>" and must dispatch on the suffix — verified against tools/sample_tool/handler.py. - tool_schema uses CloudFormation PascalCase keys, not MCP's JSON casing. - The Description field is read by a model deciding whether to call the tool. Write it for that reader. Also notes what a participant hits next: the default orchestrator pattern has no tools, so verifying "an agent uses my tool" needs a tool-consuming pattern; and a new tool inherits the gateway's opt-in controls (Cedar names tools as <Target>___<tool>, the egress interceptor masks its output too). MODULE_EXPLAIN[7] and the participant guide's module 7 row now point at it. Verified: every claim checked against the code it describes (handler context key, tool_configs shape, gateway_stack override, IAM action, region gate); links and cross-file anchors resolve; check-workshop-flow passes (narration is sed-extracted, so the MODULE_EXPLAIN edit had to stay one line) and the migration dry run prints module 7; pytest 115 passed.
|
Commit: Security Scan Results
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Module 7 is where the platform stops being something you deployed and becomes something you extend — and it had narration but no instructions.
docs/GATEWAY_TARGETS.mdfills that in, written from the two targets that already work in this repo rather than invented: theweb-searchbuilt-in connector and thesample-toolLambda.Covers both paths with a table that decides which one you want:
The details it spends space on
These are the ones that cost real debugging here, so they're called out rather than left to be rediscovered:
add_property_override— the L1 property mapping predates connector targets and silently drops the key, so the target deploys with no connector and the tool simply never appears.bedrock-agentcore:InvokeWebSearchonarn:…:aws:tool/web-search.v1— literalawswhere an account id goes). Missing it deploys clean and fails at call time.app.pydoes instead of failing the deploy elsewhere.context.client_context.custom["bedrockAgentCoreToolName"]as<target>___<tool>, and the handler must dispatch on the suffix.tool_schemauses CloudFormation PascalCase, not MCP's JSON casing.Descriptionis read by a model deciding whether to call the tool. Write it for that reader.It also answers what a participant hits immediately after: the default
orchestratorpattern has no tools, so proving "an agent uses my tool" needs a tool-consuming pattern; and a new tool inherits the gateway's opt-in controls (Cedar names tools<Target>___<tool>, the egress interceptor masks its output too).Verified
tool_configsshape, thegateway_stackoverride, the IAM action, the region gate.check-workshop-flowpasses — narration is sed-extracted, so theMODULE_EXPLAIN[7]edit had to stay one physical line — and the migration dry run prints module 7.