@aws/nx-plugin-mcp 1.0.0-rc.0 → 1.0.0-rc.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/aws-nx-mcp.js +3556 -2476
- package/docs/guides/connection/py-agent-a2a.mdx +1 -1
- package/docs/guides/connection/py-agent-mcp.mdx +1 -1
- package/docs/guides/connection/react-agui.mdx +1 -1
- package/docs/guides/connection/react-py-agent.mdx +1 -1
- package/docs/guides/connection/react-smithy.mdx +1 -1
- package/docs/guides/connection/react-trpc.mdx +2 -2
- package/docs/guides/connection/react-ts-agent.mdx +1 -1
- package/docs/guides/connection/smithy-dynamodb.mdx +68 -0
- package/docs/guides/connection/smithy-rdb.mdx +1 -1
- package/docs/guides/connection/trpc-dynamodb.mdx +62 -0
- package/docs/guides/connection/trpc-rdb.mdx +1 -1
- package/docs/guides/connection/ts-agent-a2a.mdx +1 -1
- package/docs/guides/connection/ts-agent-dynamodb.mdx +128 -0
- package/docs/guides/connection/ts-agent-mcp.mdx +1 -1
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +125 -0
- package/docs/guides/connection.mdx +29 -0
- package/docs/guides/docker-bundling.mdx +1 -1
- package/docs/guides/fastapi.mdx +11 -11
- package/docs/guides/license.mdx +264 -109
- package/docs/guides/nx-generator.mdx +4 -0
- package/docs/guides/py-agent.mdx +18 -18
- package/docs/guides/py-mcp-server.mdx +10 -6
- package/docs/guides/python-lambda-function.mdx +4 -4
- package/docs/guides/react-website-auth.mdx +15 -0
- package/docs/guides/react-website.mdx +12 -6
- package/docs/guides/trpc.mdx +19 -18
- package/docs/guides/ts-agent.mdx +18 -18
- package/docs/guides/ts-dynamodb.mdx +364 -0
- package/docs/guides/ts-lambda-function.mdx +4 -4
- package/docs/guides/ts-mcp-server.mdx +10 -6
- package/docs/guides/ts-rdb.mdx +53 -9
- package/docs/guides/ts-smithy-api.mdx +9 -8
- package/docs/guides/typescript-project.mdx +5 -10
- package/docs/guides/workspace.mdx +9 -3
- package/docs/snippets/agent/architecture.mdx +4 -4
- package/docs/snippets/agent/bedrock-deployment.mdx +1 -1
- package/docs/snippets/api/api-architecture.mdx +2 -2
- package/docs/snippets/api/type-safe-api-integrations.mdx +2 -2
- package/docs/snippets/connection/dynamodb-local-development.mdx +7 -0
- package/docs/snippets/connection/lambda-dynamodb-access.mdx +80 -0
- package/docs/snippets/lambda-function/deploying-your-function.mdx +2 -2
- package/docs/snippets/mcp/architecture.mdx +4 -4
- package/docs/snippets/mcp/bedrock-deployment.mdx +1 -1
- package/docs/snippets/mcp/config.mdx +1 -1
- package/docs/snippets/required-prerequisites.mdx +1 -1
- package/generators.json +44 -5
- package/package.json +1 -1
- package/src/infra/app/schema.json +1 -1
- package/src/license/schema.json +6 -0
- package/src/preset/schema.json +9 -4
- package/src/py/agent/schema.json +18 -18
- package/src/py/api/schema.json +15 -15
- package/src/py/fast-api/schema.json +15 -15
- package/src/py/lambda-function/schema.json +15 -7
- package/src/py/mcp-server/schema.json +15 -15
- package/src/py/project/schema.json +2 -2
- package/src/smithy/ts/api/schema.json +15 -15
- package/src/trpc/backend/schema.json +15 -15
- package/src/ts/agent/schema.json +18 -18
- package/src/ts/api/schema.json +15 -15
- package/src/ts/dynamodb/agent-connection/schema.json +22 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +22 -0
- package/src/ts/dynamodb/schema.json +52 -0
- package/src/ts/dynamodb/smithy-connection/schema.json +18 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +18 -0
- package/src/ts/lambda-function/schema.json +15 -7
- package/src/ts/mcp-server/schema.json +15 -15
- package/src/ts/rdb/schema.json +13 -13
- package/src/ts/react-website/app/schema.json +13 -13
- package/src/ts/react-website/cognito-auth/schema.json +4 -4
- package/src/ts/website/app/schema.json +21 -13
- package/src/ts/website/auth/schema.json +4 -4
package/docs/guides/py-agent.mdx
CHANGED
|
@@ -47,7 +47,7 @@ First use the <Link path="/guides/python-project">`py#project`</Link> generator
|
|
|
47
47
|
|
|
48
48
|
The generator will add the following files to your existing Python project. The files generated depend on the chosen `protocol`:
|
|
49
49
|
|
|
50
|
-
<OptionFilter when={{ protocol: '
|
|
50
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP server layout">
|
|
51
51
|
### HTTP Protocol (default)
|
|
52
52
|
|
|
53
53
|
<FileTree>
|
|
@@ -58,13 +58,13 @@ The generator will add the following files to your existing Python project. The
|
|
|
58
58
|
- init.py FastAPI application setup with CORS and error handling middleware
|
|
59
59
|
- agent.py Main agent definition with sample tools
|
|
60
60
|
- main.py FastAPI entry point for Bedrock AgentCore Runtime
|
|
61
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
61
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
62
62
|
- pyproject.toml Updated with Strands dependencies
|
|
63
63
|
- project.json Updated with agent serve targets
|
|
64
64
|
</FileTree>
|
|
65
65
|
</OptionFilter>
|
|
66
66
|
|
|
67
|
-
<OptionFilter when={{ protocol: '
|
|
67
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="Strands A2A server layout">
|
|
68
68
|
### A2A Protocol
|
|
69
69
|
|
|
70
70
|
The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) instead of FastAPI:
|
|
@@ -76,13 +76,13 @@ The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/use
|
|
|
76
76
|
- \_\_init\_\_.py Python package initialization
|
|
77
77
|
- agent.py Main agent definition with sample tools
|
|
78
78
|
- main.py A2A server entry point
|
|
79
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
79
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
80
80
|
- pyproject.toml Updated with Strands dependencies
|
|
81
81
|
- project.json Updated with agent serve targets
|
|
82
82
|
</FileTree>
|
|
83
83
|
</OptionFilter>
|
|
84
84
|
|
|
85
|
-
<OptionFilter when={{ protocol: '
|
|
85
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server layout">
|
|
86
86
|
### AG-UI Protocol
|
|
87
87
|
|
|
88
88
|
The entry point uses the [ag-ui-strands](https://docs.ag-ui.com/) integration, which exposes your agent via the AG-UI protocol for direct frontend integration with [CopilotKit](https://docs.copilotkit.ai/aws-strands):
|
|
@@ -94,7 +94,7 @@ The entry point uses the [ag-ui-strands](https://docs.ag-ui.com/) integration, w
|
|
|
94
94
|
- \_\_init\_\_.py Python package initialization
|
|
95
95
|
- agent.py Main agent definition with sample tools
|
|
96
96
|
- main.py AG-UI server entry point using ag-ui-strands
|
|
97
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
97
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
98
98
|
- pyproject.toml Updated with Strands and AG-UI dependencies
|
|
99
99
|
- project.json Updated with agent serve targets
|
|
100
100
|
</FileTree>
|
|
@@ -106,7 +106,7 @@ AG-UI agents can be connected to a React frontend using the <Link path="/guides/
|
|
|
106
106
|
|
|
107
107
|
### Infrastructure
|
|
108
108
|
|
|
109
|
-
<OptionFilter when={{
|
|
109
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
|
|
110
110
|
<Snippet name="shared-constructs" />
|
|
111
111
|
|
|
112
112
|
For deploying your Agent, the following files are generated:
|
|
@@ -136,8 +136,8 @@ For deploying your Agent, the following files are generated:
|
|
|
136
136
|
</Infrastructure>
|
|
137
137
|
</OptionFilter>
|
|
138
138
|
|
|
139
|
-
<OptionFilter when={{
|
|
140
|
-
If you selected `
|
|
139
|
+
<OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
|
|
140
|
+
If you selected `none` for `infra`, no CDK constructs or Terraform modules are generated — the Agent can only be run locally. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
|
|
141
141
|
</OptionFilter>
|
|
142
142
|
|
|
143
143
|
#### Architecture
|
|
@@ -235,7 +235,7 @@ Your agent's server protocol determines how it communicates. All options are ser
|
|
|
235
235
|
|
|
236
236
|
All protocols expose `/ping` for the AgentCore runtime health check contract. A2A agents listen on port `9000`; HTTP and AG-UI agents listen on port `8080`. The generated Dockerfile and infrastructure are configured for you.
|
|
237
237
|
|
|
238
|
-
<OptionFilter when={{ protocol: '
|
|
238
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP server details">
|
|
239
239
|
## FastAPI Server (HTTP protocol)
|
|
240
240
|
|
|
241
241
|
The generated HTTP server includes:
|
|
@@ -319,7 +319,7 @@ You can find more details about the SDK's capabilities in the [documentation her
|
|
|
319
319
|
Since the generator vends CDK or Terraform infrastructure which manages deploying your agent, you do not need to utilise the `bedrock-agentcore-starter-toolkit` which the docs mention for deploying your agent.
|
|
320
320
|
:::
|
|
321
321
|
|
|
322
|
-
<OptionFilter when={{ protocol: '
|
|
322
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A server details">
|
|
323
323
|
## A2A Server (A2A protocol)
|
|
324
324
|
|
|
325
325
|
The generated `main.py` mounts `A2AServer.to_fastapi_app()` onto a parent FastAPI app that also exposes `/ping`. When deployed to AgentCore, the entry point resolves the runtime's public ARN from AppConfig and advertises it in the agent card.
|
|
@@ -327,7 +327,7 @@ The generated `main.py` mounts `A2AServer.to_fastapi_app()` onto a parent FastAP
|
|
|
327
327
|
Most users will not need to modify this file — edit `agent.py` to change tools or the system prompt. The A2A server populates the agent card (`/.well-known/agent-card.json`) from the `Agent` constructor's `name` and `description`.
|
|
328
328
|
</OptionFilter>
|
|
329
329
|
|
|
330
|
-
<OptionFilter when={{ protocol: '
|
|
330
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server details">
|
|
331
331
|
## AG-UI Server (AG-UI protocol)
|
|
332
332
|
|
|
333
333
|
The generated `main.py` wraps your Strands `Agent` in an `ag_ui_strands.StrandsAgent` and creates a FastAPI app via `create_strands_app()`. The resulting app exposes a single POST endpoint that streams [AG-UI](https://docs.ag-ui.com/) events over Server-Sent Events (SSE), as well as `/ping` for the AgentCore runtime health check.
|
|
@@ -364,7 +364,7 @@ For **HTTP** agents, the generator also emits:
|
|
|
364
364
|
|
|
365
365
|
When you customize the agent's input shape (e.g. add new fields to `InvokeInput`), update `chat.ts` to pass the new fields when invoking the agent and the rest works automatically.
|
|
366
366
|
|
|
367
|
-
<OptionFilter when={{
|
|
367
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
368
368
|
## Deploying Your Agent to Bedrock AgentCore Runtime
|
|
369
369
|
|
|
370
370
|
<Snippet name="agent/bedrock-deployment" parentHeading="Deploying Your Agent to Bedrock AgentCore Runtime" />
|
|
@@ -389,7 +389,7 @@ For more details, refer to the [AgentCore documentation on observability](https:
|
|
|
389
389
|
|
|
390
390
|
## Invoking your Agent
|
|
391
391
|
|
|
392
|
-
<OptionFilter when={{ protocol: '
|
|
392
|
+
<OptionFilter when={{ protocol: 'http' }} description="FastAPI HTTP invocation details">
|
|
393
393
|
### Invoke the Local Server
|
|
394
394
|
|
|
395
395
|
To invoke an Agent running locally via the `<your-agent-name>-serve` target, you can send a simple POST request to `/invocations` on the port your local agent is running on. For example, with `curl`:
|
|
@@ -409,7 +409,7 @@ The `-N` argument given to `curl` disables buffering the output stream, so you c
|
|
|
409
409
|
<Snippet name="agent/runtime-arn" parentHeading="Invoke the Deployed Agent" />
|
|
410
410
|
|
|
411
411
|
<Tabs syncKey="auth">
|
|
412
|
-
<TabItem label="IAM" _filter={{ auth: '
|
|
412
|
+
<TabItem label="IAM" _filter={{ auth: 'iam' }}>
|
|
413
413
|
#### IAM Authentication
|
|
414
414
|
|
|
415
415
|
For IAM Authentication, the request must be signed using AWS Signature Version 4 (SigV4).
|
|
@@ -426,7 +426,7 @@ acurl <region> bedrock-agentcore -N -X POST \
|
|
|
426
426
|
</Drawer>
|
|
427
427
|
</TabItem>
|
|
428
428
|
|
|
429
|
-
<TabItem label="Cognito" _filter={{ auth: '
|
|
429
|
+
<TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
|
|
430
430
|
#### JWT / Cognito Authentication
|
|
431
431
|
|
|
432
432
|
For Cognito Authentication, pass the Cognito Access Token in the `Authorization` header:
|
|
@@ -462,7 +462,7 @@ For invoking your Agent from a React website, you can make use of the <Link path
|
|
|
462
462
|
Refer to the <Link path="/guides/connection/react-py-agent">`connection` generator guide</Link> for details about how the connection is set up.
|
|
463
463
|
</OptionFilter>
|
|
464
464
|
|
|
465
|
-
<OptionFilter when={{ protocol: '
|
|
465
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A delegation details">
|
|
466
466
|
### Invoking an A2A Agent as a Tool
|
|
467
467
|
|
|
468
468
|
To delegate work from this agent to a remote A2A agent (either <Link path="/guides/ts-agent">TypeScript</Link> or <Link path="/guides/py-agent">Python</Link>), use the <Link path="/guides/connection/py-agent-a2a">`connection` generator</Link>. It vends a SigV4-authenticated client for the target agent and AST-transforms this agent's `agent.py` to register the remote A2A agent as a `@tool`-decorated delegate.
|
|
@@ -472,7 +472,7 @@ To delegate work from this agent to a remote A2A agent (either <Link path="/guid
|
|
|
472
472
|
Refer to the <Link path="/guides/connection/py-agent-a2a">`connection` generator guide</Link> for details about how the connection is set up.
|
|
473
473
|
</OptionFilter>
|
|
474
474
|
|
|
475
|
-
<OptionFilter when={{ protocol: '
|
|
475
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / React connection details">
|
|
476
476
|
### Invoking an AG-UI Agent
|
|
477
477
|
|
|
478
478
|
To invoke your AG-UI agent from a React website, use the <Link path="/guides/connection/react-agui">`connection` generator</Link>, which wires up a [CopilotKit](https://docs.copilotkit.ai/aws-strands) client configured for your deployed agent with the correct authentication (IAM or Cognito).
|
|
@@ -49,21 +49,21 @@ The generator will add the following files to your existing Python project:
|
|
|
49
49
|
- server.py Main server definition with sample tools and resources
|
|
50
50
|
- stdio.py Entry point for STDIO transport, useful for simple local MCP servers
|
|
51
51
|
- http.py Entry point for Streamable HTTP transport, useful for hosting your MCP server
|
|
52
|
-
- Dockerfile Entry point for hosting your MCP server (excluded when `
|
|
52
|
+
- Dockerfile Entry point for hosting your MCP server (excluded when `infra` is set to `None`)
|
|
53
53
|
- pyproject.toml Updated with MCP dependencies
|
|
54
54
|
- project.json Updated with MCP server serve targets
|
|
55
55
|
</FileTree>
|
|
56
56
|
|
|
57
57
|
### Infrastructure
|
|
58
58
|
|
|
59
|
-
<OptionFilter when={{
|
|
59
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
|
|
60
60
|
<Snippet name="shared-constructs" />
|
|
61
61
|
|
|
62
62
|
<Snippet name="mcp/shared-constructs" />
|
|
63
63
|
</OptionFilter>
|
|
64
64
|
|
|
65
|
-
<OptionFilter when={{
|
|
66
|
-
If you selected `
|
|
65
|
+
<OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
|
|
66
|
+
If you selected `none` for `infra`, no CDK constructs or Terraform modules are generated — the MCP server is configured for local STDIO / HTTP use only. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
|
|
67
67
|
</OptionFilter>
|
|
68
68
|
|
|
69
69
|
#### Architecture
|
|
@@ -117,12 +117,16 @@ def dynamic_resource(item_id: str) -> str:
|
|
|
117
117
|
|
|
118
118
|
### Inspector
|
|
119
119
|
|
|
120
|
-
The generator configures a target named `<your-server-name>-inspect`, which starts the [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
|
|
120
|
+
The generator configures a target named `<your-server-name>-inspect`, which starts your MCP server locally (via the `<your-server-name>-serve-local` target, including any connected dependencies such as a local database) and launches the [MCP Inspector](https://github.com/modelcontextprotocol/inspector) pre-configured to connect to it over Streamable HTTP transport.
|
|
121
121
|
|
|
122
122
|
<NxCommands commands={['your-server-name-inspect your-project']} />
|
|
123
123
|
|
|
124
124
|
This will start the inspector at `http://localhost:6274`. Get started by clicking on the "Connect" button.
|
|
125
125
|
|
|
126
|
+
:::tip
|
|
127
|
+
To inspect the server using STDIO transport instead, use the `<your-server-name>-inspect-stdio` target, which launches the inspector against a STDIO instance of your server.
|
|
128
|
+
:::
|
|
129
|
+
|
|
126
130
|
### STDIO
|
|
127
131
|
|
|
128
132
|
The easiest way to test and use an MCP server is by using the inspector or configuring it with an AI assistant (as above).
|
|
@@ -141,7 +145,7 @@ If you would like to run your MCP server locally using [Streamable HTTP transpor
|
|
|
141
145
|
|
|
142
146
|
This command uses `uv run uvicorn --reload` to run your MCP server with HTTP transport (typically on port `8000`), and automatically restarts when files change.
|
|
143
147
|
|
|
144
|
-
<OptionFilter when={{
|
|
148
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
145
149
|
## Deploying Your MCP Server to Bedrock AgentCore Runtime
|
|
146
150
|
|
|
147
151
|
<Snippet name="mcp/bedrock-deployment" parentHeading="Deploying Your MCP Server to Bedrock AgentCore Runtime" />
|
|
@@ -163,8 +163,8 @@ Default metrics include:
|
|
|
163
163
|
|
|
164
164
|
### Type Safety
|
|
165
165
|
|
|
166
|
-
<OptionFilter not when={{
|
|
167
|
-
If you chose an `
|
|
166
|
+
<OptionFilter not when={{ event: 'Any' }} description="Typed event wires @event_parser with a Pydantic model">
|
|
167
|
+
If you chose an `event` when generating your lambda function, your function is instrumented with [`@event_parser` from AWS Lambda Powertools](https://docs.powertools.aws.dev/lambda/python/latest/utilities/parser/). For example:
|
|
168
168
|
|
|
169
169
|
```python {3}
|
|
170
170
|
@event_parser(model=EventBridgeModel)
|
|
@@ -179,8 +179,8 @@ If you have custom data nested within an event, for example a DynamoDB stream or
|
|
|
179
179
|
:::
|
|
180
180
|
</OptionFilter>
|
|
181
181
|
|
|
182
|
-
<OptionFilter when={{
|
|
183
|
-
If you selected `Any` for your `
|
|
182
|
+
<OptionFilter when={{ event: 'Any' }} description="event=Any — no parser decorator, event is untyped">
|
|
183
|
+
If you selected `Any` for your `event`, the `@event_parser` decorator is not applied and the handler receives an untyped event dict. Regenerate with a specific `event` if you want Pydantic validation and typed field access.
|
|
184
184
|
</OptionFilter>
|
|
185
185
|
|
|
186
186
|
## Bundling
|
|
@@ -152,6 +152,21 @@ The user identity module automatically adds the necessary <Link path="guides/rea
|
|
|
152
152
|
</Fragment>
|
|
153
153
|
</Infrastructure>
|
|
154
154
|
|
|
155
|
+
:::caution[Remove localhost callback URLs for production]
|
|
156
|
+
The generated User Pool client allows your CloudFront distribution URL as an OAuth callback/logout URL, plus `http://localhost:4200` and `http://localhost:4300` for local development against the deployed pool.
|
|
157
|
+
|
|
158
|
+
It is recommended to **remove the `http://localhost` callback/logout URLs for production stages**, keeping the allowlist limited to your real application origins.
|
|
159
|
+
|
|
160
|
+
<Infrastructure>
|
|
161
|
+
<Fragment slot="cdk">
|
|
162
|
+
Edit the callback/logout URLs in `packages/common/constructs/src/core/user-identity.ts`.
|
|
163
|
+
</Fragment>
|
|
164
|
+
<Fragment slot="terraform">
|
|
165
|
+
Edit the `callback_urls`/`logout_urls` in `packages/common/terraform/src/core/user-identity/identity/identity.tf`.
|
|
166
|
+
</Fragment>
|
|
167
|
+
</Infrastructure>
|
|
168
|
+
:::
|
|
169
|
+
|
|
155
170
|
### Granting Access to Authenticated Users
|
|
156
171
|
|
|
157
172
|
In order to grant authenticated users access to perform certain actions, such as granting permissions to invoke an API, you can add IAM policy statements to the identity pool authenticated role:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: React Website
|
|
3
3
|
description: Reference documentation for a React Website
|
|
4
|
-
generator: ts#
|
|
4
|
+
generator: ts#website
|
|
5
5
|
when:
|
|
6
6
|
framework:
|
|
7
7
|
- react
|
|
@@ -30,7 +30,7 @@ The default `uxProvider` is [Cloudscape](http://cloudscape.design/). You can als
|
|
|
30
30
|
|
|
31
31
|
You can generate a new React Website in two ways:
|
|
32
32
|
|
|
33
|
-
<RunGenerator generator="ts#website" />
|
|
33
|
+
<RunGenerator generator="ts#website" requiredParameters={{ framework: 'react' }} />
|
|
34
34
|
|
|
35
35
|
### Options
|
|
36
36
|
|
|
@@ -126,15 +126,21 @@ waf -> cloudfront
|
|
|
126
126
|
cloudfront -> s3
|
|
127
127
|
```
|
|
128
128
|
|
|
129
|
+
#### Security Headers
|
|
130
|
+
|
|
131
|
+
The CloudFront distribution applies a response headers policy that sets `Strict-Transport-Security`, `X-Content-Type-Options`, `X-Frame-Options: DENY` and `Referrer-Policy` on all responses. A `Content-Security-Policy` is intentionally not set by default, since a useful CSP is specific to your application - add one to the response headers policy (CDK) or `aws_cloudfront_response_headers_policy` resource (Terraform) once you know which origins, scripts and styles your site loads.
|
|
132
|
+
|
|
133
|
+
`runtime-config.json` is served with `Cache-Control: no-cache` so that browsers always fetch the latest configuration after a redeploy, rather than using a stale cached copy.
|
|
134
|
+
|
|
129
135
|
## Implementing your React Website
|
|
130
136
|
|
|
131
137
|
The [React documentation](https://react.dev/learn) is a good place to start to learn the basics of building with React.
|
|
132
138
|
|
|
133
|
-
<OptionFilter when={{
|
|
139
|
+
<OptionFilter when={{ ux: 'cloudscape' }} description="Cloudscape component docs pointer">
|
|
134
140
|
You can refer to the [Cloudscape documentation](https://cloudscape.design/components/) for details about the available components and how to use them.
|
|
135
141
|
</OptionFilter>
|
|
136
142
|
|
|
137
|
-
<OptionFilter when={{
|
|
143
|
+
<OptionFilter when={{ ux: 'shadcn' }} description="Shadcn component docs pointer">
|
|
138
144
|
You can refer to the [shadcn/ui documentation](https://ui.shadcn.com/docs) for details about the available components and how to use them.
|
|
139
145
|
</OptionFilter>
|
|
140
146
|
|
|
@@ -185,7 +191,7 @@ Configuration from your infrastructure is provided to your website via <Link hre
|
|
|
185
191
|
|
|
186
192
|
<Infrastructure>
|
|
187
193
|
<Fragment slot="cdk">
|
|
188
|
-
The `RuntimeConfig` CDK construct can be used to add and retrieve configuration in your CDK infrastructure. The CDK constructs generated by `@aws/nx-plugin` generators (such as <Link path="guides/trpc">`ts#
|
|
194
|
+
The `RuntimeConfig` CDK construct can be used to add and retrieve configuration in your CDK infrastructure. The CDK constructs generated by `@aws/nx-plugin` generators (such as <Link path="guides/trpc">`ts#api`</Link> and <Link path="guides/fastapi">`py#api`</Link>) will automatically add appropriate values to the `RuntimeConfig`.
|
|
189
195
|
|
|
190
196
|
Your website CDK construct will deploy the `connection` namespace of the runtime configuration as a `runtime-config.json` file to the root of your S3 bucket.
|
|
191
197
|
|
|
@@ -214,7 +220,7 @@ With CDK, the website construct can be declared at any point in your stack. Runt
|
|
|
214
220
|
:::
|
|
215
221
|
</Fragment>
|
|
216
222
|
<Fragment slot="terraform">
|
|
217
|
-
With Terraform, runtime configuration is managed through the runtime-config modules. The Terraform modules generated by `@aws/nx-plugin` generators (such as <Link path="guides/trpc">`ts#
|
|
223
|
+
With Terraform, runtime configuration is managed through the runtime-config modules. The Terraform modules generated by `@aws/nx-plugin` generators (such as <Link path="guides/trpc">`ts#api`</Link> and <Link path="guides/fastapi">`py#api`</Link>) will automatically add appropriate values to the runtime configuration.
|
|
218
224
|
|
|
219
225
|
Your website Terraform module will deploy the `connection` namespace of the runtime configuration as a `runtime-config.json` file to the root of your S3 bucket.
|
|
220
226
|
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: tRPC
|
|
3
3
|
description: Reference documentation for tRPC
|
|
4
|
-
generator: ts#
|
|
4
|
+
generator: ts#api
|
|
5
5
|
when:
|
|
6
6
|
framework: [trpc]
|
|
7
|
+
infra: [rest-lambda, http-lambda]
|
|
7
8
|
---
|
|
8
9
|
import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
9
10
|
import Link from '@components/link.astro';
|
|
@@ -24,16 +25,16 @@ The tRPC API generator creates a new tRPC API with AWS CDK or Terraform infrastr
|
|
|
24
25
|
|
|
25
26
|
You can generate a new tRPC API in two ways:
|
|
26
27
|
|
|
27
|
-
<RunGenerator generator="ts#
|
|
28
|
+
<RunGenerator generator="ts#api" requiredParameters={{ framework: 'trpc' }} />
|
|
28
29
|
|
|
29
30
|
### Options
|
|
30
31
|
|
|
31
|
-
<GeneratorParameters generator="ts#
|
|
32
|
+
<GeneratorParameters generator="ts#api" />
|
|
32
33
|
|
|
33
34
|
<Snippet name="api/api-choice-note" />
|
|
34
35
|
|
|
35
36
|
:::tip[API Type]
|
|
36
|
-
Select `
|
|
37
|
+
Select `rest-lambda` (default) as your `infra` if you would like to use [tRPC Subscriptions](https://trpc.io/docs/server/subscriptions) to stream responses.
|
|
37
38
|
:::
|
|
38
39
|
|
|
39
40
|
:::tip[Integration Pattern]
|
|
@@ -151,10 +152,10 @@ The use of `query` to define the implementation indicates that the operation is
|
|
|
151
152
|
|
|
152
153
|
If you add a new procedure, make sure you register it by adding it to the router in `src/router.ts`.
|
|
153
154
|
|
|
154
|
-
<OptionFilter when={{
|
|
155
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Streaming subscriptions — REST API only, uses SSE">
|
|
155
156
|
### Subscriptions (Streaming)
|
|
156
157
|
|
|
157
|
-
tRPC subscriptions allow you to stream data from the server to the client using [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). When you select `
|
|
158
|
+
tRPC subscriptions allow you to stream data from the server to the client using [Server-Sent Events (SSE)](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events). When you select `rest-lambda` as your compute type, the generator automatically configures the infrastructure required for streaming, as well as a streaming Lambda handler and the `ZodAsyncIterable` schema helper.
|
|
158
159
|
|
|
159
160
|
To define a subscription procedure, use the `.subscription` method with an async generator function. Use the `ZodAsyncIterable` helper from `src/schema/z-async-iterable.ts` to define the output schema:
|
|
160
161
|
|
|
@@ -290,7 +291,7 @@ You can add additional values to the context provided to procedures by implement
|
|
|
290
291
|
|
|
291
292
|
As an example, let's implement some middlware to extract some details about the calling user from our API in `src/middleware/identity.ts`.
|
|
292
293
|
|
|
293
|
-
<OptionFilter when={{ auth: '
|
|
294
|
+
<OptionFilter when={{ auth: 'iam' }} description="Identity middleware example for IAM-authenticated APIs">
|
|
294
295
|
This example walks through identity middleware for `IAM` authentication. We look up the caller in Cognito using the sub extracted from the API Gateway event.
|
|
295
296
|
|
|
296
297
|
First, we define what we'll add to the context:
|
|
@@ -326,7 +327,7 @@ export const createIdentityPlugin = () => {
|
|
|
326
327
|
In our case, we want to extract details about the calling Cognito user. We'll do that by extracting the user's subject ID (or "sub") from the API Gateway event, and retrieving user details from Cognito. The implementation varies depending on whether the event was provided to our function by a REST API or an HTTP API:
|
|
327
328
|
|
|
328
329
|
<Tabs syncKey="http-rest">
|
|
329
|
-
<TabItem label="REST API" _filter={{
|
|
330
|
+
<TabItem label="REST API" _filter={{ infra: 'rest-lambda' }}>
|
|
330
331
|
```ts
|
|
331
332
|
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
332
333
|
import { initTRPC, TRPCError } from '@trpc/server';
|
|
@@ -389,7 +390,7 @@ export const createIdentityPlugin = () => {
|
|
|
389
390
|
};
|
|
390
391
|
```
|
|
391
392
|
</TabItem>
|
|
392
|
-
<TabItem label="HTTP API" _filter={{
|
|
393
|
+
<TabItem label="HTTP API" _filter={{ infra: 'http-lambda' }}>
|
|
393
394
|
```ts
|
|
394
395
|
import { CognitoIdentityProvider } from '@aws-sdk/client-cognito-identity-provider';
|
|
395
396
|
import { initTRPC, TRPCError } from '@trpc/server';
|
|
@@ -461,8 +462,8 @@ export const createIdentityPlugin = () => {
|
|
|
461
462
|
</Tabs>
|
|
462
463
|
</OptionFilter>
|
|
463
464
|
|
|
464
|
-
<OptionFilter when={{ auth: '
|
|
465
|
-
When you deploy with `auth: '
|
|
465
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Identity middleware example for Cognito-authenticated APIs">
|
|
466
|
+
When you deploy with `auth: 'cognito'`, the API Gateway Cognito User Pools authorizer verifies the JWT that the caller supplies in the `Authorization` header and places the verified claims on the Lambda event at `event.requestContext.authorizer.claims`. Our middleware just reads those claims — no extra AWS SDK calls, no manual JWT verification.
|
|
466
467
|
|
|
467
468
|
First, we define what we'll add to the context:
|
|
468
469
|
|
|
@@ -553,7 +554,7 @@ The tRPC API generator creates CDK or Terraform infrastructure as code based on
|
|
|
553
554
|
<Fragment slot="cdk">
|
|
554
555
|
The CDK construct for deploying your API lives in the `common/constructs` folder. You can consume this in a CDK application, for example:
|
|
555
556
|
|
|
556
|
-
<OptionFilter when={{ auth: ['
|
|
557
|
+
<OptionFilter when={{ auth: ['iam', 'custom'] }} description="CDK usage for IAM or Custom authentication">
|
|
557
558
|
```ts {6-8}
|
|
558
559
|
import { MyApi } from ':my-scope/common-constructs';
|
|
559
560
|
|
|
@@ -572,7 +573,7 @@ When using `Custom` auth, the construct creates a Lambda Authorizer internally f
|
|
|
572
573
|
:::
|
|
573
574
|
</OptionFilter>
|
|
574
575
|
|
|
575
|
-
<OptionFilter when={{ auth: '
|
|
576
|
+
<OptionFilter when={{ auth: 'cognito' }} description="CDK usage with Cognito authentication — pass the identity construct">
|
|
576
577
|
```ts {6,9}
|
|
577
578
|
import { MyApi, UserIdentity } from ':my-scope/common-constructs';
|
|
578
579
|
|
|
@@ -601,7 +602,7 @@ The Terraform modules for deploying your API are in the `common/terraform` folde
|
|
|
601
602
|
|
|
602
603
|
The API module stages its Lambda deployment zip in a shared S3 asset bucket — see the <Link path="/guides/terraform-project">Terraform infrastructure guide</Link> for details. Instantiate the `core/asset-bucket` module once per deployment and pass its `bucket_name` output into every API / Lambda module via the `asset_bucket_name` input:
|
|
603
604
|
|
|
604
|
-
<OptionFilter when={{ auth: ['
|
|
605
|
+
<OptionFilter when={{ auth: ['iam', 'custom'] }} description="Terraform usage for IAM or Custom authentication">
|
|
605
606
|
```hcl {1-3, 8}
|
|
606
607
|
module "asset_bucket" {
|
|
607
608
|
source = "../../common/terraform/src/core/asset-bucket"
|
|
@@ -628,7 +629,7 @@ module "my_api" {
|
|
|
628
629
|
```
|
|
629
630
|
</OptionFilter>
|
|
630
631
|
|
|
631
|
-
<OptionFilter when={{ auth: '
|
|
632
|
+
<OptionFilter when={{ auth: 'cognito' }} description="Terraform usage with Cognito authentication — supply user pool and client">
|
|
632
633
|
```hcl {1-3, 8-9}
|
|
633
634
|
module "asset_bucket" {
|
|
634
635
|
source = "../../common/terraform/src/core/asset-bucket"
|
|
@@ -711,7 +712,7 @@ module "my_api" {
|
|
|
711
712
|
}
|
|
712
713
|
```
|
|
713
714
|
|
|
714
|
-
<OptionFilter when={{ auth: '
|
|
715
|
+
<OptionFilter when={{ auth: 'custom' }} description="Custom Lambda Authorizer usage with Terraform">
|
|
715
716
|
:::caution[Custom Lambda Authorizer]
|
|
716
717
|
When using `Custom` auth, your API is protected by a Lambda Authorizer that **denies all requests by default**. You must implement your authorization logic in the generated `src/authorizer.ts` file before your API will accept any traffic.
|
|
717
718
|
:::
|
|
@@ -719,7 +720,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
719
720
|
</Fragment>
|
|
720
721
|
</Infrastructure>
|
|
721
722
|
|
|
722
|
-
<OptionFilter when={{
|
|
723
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="WAF — REST APIs get a WAF Web ACL by default">
|
|
723
724
|
### WAF
|
|
724
725
|
|
|
725
726
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
@@ -733,7 +734,7 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
733
734
|
If you selected CDK for your `iacProvider`, when you add or remove a procedure in your tRPC API, these changes will be reflected immediately in the CDK construct without the need to rebuild.
|
|
734
735
|
:::
|
|
735
736
|
|
|
736
|
-
<OptionFilter when={{ auth: '
|
|
737
|
+
<OptionFilter when={{ auth: 'iam' }} description="Granting API invoke access — IAM-authenticated APIs only">
|
|
737
738
|
### Granting Access (IAM Only)
|
|
738
739
|
|
|
739
740
|
You can grant access to your API as follows:
|
package/docs/guides/ts-agent.mdx
CHANGED
|
@@ -47,7 +47,7 @@ First use the <Link path="/guides/typescript-project">`ts#project`</Link> genera
|
|
|
47
47
|
|
|
48
48
|
The generator will add the following files to your existing TypeScript project. The files generated depend on the chosen `protocol`:
|
|
49
49
|
|
|
50
|
-
<OptionFilter when={{ protocol: '
|
|
50
|
+
<OptionFilter when={{ protocol: 'http' }} description="tRPC-over-WebSocket layout">
|
|
51
51
|
### HTTP Protocol (default)
|
|
52
52
|
|
|
53
53
|
<FileTree>
|
|
@@ -60,13 +60,13 @@ The generator will add the following files to your existing TypeScript project.
|
|
|
60
60
|
- agent.ts Main agent definition with sample tools
|
|
61
61
|
- client.ts Vended client for invoking your agent
|
|
62
62
|
- agent-core-trpc-client.ts Client factory for connecting to agents on AgentCore Runtime
|
|
63
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
63
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
64
64
|
- package.json Updated with Strands dependencies
|
|
65
65
|
- project.json Updated with agent serve targets
|
|
66
66
|
</FileTree>
|
|
67
67
|
</OptionFilter>
|
|
68
68
|
|
|
69
|
-
<OptionFilter when={{ protocol: '
|
|
69
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="Strands A2A Express server layout">
|
|
70
70
|
### A2A Protocol
|
|
71
71
|
|
|
72
72
|
The entry point uses the [Strands A2A Express Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) instead of tRPC:
|
|
@@ -77,13 +77,13 @@ The entry point uses the [Strands A2A Express Server](https://strandsagents.com/
|
|
|
77
77
|
- agent/ (or custom name if specified)
|
|
78
78
|
- index.ts A2A Express server entry point
|
|
79
79
|
- agent.ts Main agent definition with sample tools
|
|
80
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
80
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
81
81
|
- package.json Updated with Strands and Express dependencies
|
|
82
82
|
- project.json Updated with agent serve targets
|
|
83
83
|
</FileTree>
|
|
84
84
|
</OptionFilter>
|
|
85
85
|
|
|
86
|
-
<OptionFilter when={{ protocol: '
|
|
86
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI SSE-over-POST server layout">
|
|
87
87
|
### AG-UI Protocol
|
|
88
88
|
|
|
89
89
|
The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui/aws-strands) to expose the agent via the [AG-UI protocol](https://docs.ag-ui.com/) (SSE over POST), compatible with [CopilotKit](https://docs.copilotkit.ai/aws-strands):
|
|
@@ -94,7 +94,7 @@ The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui
|
|
|
94
94
|
- agent/ (or custom name if specified)
|
|
95
95
|
- index.ts AG-UI server entry point (Express + SSE)
|
|
96
96
|
- agent.ts Main agent definition with sample tools
|
|
97
|
-
- Dockerfile Entry point for hosting your agent (excluded when `
|
|
97
|
+
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
98
98
|
- package.json Updated with Strands and AG-UI dependencies
|
|
99
99
|
- project.json Updated with agent serve targets
|
|
100
100
|
</FileTree>
|
|
@@ -102,7 +102,7 @@ The entry point uses [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui
|
|
|
102
102
|
|
|
103
103
|
### Infrastructure
|
|
104
104
|
|
|
105
|
-
<OptionFilter when={{
|
|
105
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment">
|
|
106
106
|
<Snippet name="shared-constructs" />
|
|
107
107
|
|
|
108
108
|
For deploying your Agent, the following files are generated:
|
|
@@ -132,8 +132,8 @@ For deploying your Agent, the following files are generated:
|
|
|
132
132
|
</Infrastructure>
|
|
133
133
|
</OptionFilter>
|
|
134
134
|
|
|
135
|
-
<OptionFilter when={{
|
|
136
|
-
If you selected `
|
|
135
|
+
<OptionFilter when={{ infra: 'none' }} description="No infrastructure is vended for infra=none">
|
|
136
|
+
If you selected `none` for `infra`, no CDK constructs or Terraform modules are generated — the Agent can only be run locally. The `auth` option is ignored in this mode since there is no hosted endpoint to authenticate.
|
|
137
137
|
</OptionFilter>
|
|
138
138
|
|
|
139
139
|
#### Architecture
|
|
@@ -152,7 +152,7 @@ Your agent's server protocol determines how it communicates. You can choose betw
|
|
|
152
152
|
|
|
153
153
|
The protocol is set in the CDK/Terraform infrastructure, and the application code is generated accordingly.
|
|
154
154
|
|
|
155
|
-
<OptionFilter when={{ protocol: '
|
|
155
|
+
<OptionFilter when={{ protocol: 'http' }} description="tRPC over WebSocket details">
|
|
156
156
|
### tRPC over WebSocket (HTTP protocol)
|
|
157
157
|
|
|
158
158
|
The TypeScript Agent uses [tRPC](https://trpc.io/) over WebSocket, leveraging [AgentCore's bidirectional streaming support](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-websocket.html) to enable real-time, type-safe communication between clients and your agent.
|
|
@@ -239,7 +239,7 @@ For other MCP servers, please refer to the [Strands Documentation](https://stran
|
|
|
239
239
|
|
|
240
240
|
For a more in-depth guide to writing Strands agents, refer to the [Strands documentation](https://strandsagents.com/docs/user-guide/quickstart/overview/).
|
|
241
241
|
|
|
242
|
-
<OptionFilter when={{ protocol: '
|
|
242
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A Express server details">
|
|
243
243
|
## A2A Server (A2A protocol)
|
|
244
244
|
|
|
245
245
|
The generated `index.ts` mounts the [Strands A2A Express Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent) onto an Express app so the generated agent exposes the A2A protocol endpoints alongside a `/ping` health check. When deployed to AgentCore, the entry point resolves the runtime's public ARN from AppConfig and advertises it in the agent card.
|
|
@@ -247,7 +247,7 @@ The generated `index.ts` mounts the [Strands A2A Express Server](https://strands
|
|
|
247
247
|
Most users will not need to modify this file — edit `agent.ts` to change tools or the system prompt. A2A agents listen on port `9000` (vs `8080` for HTTP), which the generated Dockerfile and infrastructure are already configured for.
|
|
248
248
|
</OptionFilter>
|
|
249
249
|
|
|
250
|
-
<OptionFilter when={{ protocol: '
|
|
250
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI server details">
|
|
251
251
|
## AG-UI Server (AG-UI protocol)
|
|
252
252
|
|
|
253
253
|
The generated `index.ts` wraps your Strands `Agent` in an [`@ag-ui/aws-strands`](https://www.npmjs.com/package/@ag-ui/aws-strands) `StrandsAgent` and creates an Express app via `createStrandsApp()`. The resulting app exposes a single POST endpoint that streams [AG-UI](https://docs.ag-ui.com/) events over Server-Sent Events (SSE), as well as `/ping` for the AgentCore runtime health check.
|
|
@@ -275,7 +275,7 @@ The generator configures a `<your-agent-name>-chat` Nx target that depends on `<
|
|
|
275
275
|
|
|
276
276
|
For **HTTP** (tRPC over WebSocket) agents, the generator also emits a tiny `scripts/<your-agent-name>/chat.ts` that wraps the generated `<Agent>Client.local({ url })` so you can customize it as you evolve the agent's input shape.
|
|
277
277
|
|
|
278
|
-
<OptionFilter when={{
|
|
278
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
279
279
|
## Deploying Your Agent to Bedrock AgentCore Runtime
|
|
280
280
|
|
|
281
281
|
<Snippet name="agent/bedrock-deployment" parentHeading="Deploying Your Agent to Bedrock AgentCore Runtime" />
|
|
@@ -305,7 +305,7 @@ For more details, refer to the [AgentCore documentation on observability](https:
|
|
|
305
305
|
|
|
306
306
|
Agent communication is transmitted via tRPC over WebSocket. As such, it's recommended to use the generated type-safe client factory in `client.ts`.
|
|
307
307
|
|
|
308
|
-
<OptionFilter when={{ protocol: '
|
|
308
|
+
<OptionFilter when={{ protocol: 'http' }} description="tRPC-over-WebSocket client factory invocation details">
|
|
309
309
|
### Invoke the Local Server
|
|
310
310
|
|
|
311
311
|
You can invoke a locally running agent using the `.local` factory method from the client factory.
|
|
@@ -340,7 +340,7 @@ The client factory uses HTTP headers in the WebSocket handshake to authenticate
|
|
|
340
340
|
:::
|
|
341
341
|
|
|
342
342
|
<Tabs syncKey="auth">
|
|
343
|
-
<TabItem label="IAM" _filter={{ auth: '
|
|
343
|
+
<TabItem label="IAM" _filter={{ auth: 'iam' }}>
|
|
344
344
|
##### IAM Authentication
|
|
345
345
|
|
|
346
346
|
You can invoke your deployed agent by passing its ARN to the `withIamAuth` factory method:
|
|
@@ -364,7 +364,7 @@ This will use the default AWS credential provider chain to authenticate requests
|
|
|
364
364
|
:::
|
|
365
365
|
</TabItem>
|
|
366
366
|
|
|
367
|
-
<TabItem label="Cognito" _filter={{ auth: '
|
|
367
|
+
<TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
|
|
368
368
|
##### JWT / Cognito Authentication
|
|
369
369
|
|
|
370
370
|
Use the `withJwtAuth` factory method to authenticate with the JWT / Cognito access token.
|
|
@@ -415,7 +415,7 @@ For invoking your Agent from a React website, you can make use of the <Link path
|
|
|
415
415
|
Refer to the <Link path="/guides/connection/react-ts-agent">`connection` generator guide</Link> for details about how the connection is set up.
|
|
416
416
|
</OptionFilter>
|
|
417
417
|
|
|
418
|
-
<OptionFilter when={{ protocol: '
|
|
418
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A delegation details">
|
|
419
419
|
### Invoking an A2A Agent as a Tool
|
|
420
420
|
|
|
421
421
|
To delegate work from this agent to a remote A2A agent (either <Link path="/guides/ts-agent">TypeScript</Link> or <Link path="/guides/py-agent">Python</Link>), use the <Link path="/guides/connection/ts-agent-a2a">`connection` generator</Link>. It vends a SigV4-authenticated client for the target agent and AST-transforms this agent's `agent.ts` to register the remote A2A agent as a Strands `tool`.
|
|
@@ -425,7 +425,7 @@ To delegate work from this agent to a remote A2A agent (either <Link path="/guid
|
|
|
425
425
|
Refer to the <Link path="/guides/connection/ts-agent-a2a">`connection` generator guide</Link> for details about how the connection is set up.
|
|
426
426
|
</OptionFilter>
|
|
427
427
|
|
|
428
|
-
<OptionFilter when={{ protocol: '
|
|
428
|
+
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / React connection details">
|
|
429
429
|
### Invoking an AG-UI Agent
|
|
430
430
|
|
|
431
431
|
To invoke your AG-UI agent from a React website, use the <Link path="/guides/connection/react-agui">`connection` generator</Link>, which wires up a [CopilotKit](https://docs.copilotkit.ai/aws-strands) client configured for your deployed agent with the correct authentication (IAM or Cognito).
|