Skip to content

Commit dba8a06

Browse files
committed
feat(gateway): add read-only gateway commands
1 parent 5b9506f commit dba8a06

43 files changed

Lines changed: 1450 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ agentcore # interactive TUI
6565
│ └── endpoint
6666
│ ├── get # get a Runtime endpoint by qualifier
6767
│ └── list # list a Runtime's endpoints
68+
├── gateway # inspect AgentCore Gateways
69+
│ ├── get # get a Gateway by id
70+
│ ├── list # list Gateways (server-side paginated)
71+
│ ├── target
72+
│ │ ├── get # get a Target under a Gateway
73+
│ │ └── list # list Targets under a Gateway
74+
│ └── rule
75+
│ ├── get # get a Rule under a Gateway
76+
│ └── list # list Rules under a Gateway
6877
├── eval # evaluate and optimize AgentCore agents
6978
│ └── evaluator # manage AgentCore evaluators
7079
│ ├── llm-as-a-judge # LLM-as-a-Judge evaluators
@@ -120,6 +129,14 @@ agentcore runtime version list --id <runtimeId> --max-results 20
120129
agentcore runtime endpoint get --id <runtimeId> --qualifier DEFAULT
121130
agentcore runtime endpoint list --id <runtimeId> --max-results 20
122131

132+
# Inspect Gateway resources without project configuration or deployment
133+
agentcore gateway get --id <gatewayId>
134+
agentcore gateway list --max-results 20
135+
agentcore gateway target get --gateway-id <gatewayId> --target-id <targetId>
136+
agentcore gateway target list --gateway-id <gatewayId> --max-results 20
137+
agentcore gateway rule get --gateway-id <gatewayId> --rule-id <ruleId>
138+
agentcore gateway rule list --gateway-id <gatewayId> --max-results 20
139+
123140
# Manage API key credential providers
124141
agentcore identity api-key-credential-provider create --name my-provider --api-key <key>
125142
agentcore identity api-key-credential-provider get --name my-provider

src/components/RouterScreen.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ describe("menu rendering", () => {
1717
expect(frame).toContain("manage agentcore harnesses");
1818
expect(frame).toContain("runtime");
1919
expect(frame).toContain("inspect AgentCore Runtimes");
20+
expect(frame).toContain("gateway");
21+
expect(frame).toContain("inspect AgentCore Gateways");
2022
expect(frame).toContain("config");
2123
expect(frame).toContain("read/write global config values");
2224
r.unmount();

src/core/core.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,15 @@ test("data() caches independently of control()", () => {
182182
expect(dataBuilt).toBe(1);
183183
});
184184

185-
test("exposes a harness sub-client", () => {
185+
test("exposes feature sub-clients", () => {
186186
const core = new CoreClient({
187187
createControlClient: fakeControl,
188188
createDataClient: fakeData,
189189
createIamClient: fakeIam,
190190
logger: createSilentLogger(),
191191
});
192192
expect(core.harness).toBeDefined();
193+
expect(core.gateway).toBeDefined();
193194
});
194195

195196
test("getRuntime sends the abort signal to the control client", async () => {

src/core/gateway.tsx

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import {
2+
GetGatewayCommand,
3+
GetGatewayRuleCommand,
4+
GetGatewayTargetCommand,
5+
ListGatewayRulesCommand,
6+
ListGatewaysCommand,
7+
ListGatewayTargetsCommand,
8+
type GetGatewayResponse,
9+
type GetGatewayRuleResponse,
10+
type GetGatewayTargetResponse,
11+
type ListGatewayRulesResponse,
12+
type ListGatewaysResponse,
13+
type ListGatewayTargetsResponse,
14+
} from "@aws-sdk/client-bedrock-agentcore-control";
15+
import type { CoreGatewayClient } from "../handlers/gateway/types";
16+
import type { AwsClients, CoreOptions } from "./types";
17+
import { toClientConfig } from "./utils";
18+
19+
export class GatewayClient implements CoreGatewayClient {
20+
constructor(private readonly clients: AwsClients) {}
21+
22+
async getGateway(id: string, options: CoreOptions): Promise<GetGatewayResponse> {
23+
return this.clients
24+
.control(toClientConfig(options))
25+
.send(new GetGatewayCommand({ gatewayIdentifier: id }));
26+
}
27+
28+
async listGateways(
29+
nextToken: string | undefined,
30+
maxResults: number | undefined,
31+
options: CoreOptions,
32+
): Promise<ListGatewaysResponse> {
33+
return this.clients
34+
.control(toClientConfig(options))
35+
.send(new ListGatewaysCommand({ nextToken, maxResults }));
36+
}
37+
38+
async getGatewayTarget(
39+
gatewayId: string,
40+
targetId: string,
41+
options: CoreOptions,
42+
): Promise<GetGatewayTargetResponse> {
43+
return this.clients.control(toClientConfig(options)).send(
44+
new GetGatewayTargetCommand({
45+
gatewayIdentifier: gatewayId,
46+
targetId,
47+
}),
48+
);
49+
}
50+
51+
async listGatewayTargets(
52+
gatewayId: string,
53+
nextToken: string | undefined,
54+
maxResults: number | undefined,
55+
options: CoreOptions,
56+
): Promise<ListGatewayTargetsResponse> {
57+
return this.clients.control(toClientConfig(options)).send(
58+
new ListGatewayTargetsCommand({
59+
gatewayIdentifier: gatewayId,
60+
nextToken,
61+
maxResults,
62+
}),
63+
);
64+
}
65+
66+
async getGatewayRule(
67+
gatewayId: string,
68+
ruleId: string,
69+
options: CoreOptions,
70+
): Promise<GetGatewayRuleResponse> {
71+
return this.clients.control(toClientConfig(options)).send(
72+
new GetGatewayRuleCommand({
73+
gatewayIdentifier: gatewayId,
74+
ruleId,
75+
}),
76+
);
77+
}
78+
79+
async listGatewayRules(
80+
gatewayId: string,
81+
nextToken: string | undefined,
82+
maxResults: number | undefined,
83+
options: CoreOptions,
84+
): Promise<ListGatewayRulesResponse> {
85+
return this.clients.control(toClientConfig(options)).send(
86+
new ListGatewayRulesCommand({
87+
gatewayIdentifier: gatewayId,
88+
nextToken,
89+
maxResults,
90+
}),
91+
);
92+
}
93+
}

src/core/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { BedrockAgentCoreControlClient } from "@aws-sdk/client-bedrock-agentcore
22
import { BedrockAgentCoreClient } from "@aws-sdk/client-bedrock-agentcore";
33
import { IAMClient } from "@aws-sdk/client-iam";
44
import { EvalClient } from "./eval";
5+
import { GatewayClient } from "./gateway";
56
import { HarnessClient } from "./harness";
67
import { IdentityClient } from "./identity";
78
import { RuntimeClient } from "./runtime";
@@ -52,6 +53,7 @@ export class CoreClient implements AwsClients {
5253
readonly harness: HarnessClient = new HarnessClient(this);
5354
readonly identity: IdentityClient = new IdentityClient(this);
5455
readonly runtime: RuntimeClient;
56+
readonly gateway: GatewayClient = new GatewayClient(this);
5557
readonly eval: EvalClient = new EvalClient(this);
5658

5759
readonly projectManager: ProjectManager;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"gatewayArn": "arn:aws:bedrock-agentcore:us-west-2:685197708687:gateway/agentcore-cli-gateway-read-fixture-a-l6opkbe2kd",
3+
"gatewayId": "agentcore-cli-gateway-read-fixture-a-l6opkbe2kd",
4+
"createdAt": {
5+
"$date": "2026-07-29T22:19:37.409Z"
6+
},
7+
"updatedAt": {
8+
"$date": "2026-07-29T22:19:37.971Z"
9+
},
10+
"status": "READY",
11+
"name": "agentcore-cli-gateway-read-fixture-a",
12+
"authorizerType": "NONE",
13+
"gatewayUrl": "https://agentcore-cli-gateway-read-fixture-a-l6opkbe2kd.gateway.bedrock-agentcore.us-west-2.amazonaws.com/mcp",
14+
"description": "AgentCore CLI persistent Gateway read fixture",
15+
"roleArn": "arn:aws:iam::685197708687:role/AgentCoreCliGatewayReadFixtureRole",
16+
"protocolType": "MCP",
17+
"workloadIdentityDetails": {
18+
"workloadIdentityArn": "arn:aws:bedrock-agentcore:us-west-2:685197708687:workload-identity-directory/default/workload-identity/agentcore-cli-gateway-read-fixture-a-l6opkbe2kd"
19+
}
20+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$error": {
3+
"name": "ResourceNotFoundException",
4+
"message": "Failed to retrieve gateway because it doesn't exist. Retry the request with a different resource identifier."
5+
}
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$error": {
3+
"name": "ResourceNotFoundException",
4+
"message": "GatewayRule 00000000-0000-4000-8000-000000000000 not found"
5+
}
6+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"ruleId": "d396c3f4-4591-41b3-a4d5-816e03c32419",
3+
"gatewayArn": "arn:aws:bedrock-agentcore:us-west-2:685197708687:gateway/agentcore-cli-gateway-read-rule-fixture-lhpid2reoy",
4+
"priority": 10,
5+
"actions": [
6+
{
7+
"routeToTarget": {
8+
"staticRoute": {
9+
"targetName": "agentcore-cli-gateway-read-http-target"
10+
}
11+
}
12+
}
13+
],
14+
"createdAt": {
15+
"$date": "2026-07-30T00:13:42.602Z"
16+
},
17+
"status": "ACTIVE",
18+
"conditions": [
19+
{
20+
"matchPaths": {
21+
"anyOf": [
22+
"/agentcore-cli-gateway-read-http-target/*"
23+
]
24+
}
25+
}
26+
],
27+
"description": "AgentCore CLI persistent Gateway Rule read fixture A1",
28+
"updatedAt": {
29+
"$date": "2026-07-30T00:13:42.602Z"
30+
}
31+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$error": {
3+
"name": "ResourceNotFoundException",
4+
"message": "Failed to retrieve target because it doesn't exist. Retry the request with a different resource identifier."
5+
}
6+
}

0 commit comments

Comments
 (0)