Skip to content

feat(project): add gateway resources - #2028

Open
aidandaly24 wants to merge 9 commits into
aws:refactorfrom
aidandaly24:feat/project-gateway-add
Open

feat(project): add gateway resources#2028
aidandaly24 wants to merge 9 commits into
aws:refactorfrom
aidandaly24:feat/project-gateway-add

Conversation

@aidandaly24

@aidandaly24 aidandaly24 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds project-based Gateway resource management:

agentcore project add gateway
agentcore project add gateway-target
agentcore project add gateway-connector

agentcore project remove gateway
agentcore project remove gateway-target --gateway <name>
agentcore project remove gateway-connector --gateway <name>

Project-command JSON maps directly to the existing version 1 agentcore.json schemas:

  • --authorizer-configuration accepts GatewayAuthorizerConfigSchema;
  • --target-configuration accepts one complete AgentCoreGatewayTargetSchema object;
  • --connector-configuration accepts the same complete Target object and requires targetType: "connector";
  • JSON sources work inline, through file://, and through stdin;
  • SDK request shapes are not accepted or translated.

Scalar endpoint, Runtime, and curated Connector shortcuts construct the same
project-schema objects accepted through JSON. Connector removal is an alias over
Gateway Target removal because Connectors are stored as ordinary Targets.

Gateway protocol behavior preserves the existing schema and L3 contract:

  • omitting --protocol-type persists protocolType: "None" and creates an unrestricted Gateway;
  • --protocol-type MCP persists protocolType: "MCP" and creates an MCP-only Gateway;
  • "None" is not exposed as a flag value because omission already selects it;
  • semantic search requires --protocol-type MCP.

The change also:

  • makes project-owned compute Target branches reachable through direct Target JSON;
  • validates OAuth/API-key credential-name references in complete Target JSON and OAuth shortcuts;
  • validates Runtime and Runtime endpoint references;
  • validates the complete candidate project before one agentcore.json write;
  • uses the existing generic project-resource mutation flow, with only nested Target placement and removal handled specially;
  • rejects duplicate Target names across all Gateways and unassignedTargets[], matching the existing L3 Target-output contract.

The CLI does not create or copy files referenced by Target JSON. Paths such as
schemaSource.inline.path and lambdaFunctionArn.toolSchemaFile remain explicit
in agentcore.json.

Testing

Verification on CLI head 523a5b35:

  • focused Gateway add/remove and schema tests: 90 passed;
  • bun test src --coverage outside the restricted sandbox: 1,794 passed;
  • project line coverage: 97.86%;
  • modified Gateway add handlers, remove handler, and Gateway schema: 100% line coverage;
  • bun run typecheck;
  • bun run lint:check;
  • bun run format:check;
  • bun run build;
  • built CLI help verified for Gateway, Gateway Target, and removal commands.

Live deployment

Earlier end-to-end verification of the persisted Gateway and Target shapes used
a generated project with @aws/agentcore-cdk@0.1.0-alpha.45:

  • Runtime and direct MCP Targets reached READY;
  • Runtime invocation through Gateway returned HTTP 200;
  • MCP initialize and tools/list returned HTTP 200;
  • the stack and all resources were destroyed and verified absent.

Credential-provider authoring is owned by the separate project credentials
commands. This PR validates Gateway Target references to those project
credentials but does not create them.

@github-actions github-actions Bot added the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 18, 2026
@codecov-commenter

codecov-commenter commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.30%. Comparing base (38c30ae) to head (523a5b3).
⚠️ Report is 3 commits behind head on refactor.

Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2028      +/-   ##
============================================
+ Coverage     97.24%   97.30%   +0.05%     
============================================
  Files           396      400       +4     
  Lines         24019    24544     +525     
============================================
+ Hits          23357    23882     +525     
  Misses          662      662              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot removed the agentcore-harness-reviewing AgentCore Harness review in progress label Aug 18, 2026
@aidandaly24
aidandaly24 force-pushed the feat/project-gateway-add branch 4 times, most recently from dbcb3b6 to fd627a1 Compare August 21, 2026 19:05
@aidandaly24
aidandaly24 marked this pull request as ready for review August 21, 2026 19:26
@aidandaly24
aidandaly24 marked this pull request as draft August 21, 2026 20:17
@aidandaly24
aidandaly24 force-pushed the feat/project-gateway-add branch from fd627a1 to 41a946d Compare August 21, 2026 20:28
@aidandaly24
aidandaly24 force-pushed the feat/project-gateway-add branch from 41a946d to 7753af0 Compare August 21, 2026 22:47
@aidandaly24
aidandaly24 marked this pull request as ready for review August 21, 2026 23:13
Comment thread src/core/project/manager.tsx Outdated
);
if (gatewayIndex < 0) {
throw new InputValidationError(
`gateway '${input.gatewayName}' does not exist in agentCoreGateways[]`,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: does not exist in project. Please check agentCoreGateway in agentcore.json

Comment thread src/core/project/manager.tsx Outdated
};
}

private assertUniqueGatewayTargetName(project: Project["spec"], name: string): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are all gateway target names required to be unique across every gateway, or must they only be unique inside a single gateway?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is due to a limitation with the current CDK. The name technically only has to be unique to the gateway but the L3 CDKs require them to be globally unique. This is a change we could make on the L3 CDK but for now I was just trying to make the implementaion compatible.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to inline this function

),
flag(
"knowledge-base",
"project Knowledge Base name or external ten-character Knowledge Base ID",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add that this could only be used with bedrock-knowledge-base

import type { Project } from "../../types";
import type { AddProjectResourceConfig } from "../types";

export const createAddGatewayTargetHandler = (config: AddProjectResourceConfig) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you check how the help looks for the old cli, you will notice that it divides based on target

Target types and their options:

  http-runtime — Route to an AgentCore runtime
    --runtime <name>               Runtime from your project
    --runtime-endpoint <name>      Endpoint / version alias (optional)

  mcp-server — Connect to an MCP-compatible server
    --endpoint <url>               Server endpoint URL
    --host <host>                  Lambda or AgentCoreRuntime
    --language <lang>              Python, TypeScript, or Other

  api-gateway — Connect to an Amazon API Gateway REST API
    --rest-api-id <id>             REST API ID
    --stage <stage>                Deployment stage

  open-api-schema / smithy-model — Auto-derive tools from a schema
    --schema <path>                Schema file path or S3 URI
    --schema-s3-account <id>       S3 bucket owner account ID

  lambda-function-arn — Connect to an AWS Lambda function
    --lambda-arn <arn>             Lambda function ARN
    --tool-schema-file <path>      Tool schema JSON file

  connector — Wire a managed AWS connector (bedrock-knowledge-bases, web-search)
    --connector <id>               bedrock-knowledge-bases or web-search
    --knowledge-base-id <id>       Project KB name or 10-char external KB id (for KB connectors)
    --exclude-domains <list>       Comma-separated domains to exclude (for web-search connector)

  passthrough — Route to an external HTTPS endpoint
    --passthrough-endpoint <url>   HTTPS endpoint URL
    --stickiness-identifier <expr> Session routing expression (optional)
    --stickiness-timeout <seconds> Sticky session timeout in seconds (optional)

  Auth (--outbound-auth <type>, --credential-name <name>) — valid types per target:
    mcp-server                     oauth or none
    lambda-function-arn            oauth or none
    http-runtime                   oauth or none
    open-api-schema                oauth or api-key (required)
    api-gateway                    api-key or none
    smithy-model                   none (uses gateway IAM role)
    passthrough                    gateway-iam-role, oauth, or jwt-passthrough

configurations: [{ name: "WebSearch", parameterValues: { maxResults: 10 } }],
};
case "bedrock-knowledge-bases":
if (!knowledgeBase) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we do this validation at line 60?

),
flag("exception-level", "exception detail level: debug", z.enum(["debug"]).optional()),
flag(
"tags",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check runtime and harness, we don't do SourceResolver for this.

"restrict Target protocols to MCP; omitted allows every Target protocol",
z.enum(["mcp"]).optional(),
),
flag(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: The description should say enable semantic search to search tools on gateway

z.string().optional(),
),
flag(
"policy-engine-name",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we expand this for policy engines outside of this project? What is cons of doing that?

testIO,
} from "../../../testing";

export function createGatewayProjectTestHarness(directoryPrefix: string) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combine this with index.test.ts. If no one other test file is using it, it should be combine with the test file

Comment thread src/handlers/project/types.ts Outdated

export type RemoveResourceInput = {
resourceType: ProjectResource;
resourceType: Exclude<ProjectResource, "gateway" | "gateway-target">;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we excluding it from remove?

@Hweinstock

Copy link
Copy Markdown
Contributor

Run ./dist/bin/agentcore-linux-x64 --help
ResourceUnavailable: C:\codebuild\tmp\output\src2220336954\src\actions-runner\_work\_temp\6e195c49-dc39-49f6-be19-336eeffd6cd8.ps1:2
Line |
   2 |  ./dist/bin/agentcore-linux-x64 --help
     |  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     | Program 'agentcore-linux-x64' failed to run: Class not registeredAt
     | C:\codebuild\tmp\output\src2220336954\src\actions-runner\_work\_temp\6e195c49-dc39-49f6-be19-336eeffd6cd8.ps1:2 char:1 + ./dist/bin/agentcore-linux-x64 --help + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.

Is this failure related to the changes here? I don't see this failure on main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants