@aws/nx-plugin-mcp 1.0.0-rc.4 → 1.0.0-rc.41
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 +2240 -1030
- package/docs/get_started/building-with-ai.mdx +116 -0
- package/docs/get_started/concepts.mdx +52 -0
- package/docs/get_started/existing-project.mdx +176 -0
- package/docs/get_started/quick-start.mdx +266 -0
- package/docs/get_started/tutorials/contribute-generator.mdx +405 -0
- package/docs/get_started/tutorials/dungeon-game/1.mdx +1205 -0
- package/docs/get_started/tutorials/dungeon-game/2.mdx +237 -0
- package/docs/get_started/tutorials/dungeon-game/3.mdx +76 -0
- package/docs/get_started/tutorials/dungeon-game/4.mdx +162 -0
- package/docs/get_started/tutorials/dungeon-game/overview.mdx +144 -0
- package/docs/get_started/tutorials/dungeon-game/wrap-up.mdx +41 -0
- package/docs/get_started/tutorials/existing-project.mdx +4 -0
- package/docs/guides/agentcore-gateway.mdx +376 -0
- package/docs/guides/connection/agentcore-gateway-gateway.mdx +154 -0
- package/docs/guides/connection/agentcore-gateway-mcp.mdx +134 -0
- package/docs/guides/connection/py-agent-a2a.mdx +47 -15
- package/docs/guides/connection/py-agent-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-agent-gateway.mdx +176 -0
- package/docs/guides/connection/py-agent-mcp.mdx +42 -13
- package/docs/guides/connection/py-agent-rdb.mdx +178 -0
- package/docs/guides/connection/py-fast-api-dynamodb.mdx +56 -0
- package/docs/guides/connection/py-fast-api-rdb.mdx +184 -0
- package/docs/guides/connection/py-mcp-server-dynamodb.mdx +116 -0
- package/docs/guides/connection/py-mcp-server-rdb.mdx +187 -0
- package/docs/guides/connection/react-agui.mdx +4 -4
- package/docs/guides/connection/react-fastapi.mdx +38 -2
- package/docs/guides/connection/react-py-agent.mdx +7 -13
- package/docs/guides/connection/react-smithy.mdx +3 -3
- package/docs/guides/connection/react-trpc.mdx +1 -1
- package/docs/guides/connection/react-ts-agent.mdx +8 -8
- package/docs/guides/connection/smithy-dynamodb.mdx +4 -4
- package/docs/guides/connection/smithy-rdb.mdx +5 -5
- package/docs/guides/connection/trpc-dynamodb.mdx +4 -4
- package/docs/guides/connection/trpc-rdb.mdx +5 -5
- package/docs/guides/connection/ts-agent-a2a.mdx +12 -9
- package/docs/guides/connection/ts-agent-dynamodb.mdx +3 -3
- package/docs/guides/connection/ts-agent-gateway.mdx +141 -0
- package/docs/guides/connection/ts-agent-mcp.mdx +11 -8
- package/docs/guides/connection/ts-agent-rdb.mdx +66 -21
- package/docs/guides/connection/ts-mcp-server-dynamodb.mdx +3 -3
- package/docs/guides/connection/ts-mcp-server-rdb.mdx +66 -16
- package/docs/guides/connection.mdx +104 -5
- package/docs/guides/docker-bundling.mdx +68 -8
- package/docs/guides/fastapi.mdx +244 -4
- package/docs/guides/license.mdx +264 -109
- package/docs/guides/local-development.mdx +87 -0
- package/docs/guides/nx-generator.mdx +7 -2
- package/docs/guides/py-agent.mdx +257 -49
- package/docs/guides/py-dynamodb.mdx +476 -0
- package/docs/guides/py-mcp-server.mdx +61 -2
- package/docs/guides/py-rdb.mdx +254 -0
- package/docs/guides/react-website-auth.mdx +58 -1
- package/docs/guides/react-website.mdx +130 -19
- package/docs/guides/security.mdx +75 -0
- package/docs/guides/terraform-project.mdx +1 -1
- package/docs/guides/trpc.mdx +45 -9
- package/docs/guides/ts-agent.mdx +149 -9
- package/docs/guides/ts-dynamodb.mdx +62 -239
- package/docs/guides/ts-mcp-server.mdx +66 -3
- package/docs/guides/ts-nx-plugin.mdx +1 -1
- package/docs/guides/ts-rdb.mdx +117 -470
- package/docs/guides/ts-smithy-api.mdx +183 -4
- package/docs/guides/typescript-infrastructure.mdx +9 -1
- package/docs/guides/typescript-project.mdx +5 -10
- package/docs/guides/workspace.mdx +2 -2
- package/docs/snippets/agent/architecture.mdx +1 -1
- package/docs/snippets/agent/bedrock-deployment.mdx +4 -0
- package/docs/snippets/agent/runtime-arn.mdx +21 -0
- package/docs/snippets/agent/securing-your-agent.mdx +39 -0
- package/docs/snippets/api/access-logging.mdx +33 -0
- package/docs/snippets/api/type-safe-api-integrations.mdx +31 -0
- package/docs/snippets/api/waf-configuration.mdx +1 -1
- package/docs/snippets/connection/dynamodb-local-development.mdx +2 -2
- package/docs/snippets/connection/py-dynamodb-local-development.mdx +7 -0
- package/docs/snippets/connection/py-lambda-rdb-ssl-requirements.mdx +7 -0
- package/docs/snippets/connection/rdb-api-infrastructure.mdx +50 -18
- package/docs/snippets/dynamodb/deploying-table.mdx +166 -0
- package/docs/snippets/dynamodb/gsi-config.mdx +38 -0
- package/docs/snippets/dynamodb/infrastructure.mdx +33 -0
- package/docs/snippets/dynamodb/local-dev-start.mdx +13 -0
- package/docs/snippets/dynamodb/local-dev-windows.mdx +15 -0
- package/docs/snippets/mcp/architecture.mdx +1 -1
- package/docs/snippets/mcp/bedrock-deployment.mdx +4 -0
- package/docs/snippets/mcp/config.mdx +3 -2
- package/docs/snippets/rdb/architecture.mdx +38 -0
- package/docs/snippets/rdb/cluster-instances.mdx +31 -0
- package/docs/snippets/rdb/deletion-protection.mdx +34 -0
- package/docs/snippets/rdb/deploying.mdx +187 -0
- package/docs/snippets/rdb/encryption-key-rotation.mdx +30 -0
- package/docs/snippets/rdb/engine-version.mdx +63 -0
- package/docs/snippets/rdb/infrastructure.mdx +35 -0
- package/docs/snippets/rdb/logging.mdx +32 -0
- package/docs/snippets/rdb/rds-proxy.mdx +50 -0
- package/docs/snippets/rdb/removal-policy.mdx +57 -0
- package/docs/snippets/rdb/serverless-capacity.mdx +32 -0
- package/docs/snippets/required-prerequisites.mdx +1 -1
- package/docs/snippets/trivy-image-scan.mdx +27 -0
- package/generators.json +101 -2
- package/package.json +1 -1
- package/src/agentcore-gateway/gateway-connection/schema.json +31 -0
- package/src/agentcore-gateway/mcp-connection/schema.json +31 -0
- package/src/agentcore-gateway/schema.json +70 -0
- package/src/connection/schema.json +5 -0
- package/src/infra/app/schema.json +5 -0
- package/src/init/schema.json +35 -0
- package/src/license/schema.json +11 -0
- package/src/preset/schema.json +11 -5
- package/src/py/agent/a2a-connection/schema.json +5 -0
- package/src/py/agent/gateway-connection/schema.json +31 -0
- package/src/py/agent/mcp-connection/schema.json +5 -0
- package/src/py/agent/react-connection/schema.json +5 -0
- package/src/py/agent/schema.json +6 -1
- package/src/py/api/schema.json +5 -0
- package/src/py/dynamodb/agent-connection/schema.json +27 -0
- package/src/py/dynamodb/fast-api-connection/schema.json +23 -0
- package/src/py/dynamodb/mcp-server-connection/schema.json +27 -0
- package/src/py/dynamodb/schema.json +75 -0
- package/src/py/fast-api/react/schema.json +5 -0
- package/src/py/fast-api/schema.json +5 -0
- package/src/py/lambda-function/schema.json +5 -0
- package/src/py/mcp-server/schema.json +5 -0
- package/src/py/project/schema.json +5 -0
- package/src/py/rdb/agent-connection/schema.json +27 -0
- package/src/py/rdb/fast-api-connection/schema.json +23 -0
- package/src/py/rdb/mcp-server-connection/schema.json +27 -0
- package/src/py/rdb/schema.json +77 -0
- package/src/smithy/project/schema.json +5 -0
- package/src/smithy/react-connection/schema.json +5 -0
- package/src/smithy/ts/api/schema.json +5 -0
- package/src/terraform/project/schema.json +5 -0
- package/src/trpc/backend/schema.json +5 -0
- package/src/trpc/react/schema.json +5 -0
- package/src/ts/agent/a2a-connection/schema.json +5 -0
- package/src/ts/agent/gateway-connection/schema.json +31 -0
- package/src/ts/agent/mcp-connection/schema.json +5 -0
- package/src/ts/agent/react-connection/schema.json +5 -0
- package/src/ts/agent/schema.json +5 -0
- package/src/ts/api/schema.json +5 -0
- package/src/ts/astro-docs/schema.json +3 -3
- package/src/ts/docs/schema.json +3 -3
- package/src/ts/dynamodb/agent-connection/schema.json +5 -0
- package/src/ts/dynamodb/mcp-server-connection/schema.json +5 -0
- package/src/ts/dynamodb/schema.json +25 -2
- package/src/ts/dynamodb/smithy-connection/schema.json +5 -0
- package/src/ts/dynamodb/trpc-connection/schema.json +5 -0
- package/src/ts/lambda-function/schema.json +5 -0
- package/src/ts/lib/schema.json +5 -0
- package/src/ts/mcp-server/schema.json +5 -0
- package/src/ts/nx-generator/schema.json +5 -0
- package/src/ts/nx-plugin/schema.json +5 -0
- package/src/ts/rdb/agent-connection/schema.json +5 -0
- package/src/ts/rdb/mcp-server-connection/schema.json +5 -0
- package/src/ts/rdb/schema.json +6 -1
- package/src/ts/rdb/smithy-connection/schema.json +5 -0
- package/src/ts/rdb/trpc-connection/schema.json +5 -0
- package/src/ts/react-website/app/schema.json +11 -6
- package/src/ts/react-website/cognito-auth/schema.json +5 -0
- package/src/ts/react-website/runtime-config/schema.json +5 -0
- package/src/ts/website/app/schema.json +11 -6
- package/src/ts/website/auth/schema.json +5 -0
- /package/docs/snippets/connection/{lambda-rdb-ssl-requirements.mdx → ts-lambda-rdb-ssl-requirements.mdx} +0 -0
- /package/docs/snippets/connection/{mcp-server-rdb-ssl-requirements.mdx → ts-mcp-server-rdb-ssl-requirements.mdx} +0 -0
|
@@ -108,7 +108,7 @@ You can start writing your Terraform infrastructure inside `src/main.tf`, for ex
|
|
|
108
108
|
|
|
109
109
|
### Cross project dependencies
|
|
110
110
|
|
|
111
|
-
If you wanted to execute a module from a
|
|
111
|
+
If you wanted to execute a module from a separate project (lib), you could do so as follows:
|
|
112
112
|
|
|
113
113
|
```
|
|
114
114
|
module "lib_module" {
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
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
7
|
infra: [rest-lambda, http-lambda]
|
|
8
8
|
---
|
|
9
|
-
import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
9
|
+
import { FileTree, Tabs, TabItem, CardGrid } from '@astrojs/starlight/components';
|
|
10
|
+
import Astro from '@astrojs/react';
|
|
11
|
+
import ConnectionCard from '@components/connection-card.astro';
|
|
10
12
|
import Link from '@components/link.astro';
|
|
11
13
|
import RunGenerator from '@components/run-generator.astro';
|
|
12
14
|
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
@@ -25,11 +27,11 @@ The tRPC API generator creates a new tRPC API with AWS CDK or Terraform infrastr
|
|
|
25
27
|
|
|
26
28
|
You can generate a new tRPC API in two ways:
|
|
27
29
|
|
|
28
|
-
<RunGenerator generator="ts#
|
|
30
|
+
<RunGenerator generator="ts#api" requiredParameters={{ framework: 'trpc' }} />
|
|
29
31
|
|
|
30
32
|
### Options
|
|
31
33
|
|
|
32
|
-
<GeneratorParameters generator="ts#
|
|
34
|
+
<GeneratorParameters generator="ts#api" />
|
|
33
35
|
|
|
34
36
|
<Snippet name="api/api-choice-note" />
|
|
35
37
|
|
|
@@ -138,7 +140,7 @@ The example `echo` procedure is generated for you in `src/procedures/echo.ts`:
|
|
|
138
140
|
export const echo = publicProcedure
|
|
139
141
|
.input(EchoInputSchema)
|
|
140
142
|
.output(EchoOutputSchema)
|
|
141
|
-
.query((opts) => ({
|
|
143
|
+
.query((opts) => ({ message: opts.input.message }));
|
|
142
144
|
```
|
|
143
145
|
|
|
144
146
|
To break down the above:
|
|
@@ -478,7 +480,7 @@ export interface IIdentityContext {
|
|
|
478
480
|
|
|
479
481
|
Note that we define an additional _optional_ property on the context. tRPC manages ensuring that this is defined in procedures which have correctly configured this middleware.
|
|
480
482
|
|
|
481
|
-
Next, the middleware itself
|
|
483
|
+
Next, the middleware itself:
|
|
482
484
|
|
|
483
485
|
```ts
|
|
484
486
|
import { initTRPC, TRPCError } from '@trpc/server';
|
|
@@ -503,7 +505,7 @@ export const createIdentityPlugin = () => {
|
|
|
503
505
|
| undefined;
|
|
504
506
|
|
|
505
507
|
const sub = claims?.sub;
|
|
506
|
-
const username = claims?.
|
|
508
|
+
const username = claims?.username;
|
|
507
509
|
|
|
508
510
|
if (!sub || !username) {
|
|
509
511
|
throw new TRPCError({
|
|
@@ -541,8 +543,8 @@ export const me = publicProcedure
|
|
|
541
543
|
}));
|
|
542
544
|
```
|
|
543
545
|
|
|
544
|
-
:::tip[
|
|
545
|
-
You don't need `aws-jwt-verify` or any other JWT-verification library here — the API Gateway Cognito User Pools authorizer has already verified the signature, issuer,
|
|
546
|
+
:::tip[No token verification required]
|
|
547
|
+
You don't need `aws-jwt-verify` or any other JWT-verification library here — the API Gateway Cognito User Pools authorizer has already verified the signature, issuer, scopes, and expiry by the time your Lambda runs. If any of those checks fail, API Gateway returns `401 Unauthorized` and your handler is never invoked.
|
|
546
548
|
:::
|
|
547
549
|
</OptionFilter>
|
|
548
550
|
|
|
@@ -726,6 +728,12 @@ When using `Custom` auth, your API is protected by a Lambda Authorizer that **de
|
|
|
726
728
|
<Snippet name="api/waf-configuration" parentHeading="WAF" />
|
|
727
729
|
</OptionFilter>
|
|
728
730
|
|
|
731
|
+
<OptionFilter when={{ infra: 'rest-lambda' }} description="Access logging — REST APIs log requests to CloudWatch by default">
|
|
732
|
+
### Access logging
|
|
733
|
+
|
|
734
|
+
<Snippet name="api/access-logging" parentHeading="Access logging" />
|
|
735
|
+
</OptionFilter>
|
|
736
|
+
|
|
729
737
|
### Integrations
|
|
730
738
|
|
|
731
739
|
<Snippet name="api/type-safe-api-integrations" parentHeading="Integrations" />
|
|
@@ -817,3 +825,31 @@ If you are calling your API from a React website, consider using the <Link path=
|
|
|
817
825
|
## More Information
|
|
818
826
|
|
|
819
827
|
For more information about tRPC, please refer to the [tRPC documentation](https://trpc.io/docs).
|
|
828
|
+
|
|
829
|
+
## Connections
|
|
830
|
+
|
|
831
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
832
|
+
|
|
833
|
+
<CardGrid>
|
|
834
|
+
<ConnectionCard
|
|
835
|
+
title="React to tRPC"
|
|
836
|
+
description="Call a tRPC API from a React website"
|
|
837
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-trpc`}
|
|
838
|
+
source="react"
|
|
839
|
+
target="trpc"
|
|
840
|
+
/>
|
|
841
|
+
<ConnectionCard
|
|
842
|
+
title="tRPC API to Relational Database"
|
|
843
|
+
description="Connect a tRPC API to an Aurora relational database"
|
|
844
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-rdb`}
|
|
845
|
+
source="trpc"
|
|
846
|
+
target="aurora"
|
|
847
|
+
/>
|
|
848
|
+
<ConnectionCard
|
|
849
|
+
title="tRPC API to TypeScript DynamoDB"
|
|
850
|
+
description="Connect a tRPC API to a DynamoDB table"
|
|
851
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
|
|
852
|
+
source="trpc"
|
|
853
|
+
target="dynamodb"
|
|
854
|
+
/>
|
|
855
|
+
</CardGrid>
|
package/docs/guides/ts-agent.mdx
CHANGED
|
@@ -4,7 +4,9 @@ description: Generate a TypeScript Agent for building AI agents with tools and d
|
|
|
4
4
|
generator: ts#agent
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileTree, Tabs, TabItem } from '@astrojs/starlight/components';
|
|
7
|
+
import { FileTree, Tabs, TabItem, CardGrid } from '@astrojs/starlight/components';
|
|
8
|
+
import Astro from '@astrojs/react';
|
|
9
|
+
import ConnectionCard from '@components/connection-card.astro';
|
|
8
10
|
import RunGenerator from '@components/run-generator.astro';
|
|
9
11
|
import NxCommands from '@components/nx-commands.astro';
|
|
10
12
|
import Link from '@components/link.astro';
|
|
@@ -261,19 +263,61 @@ Most users will not need to modify `index.ts` — edit `agent.ts` to change tool
|
|
|
261
263
|
|
|
262
264
|
### Local Development
|
|
263
265
|
|
|
264
|
-
|
|
266
|
+
To run your Agent (and everything connected to it) locally, use the project's `dev` target:
|
|
265
267
|
|
|
266
|
-
<NxCommands commands={['
|
|
268
|
+
<NxCommands commands={['dev your-project']} />
|
|
267
269
|
|
|
268
|
-
|
|
270
|
+
If you have added multiple components to your project (agents, MCP servers, etc.), this starts them all. To run just this agent, target its `<your-agent-name>-dev` target:
|
|
271
|
+
|
|
272
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
273
|
+
|
|
274
|
+
This uses `tsx --watch` to automatically restart the server when files change. The agent will be available at `http://localhost:8081` (or the assigned port if you have multiple agents).
|
|
269
275
|
|
|
270
276
|
### Chat with Your Agent
|
|
271
277
|
|
|
272
|
-
The generator configures a `<your-agent-name>-chat` Nx target that
|
|
278
|
+
The generator configures a `<your-agent-name>-chat` Nx target that drops you into an interactive terminal chat with your agent.
|
|
279
|
+
|
|
280
|
+
The chat target runs standalone. By default it connects to your locally running agent, so start the agent's `<your-agent-name>-dev` target first (in a separate terminal):
|
|
281
|
+
|
|
282
|
+
<NxCommands commands={['agent-dev your-project']} />
|
|
283
|
+
|
|
284
|
+
Then, in another terminal, start the chat:
|
|
273
285
|
|
|
274
286
|
<NxCommands commands={['run your-project:agent-chat']} />
|
|
275
287
|
|
|
276
|
-
|
|
288
|
+
The generator emits a `scripts/<your-agent-name>/chat.ts` for every protocol. You can customize it as you evolve the agent's input shape. It connects to the local agent by default, or to your deployed agent when `RUNTIME_CONFIG_APP_ID` is set (see [Chat with your deployed agent](#chat-with-your-deployed-agent) below).
|
|
289
|
+
|
|
290
|
+
<OptionFilter when={{ infra: 'agentcore' }} description="Deployed agent chat details">
|
|
291
|
+
#### Chat with your deployed agent
|
|
292
|
+
|
|
293
|
+
To chat with your agent deployed to Bedrock AgentCore, set the `RUNTIME_CONFIG_APP_ID` environment variable to the AppConfig application id of the deployment (output as `RuntimeConfigApplicationId` by the deployed stack). The chat script resolves your agent's runtime ARN from runtime configuration and connects to the deployed endpoint:
|
|
294
|
+
|
|
295
|
+
<Tabs syncKey="auth">
|
|
296
|
+
<TabItem label="IAM" _filter={{ auth: 'iam' }}>
|
|
297
|
+
For IAM-authenticated agents, requests are signed with [SigV4](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_sigv.html) using your default AWS credentials. Ensure the environment has AWS credentials with permission to invoke the runtime:
|
|
298
|
+
|
|
299
|
+
<NxCommands commands={['run your-project:agent-chat']} env={{ RUNTIME_CONFIG_APP_ID: '<app-id>' }} />
|
|
300
|
+
</TabItem>
|
|
301
|
+
|
|
302
|
+
<TabItem label="Cognito" _filter={{ auth: 'cognito' }}>
|
|
303
|
+
For Cognito-authenticated agents, provide a Cognito access token via the `AGENT_ACCESS_TOKEN` environment variable, which is sent as a bearer token:
|
|
304
|
+
|
|
305
|
+
<NxCommands commands={['run your-project:agent-chat']} env={{ RUNTIME_CONFIG_APP_ID: '<app-id>', AGENT_ACCESS_TOKEN: '<access-token>' }} />
|
|
306
|
+
|
|
307
|
+
You can obtain an access token using the AWS CLI's `cognito-idp admin-initiate-auth` command, for example:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
aws cognito-idp admin-initiate-auth \
|
|
311
|
+
--user-pool-id <user-pool-id> \
|
|
312
|
+
--client-id <user-pool-client-id> \
|
|
313
|
+
--auth-flow ADMIN_NO_SRP_AUTH \
|
|
314
|
+
--auth-parameters USERNAME=<username>,PASSWORD=<password> \
|
|
315
|
+
--query 'AuthenticationResult.AccessToken' \
|
|
316
|
+
--output text
|
|
317
|
+
```
|
|
318
|
+
</TabItem>
|
|
319
|
+
</Tabs>
|
|
320
|
+
</OptionFilter>
|
|
277
321
|
|
|
278
322
|
<OptionFilter when={{ infra: 'agentcore' }} description="Bedrock AgentCore Runtime deployment details">
|
|
279
323
|
## Deploying Your Agent to Bedrock AgentCore Runtime
|
|
@@ -292,6 +336,10 @@ The generator configures a `<your-agent-name>-docker` target which copies the `D
|
|
|
292
336
|
|
|
293
337
|
A `docker` target is also generated which prepares the docker context for all agents if you have multiple defined.
|
|
294
338
|
|
|
339
|
+
### Image Scanning
|
|
340
|
+
|
|
341
|
+
<Snippet name="trivy-image-scan" parentHeading="Image Scanning" />
|
|
342
|
+
|
|
295
343
|
### Observability
|
|
296
344
|
|
|
297
345
|
Your agent is automatically configured with observability using the [AWS Distro for Open Telemetry](https://aws.amazon.com/otel/) (ADOT), by configuring auto-instrumentation in your `Dockerfile`.
|
|
@@ -318,7 +366,7 @@ import { AgentClient } from '../packages/<project>/src/agent/client.js';
|
|
|
318
366
|
|
|
319
367
|
const client = AgentClient.local({ url: 'http://localhost:8081/ws' });
|
|
320
368
|
|
|
321
|
-
client.invoke.subscribe({
|
|
369
|
+
client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, { onData: console.log });
|
|
322
370
|
```
|
|
323
371
|
|
|
324
372
|
:::tip[Quick Testing]
|
|
@@ -352,7 +400,7 @@ const client = AgentClient.withIamAuth({
|
|
|
352
400
|
agentRuntimeArn: 'arn:aws:bedrock-agentcore:us-west-2:123456789012:runtime/my-agent',
|
|
353
401
|
});
|
|
354
402
|
|
|
355
|
-
client.invoke.subscribe({
|
|
403
|
+
client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
|
|
356
404
|
onData: (message) => console.log(message),
|
|
357
405
|
onError: (error) => console.error(error),
|
|
358
406
|
onComplete: () => console.log('Done'),
|
|
@@ -375,7 +423,7 @@ const client = AgentClient.withJwtAuth({
|
|
|
375
423
|
accessTokenProvider: async () => `<access-token>`,
|
|
376
424
|
});
|
|
377
425
|
|
|
378
|
-
client.invoke.subscribe({
|
|
426
|
+
client.invoke.subscribe({ prompt: 'what is 1 plus 1?' }, {
|
|
379
427
|
onData: console.log,
|
|
380
428
|
});
|
|
381
429
|
```
|
|
@@ -434,3 +482,95 @@ To invoke your AG-UI agent from a React website, use the <Link path="/guides/con
|
|
|
434
482
|
|
|
435
483
|
Refer to the <Link path="/guides/connection/react-agui">`connection` generator guide</Link> for details about how the connection is set up.
|
|
436
484
|
</OptionFilter>
|
|
485
|
+
|
|
486
|
+
## Securing your Agent
|
|
487
|
+
|
|
488
|
+
<Snippet name="agent/securing-your-agent" parentHeading="Securing your Agent" />
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
// agent.ts
|
|
492
|
+
import { Agent } from '@strands-agents/sdk';
|
|
493
|
+
import { BedrockModel } from '@strands-agents/sdk/models/bedrock';
|
|
494
|
+
|
|
495
|
+
const model = new BedrockModel({
|
|
496
|
+
modelId: process.env.MODEL_ID,
|
|
497
|
+
guardrailConfig: {
|
|
498
|
+
guardrailIdentifier: process.env.GUARDRAIL_ID!,
|
|
499
|
+
guardrailVersion: process.env.GUARDRAIL_VERSION ?? 'DRAFT',
|
|
500
|
+
},
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
const agent = new Agent({ model, /* ... */ });
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
See the Strands [Guardrails](https://strandsagents.com/docs/user-guide/safety-security/guardrails/) guide for more detail.
|
|
507
|
+
|
|
508
|
+
## Connections
|
|
509
|
+
|
|
510
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
511
|
+
|
|
512
|
+
<CardGrid>
|
|
513
|
+
<ConnectionCard
|
|
514
|
+
title="React to TypeScript Agent"
|
|
515
|
+
description="Call a TypeScript Agent from a React website"
|
|
516
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-ts-agent`}
|
|
517
|
+
source="react"
|
|
518
|
+
target="strands"
|
|
519
|
+
targetBadge="typescript"
|
|
520
|
+
/>
|
|
521
|
+
<ConnectionCard
|
|
522
|
+
title="React to AG-UI Agent"
|
|
523
|
+
description="Call an Agent exposing the AG-UI protocol from a React website via CopilotKit"
|
|
524
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-agui`}
|
|
525
|
+
source="react"
|
|
526
|
+
target="copilotkit"
|
|
527
|
+
/>
|
|
528
|
+
<ConnectionCard
|
|
529
|
+
title="TypeScript Agent to MCP"
|
|
530
|
+
description="Connect a TypeScript Agent to an MCP server"
|
|
531
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-mcp`}
|
|
532
|
+
source="strands"
|
|
533
|
+
sourceBadge="typescript"
|
|
534
|
+
target="mcp"
|
|
535
|
+
/>
|
|
536
|
+
<ConnectionCard
|
|
537
|
+
title="TypeScript Agent to A2A Agent"
|
|
538
|
+
description="Connect a TypeScript Agent to a remote A2A agent"
|
|
539
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-a2a`}
|
|
540
|
+
source="strands"
|
|
541
|
+
sourceBadge="typescript"
|
|
542
|
+
target="a2a"
|
|
543
|
+
/>
|
|
544
|
+
<ConnectionCard
|
|
545
|
+
title="Python Agent to A2A Agent"
|
|
546
|
+
description="Connect a Python Agent to a remote A2A agent"
|
|
547
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-a2a`}
|
|
548
|
+
source="strands"
|
|
549
|
+
sourceBadge="python"
|
|
550
|
+
target="a2a"
|
|
551
|
+
/>
|
|
552
|
+
<ConnectionCard
|
|
553
|
+
title="TypeScript Agent to Relational Database"
|
|
554
|
+
description="Connect a TypeScript Agent to an Aurora relational database"
|
|
555
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-rdb`}
|
|
556
|
+
source="strands"
|
|
557
|
+
sourceBadge="typescript"
|
|
558
|
+
target="aurora"
|
|
559
|
+
/>
|
|
560
|
+
<ConnectionCard
|
|
561
|
+
title="TypeScript Agent to TypeScript DynamoDB"
|
|
562
|
+
description="Connect a TypeScript Agent to a DynamoDB table"
|
|
563
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-dynamodb`}
|
|
564
|
+
source="strands"
|
|
565
|
+
sourceBadge="typescript"
|
|
566
|
+
target="dynamodb"
|
|
567
|
+
/>
|
|
568
|
+
<ConnectionCard
|
|
569
|
+
title="TypeScript Agent to AgentCore Gateway"
|
|
570
|
+
description="Connect a TypeScript Agent to an AgentCore Gateway"
|
|
571
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-gateway`}
|
|
572
|
+
source="strands"
|
|
573
|
+
sourceBadge="typescript"
|
|
574
|
+
target="agentcore"
|
|
575
|
+
/>
|
|
576
|
+
</CardGrid>
|