@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
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Python MCP Server to Relational Database
|
|
3
|
+
description: Connect a Python MCP Server to a Relational Database
|
|
4
|
+
when:
|
|
5
|
+
sourceType: py#mcp-server
|
|
6
|
+
targetType: py#rdb
|
|
7
|
+
---
|
|
8
|
+
import { FileTree } from '@astrojs/starlight/components';
|
|
9
|
+
import Link from '@components/link.astro';
|
|
10
|
+
import RunGenerator from '@components/run-generator.astro';
|
|
11
|
+
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
12
|
+
import NxCommands from '@components/nx-commands.astro';
|
|
13
|
+
import Infrastructure from '@components/infrastructure.astro';
|
|
14
|
+
|
|
15
|
+
The `connection` generator wires a <Link path="guides/py-mcp-server">Python MCP Server</Link> to a <Link path="guides/py-rdb">Python Relational Database</Link> project, making the database session available to all tools registered in the server.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
Before using this generator, ensure you have:
|
|
20
|
+
|
|
21
|
+
1. A <Link path="guides/py-mcp-server">`py#mcp-server`</Link> project
|
|
22
|
+
2. A <Link path="guides/py-rdb">`py#rdb`</Link> project
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
### Run the Generator
|
|
27
|
+
|
|
28
|
+
<RunGenerator generator="connection" />
|
|
29
|
+
|
|
30
|
+
Select your MCP server project as the source and your relational database project as the target. If the project contains multiple MCP server components, specify `sourceComponent` to disambiguate.
|
|
31
|
+
|
|
32
|
+
### Options
|
|
33
|
+
|
|
34
|
+
<GeneratorParameters generator="connection" />
|
|
35
|
+
|
|
36
|
+
## Generator Output
|
|
37
|
+
|
|
38
|
+
<FileTree>
|
|
39
|
+
|
|
40
|
+
- packages/my\_service
|
|
41
|
+
- project.json Adds a dependency from `my_mcp_server-dev` on the database's `dev` target
|
|
42
|
+
- pyproject.toml Adds the database package as a workspace dependency
|
|
43
|
+
- my\_service
|
|
44
|
+
- my\_mcp\_server
|
|
45
|
+
- Dockerfile Adds the RDS CA bundle used for direct Aurora connections
|
|
46
|
+
|
|
47
|
+
</FileTree>
|
|
48
|
+
|
|
49
|
+
## Using the Database in MCP Tools
|
|
50
|
+
|
|
51
|
+
Import `session_context` from your database package and use it inside your MCP server tools:
|
|
52
|
+
|
|
53
|
+
```python title="packages/my_service/my_service/my_mcp_server/server.py"
|
|
54
|
+
from sqlmodel import select
|
|
55
|
+
from my_scope.my_db import session_context
|
|
56
|
+
from my_scope.my_db.models.example import ExampleModel
|
|
57
|
+
|
|
58
|
+
@mcp.tool()
|
|
59
|
+
async def list_examples() -> str:
|
|
60
|
+
"""List all example records."""
|
|
61
|
+
async with session_context() as session:
|
|
62
|
+
items = (await session.execute(select(ExampleModel))).all()
|
|
63
|
+
return str([item.model_dump() for item in items])
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Multiple Databases
|
|
67
|
+
|
|
68
|
+
Running the generator again with a different target adds the second database alongside the first. Both session contexts are available to all tools:
|
|
69
|
+
|
|
70
|
+
```python title="packages/my_service/my_service/my_mcp_server/server.py"
|
|
71
|
+
from my_scope.my_db import session_context as my_db_session_context
|
|
72
|
+
from my_scope.other_db import session_context as other_db_session_context
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Infrastructure
|
|
76
|
+
|
|
77
|
+
The generated MCP server construct implements `IGrantable` and `IConnectable`, so you can grant network and IAM access to the database directly on the construct.
|
|
78
|
+
|
|
79
|
+
<Infrastructure>
|
|
80
|
+
<Fragment slot="cdk">
|
|
81
|
+
|
|
82
|
+
```ts title="packages/infra/src/stacks/application-stack.ts"
|
|
83
|
+
import { SecurityGroup } from 'aws-cdk-lib/aws-ec2';
|
|
84
|
+
import { RuntimeNetworkConfiguration } from 'aws-cdk-lib/aws-bedrockagentcore';
|
|
85
|
+
import { MyDatabase } from ':my-scope/common-constructs';
|
|
86
|
+
|
|
87
|
+
const db = new MyDatabase(this, 'Db', { vpc, ... });
|
|
88
|
+
|
|
89
|
+
const myMcpServer = new MyMcpServer(this, 'MyMcpServer', {
|
|
90
|
+
networkConfiguration: RuntimeNetworkConfiguration.usingVpc(this, {
|
|
91
|
+
vpc,
|
|
92
|
+
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_EGRESS },
|
|
93
|
+
securityGroups: [
|
|
94
|
+
new SecurityGroup(this, 'MyMcpServerSecurityGroup', { vpc, allowAllOutbound: true }),
|
|
95
|
+
],
|
|
96
|
+
}),
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
db.allowDefaultPortFrom(myMcpServer);
|
|
100
|
+
db.grantConnect(myMcpServer);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
`allowDefaultPortFrom` opens the security group rule so the MCP server runtime can reach the database port. `grantConnect` grants IAM `rds-db:connect` permission to the server's execution role.
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
</Fragment>
|
|
107
|
+
<Fragment slot="terraform">
|
|
108
|
+
|
|
109
|
+
Run the MCP server inside the same VPC as the database, grant it `rds-db:connect` via `additional_iam_policy_statements`, and open the network path with a pair of security group rules. The `aws_vpc.main` and `aws_subnet` resources are defined in the database deployment guide:
|
|
110
|
+
|
|
111
|
+
```hcl title="packages/infra/src/main.tf"
|
|
112
|
+
module "my_database" {
|
|
113
|
+
source = "../../common/terraform/src/app/dbs/my-database"
|
|
114
|
+
vpc_id = aws_vpc.main.id
|
|
115
|
+
database_subnet_ids = aws_subnet.database[*].id
|
|
116
|
+
lambda_subnet_ids = aws_subnet.private[*].id
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
module "my_mcp_server" {
|
|
120
|
+
source = "../../common/terraform/src/app/mcp-servers/my-mcp-server"
|
|
121
|
+
enable_vpc = true
|
|
122
|
+
vpc_id = aws_vpc.main.id
|
|
123
|
+
subnet_ids = aws_subnet.private[*].id
|
|
124
|
+
|
|
125
|
+
appconfig_application_id = module.runtime_config_appconfig.application_id
|
|
126
|
+
appconfig_application_arn = module.runtime_config_appconfig.application_arn
|
|
127
|
+
|
|
128
|
+
additional_iam_policy_statements = [
|
|
129
|
+
{
|
|
130
|
+
Effect = "Allow"
|
|
131
|
+
Action = ["rds-db:connect"]
|
|
132
|
+
Resource = [
|
|
133
|
+
"arn:aws:rds-db:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:dbuser:${module.my_database.connect_resource_id}/${module.my_database.database_runtime_user}"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
resource "aws_vpc_security_group_ingress_rule" "mcp_server_to_database" {
|
|
140
|
+
description = "Allow the MCP server runtime to connect to the database"
|
|
141
|
+
security_group_id = module.my_database.security_group_id
|
|
142
|
+
referenced_security_group_id = module.my_mcp_server.security_group_id
|
|
143
|
+
from_port = module.my_database.cluster_port
|
|
144
|
+
to_port = module.my_database.cluster_port
|
|
145
|
+
ip_protocol = "tcp"
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
resource "aws_vpc_security_group_egress_rule" "mcp_server_to_database" {
|
|
149
|
+
description = "Allow outbound traffic from the MCP server runtime to the database"
|
|
150
|
+
security_group_id = module.my_mcp_server.security_group_id
|
|
151
|
+
referenced_security_group_id = module.my_database.security_group_id
|
|
152
|
+
from_port = module.my_database.cluster_port
|
|
153
|
+
to_port = module.my_database.cluster_port
|
|
154
|
+
ip_protocol = "tcp"
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`appconfig_application_id`/`appconfig_application_arn` come from the shared <Link path="guides/runtime-config">runtime configuration</Link> AppConfig application declared once in your root module, not from the database module. Include the `database` namespace when instantiating it so the database module's runtime configuration entry is deployed:
|
|
159
|
+
|
|
160
|
+
```hcl title="packages/infra/src/main.tf"
|
|
161
|
+
module "runtime_config_appconfig" {
|
|
162
|
+
source = "../../common/terraform/src/core/runtime-config/appconfig"
|
|
163
|
+
|
|
164
|
+
application_name = "my-app-runtime-config"
|
|
165
|
+
namespaces = ["connection", "agentcore", "database"]
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
</Fragment>
|
|
170
|
+
</Infrastructure>
|
|
171
|
+
|
|
172
|
+
### SSL Requirements When Connecting Without RDS Proxy
|
|
173
|
+
|
|
174
|
+
When the MCP server connects directly to the Aurora cluster (without RDS Proxy), the connection generator updates the generated MCP server Dockerfile to install the Amazon RDS CA bundle into the system trust store:
|
|
175
|
+
|
|
176
|
+
```dockerfile
|
|
177
|
+
ADD https://truststore.pki.rds.amazonaws.com/global/global-bundle.pem /usr/local/share/ca-certificates/rds-global-bundle.crt
|
|
178
|
+
RUN update-ca-certificates
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
When using RDS Proxy, you do not need to configure the RDS CA bundle in the MCP server runtime.
|
|
182
|
+
|
|
183
|
+
## Local Development
|
|
184
|
+
|
|
185
|
+
<NxCommands commands={["<mcp-server-name>-dev <project-name>"]} />
|
|
186
|
+
|
|
187
|
+
This starts the MCP server and all connected databases. The `LOCAL_DEV=true` environment variable causes the database client to connect to its local Docker database instead of Aurora.
|
|
@@ -71,7 +71,7 @@ The following dependencies are added to the root `package.json`:
|
|
|
71
71
|
Each `useAgui<AgentName>` hook reads its agent's runtime value from <Link path="guides/runtime-config">Runtime Configuration</Link> and instantiates an `@ag-ui/client` `HttpAgent`:
|
|
72
72
|
|
|
73
73
|
- **Deployed**: the runtime value is a Bedrock AgentCore Runtime ARN, which is converted to the AgentCore HTTPS endpoint: `https://bedrock-agentcore.<region>.amazonaws.com/runtimes/<encoded-arn>/invocations?qualifier=DEFAULT`
|
|
74
|
-
- **Local development**: `
|
|
74
|
+
- **Local development**: `dev` overrides the value to the agent's local URL (e.g. `http://localhost:8081`)
|
|
75
75
|
|
|
76
76
|
The shared `AguiProvider` calls every generated hook and spreads each one into `selfManagedAgents` on a single `CopilotKitProvider`, which exposes them all to CopilotKit components.
|
|
77
77
|
|
|
@@ -218,13 +218,13 @@ Deeper overrides follow the same shape — e.g. replace just the copy button on
|
|
|
218
218
|
|
|
219
219
|
## Local Development
|
|
220
220
|
|
|
221
|
-
The connection generator automatically configures `
|
|
221
|
+
The connection generator automatically configures `dev` integration:
|
|
222
222
|
|
|
223
|
-
1. Running `nx
|
|
223
|
+
1. Running `nx dev <website>` will also start the agent's local server
|
|
224
224
|
2. The runtime config is overridden to point to the local AG-UI URL (e.g. `http://localhost:8081`)
|
|
225
225
|
3. Both the website and the agent hot-reload together
|
|
226
226
|
|
|
227
|
-
<NxCommands commands={['
|
|
227
|
+
<NxCommands commands={['dev <WebsiteProject>']} />
|
|
228
228
|
|
|
229
229
|
:::tip[Hot Reloading]
|
|
230
230
|
The website and connected agent hot-reload together, enabling you to quickly iterate on both sides without deploying to AWS.
|
|
@@ -115,9 +115,9 @@ Whenever you make changes to your FastAPI, you need to rebuild your project in o
|
|
|
115
115
|
:::
|
|
116
116
|
|
|
117
117
|
:::tip[Auto-Regeneration]
|
|
118
|
-
If you're actively working on both your React application and FastAPI together, use the React application's `
|
|
118
|
+
If you're actively working on both your React application and FastAPI together, use the React application's `dev` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local FastAPI server:
|
|
119
119
|
|
|
120
|
-
<NxCommands commands={['
|
|
120
|
+
<NxCommands commands={['dev <WebsiteProject>']} />
|
|
121
121
|
|
|
122
122
|
For more fine-grained control, you can use the `watch-generate:<ApiName>-client` target for your React application to regenerate the client every time you make API changes:
|
|
123
123
|
|
|
@@ -312,6 +312,42 @@ function CreateItemForm() {
|
|
|
312
312
|
```
|
|
313
313
|
</Drawer>
|
|
314
314
|
|
|
315
|
+
### File Uploads
|
|
316
|
+
|
|
317
|
+
For endpoints that accept a file upload, the generated client sends the request as `FormData`. Define an operation with a `multipart/form-data` body in your FastAPI, for example using `UploadFile`:
|
|
318
|
+
|
|
319
|
+
```python
|
|
320
|
+
from fastapi import UploadFile
|
|
321
|
+
|
|
322
|
+
@app.post("/files")
|
|
323
|
+
async def upload_file(file: UploadFile, description: str = "") -> FileMetadata:
|
|
324
|
+
contents = await file.read()
|
|
325
|
+
...
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
Binary fields are typed as `Blob` on the generated client, and other fields (such as `description` above) keep their modelled types. Pass a `Blob` or `File` — for example one obtained from an `<input type="file">`:
|
|
329
|
+
|
|
330
|
+
```tsx {9-12}
|
|
331
|
+
import { useMutation } from '@tanstack/react-query';
|
|
332
|
+
import { useMyApi } from './hooks/useMyApi';
|
|
333
|
+
|
|
334
|
+
function UploadForm() {
|
|
335
|
+
const api = useMyApi();
|
|
336
|
+
const uploadFile = useMutation(api.uploadFile.mutationOptions());
|
|
337
|
+
|
|
338
|
+
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
339
|
+
const file = e.target.files?.[0];
|
|
340
|
+
if (file) {
|
|
341
|
+
uploadFile.mutate({ file, description: file.name });
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
|
|
345
|
+
return <input type="file" onChange={handleChange} />;
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
The client builds a `FormData` body and lets `fetch` set the `Content-Type` (including the multipart boundary) automatically.
|
|
350
|
+
|
|
315
351
|
### Pagination with Infinite Queries
|
|
316
352
|
|
|
317
353
|
For endpoints that accept a `cursor` parameter as input, the generated hooks provide support for infinite queries using TanStack Query's `useInfiniteQuery` hook. This makes it easy to implement "load more" or infinite scrolling functionality.
|
|
@@ -122,11 +122,8 @@ function ChatComponent() {
|
|
|
122
122
|
},
|
|
123
123
|
}));
|
|
124
124
|
|
|
125
|
-
const handleSend = (
|
|
126
|
-
invoke.mutate({
|
|
127
|
-
prompt: message,
|
|
128
|
-
sessionId: 'my-session',
|
|
129
|
-
});
|
|
125
|
+
const handleSend = (prompt: string) => {
|
|
126
|
+
invoke.mutate({ prompt });
|
|
130
127
|
};
|
|
131
128
|
|
|
132
129
|
return (
|
|
@@ -154,12 +151,9 @@ function ChatComponent() {
|
|
|
154
151
|
const client = useMyAgentClient();
|
|
155
152
|
const [chunks, setChunks] = useState<StreamChunk[]>([]);
|
|
156
153
|
|
|
157
|
-
const handleSend = async (
|
|
154
|
+
const handleSend = async (prompt: string) => {
|
|
158
155
|
setChunks([]);
|
|
159
|
-
for await (const chunk of client.invoke({
|
|
160
|
-
prompt: message,
|
|
161
|
-
sessionId: 'my-session',
|
|
162
|
-
})) {
|
|
156
|
+
for await (const chunk of client.invoke({ prompt })) {
|
|
163
157
|
setChunks((prev) => [...prev, chunk]);
|
|
164
158
|
}
|
|
165
159
|
};
|
|
@@ -177,13 +171,13 @@ function ChatComponent() {
|
|
|
177
171
|
|
|
178
172
|
## Local Development
|
|
179
173
|
|
|
180
|
-
The connection generator automatically configures `
|
|
174
|
+
The connection generator automatically configures `dev` integration:
|
|
181
175
|
|
|
182
|
-
1. Running `nx
|
|
176
|
+
1. Running `nx dev <website>` will also start the agent's local FastAPI server
|
|
183
177
|
2. The runtime config is overridden to point to the local HTTP URL (e.g., `http://localhost:8081/`)
|
|
184
178
|
3. The TypeScript client is automatically regenerated when the agent's API changes
|
|
185
179
|
|
|
186
|
-
<NxCommands commands={['
|
|
180
|
+
<NxCommands commands={['dev <WebsiteProject>']} />
|
|
187
181
|
|
|
188
182
|
:::tip[Hot Reloading]
|
|
189
183
|
The website and connected agent will hot-reload, enabling you to quickly iterate on both together without deploying to AWS.
|
|
@@ -21,7 +21,7 @@ The `connection` generator provides a way to quickly integrate your React websit
|
|
|
21
21
|
Before using this generator, ensure your React application has:
|
|
22
22
|
|
|
23
23
|
1. A `main.tsx` file that renders your application
|
|
24
|
-
2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#
|
|
24
|
+
2. A working Smithy TypeScript API backend (generated using the <Link path="/guides/ts-smithy-api">`ts#api` generator</Link> with `--framework=smithy`)
|
|
25
25
|
3. Cognito Auth added via the <Link path="/guides/react-website-auth">`ts#website#auth` generator</Link> if connecting an API which uses Cognito or IAM auth
|
|
26
26
|
|
|
27
27
|
<details>
|
|
@@ -116,9 +116,9 @@ Whenever you make changes to your Smithy API model, you need to rebuild your pro
|
|
|
116
116
|
:::
|
|
117
117
|
|
|
118
118
|
:::tip[Auto-Regeneration]
|
|
119
|
-
If you're actively working on both your React application and Smithy API together, use the React application's `
|
|
119
|
+
If you're actively working on both your React application and Smithy API together, use the React application's `dev` target which will automatically regenerate the client whenever your API changes, as well as hot-reloading your website and local Smithy API server:
|
|
120
120
|
|
|
121
|
-
<NxCommands commands={['
|
|
121
|
+
<NxCommands commands={['dev <WebsiteProject>']} />
|
|
122
122
|
|
|
123
123
|
For more fine-grained control, you can use the `watch-generate:<ApiName>-client` target for your React application to regenerate the client every time you make API changes:
|
|
124
124
|
|
|
@@ -175,7 +175,7 @@ Subscriptions are only supported when the tRPC API uses `rest-lambda` (REST API)
|
|
|
175
175
|
|
|
176
176
|
When connecting to a REST API tRPC backend, the generated client is automatically configured with a `splitLink` that routes subscription operations through `httpSubscriptionLink` (using SSE) and regular queries/mutations through `httpLink`. This means subscriptions work out of the box with no additional configuration.
|
|
177
177
|
|
|
178
|
-
For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc"
|
|
178
|
+
For information on how to define subscription procedures in your backend, see the <Link path="guides/trpc">tRPC API generator guide</Link>.
|
|
179
179
|
|
|
180
180
|
#### Using the useSubscription Hook
|
|
181
181
|
|
|
@@ -64,13 +64,13 @@ Additionally, it installs the required dependencies:
|
|
|
64
64
|
The generated client connects to your Agent via tRPC over WebSocket. The agent exposes a tRPC router (including the `invoke` subscription for streaming agent responses) over a WebSocket endpoint.
|
|
65
65
|
|
|
66
66
|
- **Deployed**: The agent runtime ARN is loaded from <Link path="guides/runtime-config">Runtime Configuration</Link>. Running this connection generator also patches the agent's generated CDK/Terraform construct to publish its ARN to the website's `runtime-config.json` (under the `connection` namespace), so only agents you explicitly connect are exposed to the frontend. The ARN is converted to a WebSocket URL following the Bedrock AgentCore Runtime WebSocket protocol: `wss://bedrock-agentcore.<region>.amazonaws.com/runtimes/<encoded-arn>/ws`
|
|
67
|
-
- **Local development**: When running with `
|
|
67
|
+
- **Local development**: When running with `dev`, the runtime config override sets the value to a local `ws://` URL (e.g., `ws://localhost:8081/ws`), and the client connects directly
|
|
68
68
|
|
|
69
69
|
### Authentication
|
|
70
70
|
|
|
71
71
|
The generated code handles authentication depending on your agent's configuration:
|
|
72
72
|
|
|
73
|
-
- **IAM** (default): Uses AWS SigV4 presigned URLs to authenticate the WebSocket connection. Credentials are obtained from the Cognito Identity Pool configured with your website's auth. In `
|
|
73
|
+
- **IAM** (default): Uses AWS SigV4 presigned URLs to authenticate the WebSocket connection. Credentials are obtained from the Cognito Identity Pool configured with your website's auth. In `dev` mode, signing is automatically skipped when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
|
|
74
74
|
- **Cognito**: Embeds the JWT access token in the `Sec-WebSocket-Protocol` header as a base64url-encoded bearer token, following the [AgentCore WebSocket auth protocol](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-get-started-websocket.html)
|
|
75
75
|
|
|
76
76
|
|
|
@@ -93,7 +93,7 @@ function ChatComponent() {
|
|
|
93
93
|
|
|
94
94
|
const subscription = useSubscription(
|
|
95
95
|
trpc.invoke.subscriptionOptions(
|
|
96
|
-
{
|
|
96
|
+
{ prompt: 'What can you help me with?' },
|
|
97
97
|
{
|
|
98
98
|
enabled: true,
|
|
99
99
|
onStarted: () => {
|
|
@@ -135,9 +135,9 @@ function ChatComponent() {
|
|
|
135
135
|
const client = useMyAgentAgentClient();
|
|
136
136
|
const [messages, setMessages] = useState<string[]>([]);
|
|
137
137
|
|
|
138
|
-
const sendMessage = (
|
|
138
|
+
const sendMessage = (prompt: string) => {
|
|
139
139
|
const subscription = client.invoke.subscribe(
|
|
140
|
-
{
|
|
140
|
+
{ prompt },
|
|
141
141
|
{
|
|
142
142
|
onData: (token) => {
|
|
143
143
|
setMessages((prev) => [...prev, token]);
|
|
@@ -174,11 +174,11 @@ For more details on the vanilla tRPC client, see the [tRPC Vanilla Client docume
|
|
|
174
174
|
|
|
175
175
|
## Local Development
|
|
176
176
|
|
|
177
|
-
The connection generator automatically configures `
|
|
177
|
+
The connection generator automatically configures `dev` integration for your react website:
|
|
178
178
|
|
|
179
|
-
1. Running `nx
|
|
179
|
+
1. Running `nx dev <website>` will also start the agent's local server
|
|
180
180
|
2. The runtime config is overridden to point to the local WebSocket URL (e.g., `ws://localhost:8081/ws`)
|
|
181
|
-
3. Like with connected APIs, authentication is skipped in `
|
|
181
|
+
3. Like with connected APIs, authentication is skipped in `dev` mode when <Link path="guides/react-website#runtime-configuration">`runtime-config.json`</Link> is not present
|
|
182
182
|
|
|
183
183
|
:::tip[Hot Reloading]
|
|
184
184
|
The website and connected agent will hot-reload, enabling you to quickly iterate on both together without deploying to AWS.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Smithy API to DynamoDB
|
|
3
|
-
description: Connect a Smithy API to a DynamoDB
|
|
3
|
+
description: Connect a Smithy API to a TypeScript DynamoDB project
|
|
4
4
|
when:
|
|
5
5
|
sourceType: smithy
|
|
6
6
|
targetType: ts#dynamodb
|
|
@@ -12,13 +12,13 @@ import GeneratorParameters from '@components/generator-parameters.astro';
|
|
|
12
12
|
import NxCommands from '@components/nx-commands.astro';
|
|
13
13
|
import Snippet from '@components/snippet.astro';
|
|
14
14
|
|
|
15
|
-
The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
15
|
+
The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
16
16
|
|
|
17
17
|
## Prerequisites
|
|
18
18
|
|
|
19
19
|
Before using this generator, ensure you have:
|
|
20
20
|
|
|
21
|
-
1. A <Link path="guides/ts-smithy-api"
|
|
21
|
+
1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
|
|
22
22
|
2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
@@ -35,7 +35,7 @@ Select your Smithy API backend project as the source and your DynamoDB project a
|
|
|
35
35
|
|
|
36
36
|
## Generator Output
|
|
37
37
|
|
|
38
|
-
The generator updates your Smithy API's `project.json` to add a dependency from its `
|
|
38
|
+
The generator updates your Smithy API's `project.json` to add a dependency from its `dev` target to the DynamoDB project's `dev` target. No source files are modified.
|
|
39
39
|
|
|
40
40
|
## Using DynamoDB in Operations
|
|
41
41
|
|
|
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/ts-smithy-api">Smithy API<
|
|
|
18
18
|
|
|
19
19
|
Before using this generator, ensure you have:
|
|
20
20
|
|
|
21
|
-
1. A <Link path="guides/ts-smithy-api"
|
|
21
|
+
1. A <Link path="guides/ts-smithy-api">Smithy TypeScript API</Link> project (generated with `ts#api` using `--framework=smithy`)
|
|
22
22
|
2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
@@ -46,7 +46,7 @@ The generator modifies three existing files in your Smithy API backend:
|
|
|
46
46
|
|
|
47
47
|
</FileTree>
|
|
48
48
|
|
|
49
|
-
Additionally, it updates the API's `
|
|
49
|
+
Additionally, it updates the API's `dev` target to start the database automatically.
|
|
50
50
|
|
|
51
51
|
## How It Works
|
|
52
52
|
|
|
@@ -134,7 +134,7 @@ const httpResponse = await serviceHandler.handle(httpRequest, {
|
|
|
134
134
|
|
|
135
135
|
### SSL Requirements When Connecting Without RDS Proxy
|
|
136
136
|
|
|
137
|
-
<Snippet name="connection/lambda-rdb-ssl-requirements" parentHeading="SSL Requirements When Connecting Without RDS Proxy" />
|
|
137
|
+
<Snippet name="connection/ts-lambda-rdb-ssl-requirements" parentHeading="SSL Requirements When Connecting Without RDS Proxy" />
|
|
138
138
|
|
|
139
139
|
## Local Development
|
|
140
140
|
|
|
@@ -156,6 +156,6 @@ const server = createServer(async function (req, res) {
|
|
|
156
156
|
});
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
<NxCommands commands={["
|
|
159
|
+
<NxCommands commands={["dev <api-project-name>"]} />
|
|
160
160
|
|
|
161
|
-
This starts both the API and the local database. The `
|
|
161
|
+
This starts both the API and the local database. The `LOCAL_DEV=true` environment variable is set automatically, so the Prisma client connects to the local Docker database instead of Aurora.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: tRPC API to DynamoDB
|
|
3
|
-
description: Connect a tRPC API to a DynamoDB
|
|
3
|
+
description: Connect a tRPC API to a TypeScript DynamoDB project
|
|
4
4
|
when:
|
|
5
5
|
sourceType: ts#trpc-api
|
|
6
6
|
targetType: ts#dynamodb
|
|
@@ -12,13 +12,13 @@ import GeneratorParameters from '@components/generator-parameters.astro';
|
|
|
12
12
|
import NxCommands from '@components/nx-commands.astro';
|
|
13
13
|
import Snippet from '@components/snippet.astro';
|
|
14
14
|
|
|
15
|
-
The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
15
|
+
The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
16
16
|
|
|
17
17
|
## Prerequisites
|
|
18
18
|
|
|
19
19
|
Before using this generator, ensure you have:
|
|
20
20
|
|
|
21
|
-
1. A <Link path="guides/trpc"
|
|
21
|
+
1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
|
|
22
22
|
2. A <Link path="guides/ts-dynamodb">`ts#dynamodb`</Link> project
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
@@ -35,7 +35,7 @@ Select your tRPC API project as the source and your DynamoDB project as the targ
|
|
|
35
35
|
|
|
36
36
|
## Generator Output
|
|
37
37
|
|
|
38
|
-
The generator updates your tRPC API's `project.json` to add a dependency from its `
|
|
38
|
+
The generator updates your tRPC API's `project.json` to add a dependency from its `dev` target to the DynamoDB project's `dev` target. No source files are modified.
|
|
39
39
|
|
|
40
40
|
## Using DynamoDB in Procedures
|
|
41
41
|
|
|
@@ -18,7 +18,7 @@ The `connection` generator wires a <Link path="guides/trpc">tRPC API</Link> to a
|
|
|
18
18
|
|
|
19
19
|
Before using this generator, ensure you have:
|
|
20
20
|
|
|
21
|
-
1. A <Link path="guides/trpc"
|
|
21
|
+
1. A <Link path="guides/trpc">tRPC API</Link> project (generated with `ts#api`)
|
|
22
22
|
2. A <Link path="guides/ts-rdb">`ts#rdb`</Link> project
|
|
23
23
|
|
|
24
24
|
## Usage
|
|
@@ -45,7 +45,7 @@ The generator creates a middleware file in your tRPC API project:
|
|
|
45
45
|
|
|
46
46
|
</FileTree>
|
|
47
47
|
|
|
48
|
-
Additionally, it updates your tRPC API's `
|
|
48
|
+
Additionally, it updates your tRPC API's `dev` target to start the database automatically when running locally.
|
|
49
49
|
|
|
50
50
|
## Using the Middleware
|
|
51
51
|
|
|
@@ -116,12 +116,12 @@ export const dbProcedure = t.procedure
|
|
|
116
116
|
|
|
117
117
|
### SSL Requirements When Connecting Without RDS Proxy
|
|
118
118
|
|
|
119
|
-
<Snippet name="connection/lambda-rdb-ssl-requirements" parentHeading="SSL Requirements When Connecting Without RDS Proxy" />
|
|
119
|
+
<Snippet name="connection/ts-lambda-rdb-ssl-requirements" parentHeading="SSL Requirements When Connecting Without RDS Proxy" />
|
|
120
120
|
|
|
121
121
|
## Local Development
|
|
122
122
|
|
|
123
|
-
The generator configures your tRPC API's `
|
|
123
|
+
The generator configures your tRPC API's `dev` target to depend on the database's `dev` target, so running:
|
|
124
124
|
|
|
125
|
-
<NxCommands commands={["
|
|
125
|
+
<NxCommands commands={["dev <api-project-name>"]} />
|
|
126
126
|
|
|
127
127
|
will automatically start the local database alongside your API.
|
|
@@ -47,9 +47,12 @@ The generator creates a shared `agent-connection` package and modifies your agen
|
|
|
47
47
|
- packages/common/agent-connection
|
|
48
48
|
- src
|
|
49
49
|
- app
|
|
50
|
-
- \<target-agent-name>-client.ts High-level client for the connected A2A agent
|
|
50
|
+
- \<target-agent-name>-client-strands.ts High-level Strands client for the connected A2A agent
|
|
51
51
|
- core
|
|
52
|
-
- agentcore-
|
|
52
|
+
- agentcore-endpoints.ts Framework-agnostic ARN/URL resolution
|
|
53
|
+
- agentcore-fetch.ts Framework-agnostic SigV4 / JWT / session-forwarding fetch
|
|
54
|
+
- agentcore-a2a-client-config.ts Framework-agnostic A2A client config (signed `clientFactory`)
|
|
55
|
+
- agentcore-a2a-client-strands.ts Strands A2A client wrapping the config
|
|
53
56
|
- index.ts Exports all clients
|
|
54
57
|
- project.json
|
|
55
58
|
- tsconfig.json
|
|
@@ -58,7 +61,7 @@ The generator creates a shared `agent-connection` package and modifies your agen
|
|
|
58
61
|
|
|
59
62
|
Additionally, it:
|
|
60
63
|
- Transforms your agent's `agent.ts` to register the remote A2A agent as a Strands `tool`
|
|
61
|
-
- Updates the agent's `
|
|
64
|
+
- Updates the agent's `dev` target to depend on the target agent's `dev` target
|
|
62
65
|
- Installs required dependencies
|
|
63
66
|
|
|
64
67
|
## Using the Connected A2A Agent
|
|
@@ -67,11 +70,11 @@ The generator transforms your agent's `agent.ts` to wrap the remote A2A agent as
|
|
|
67
70
|
|
|
68
71
|
```ts title="packages/example/src/my-agent/agent.ts" {2,5-11,14}
|
|
69
72
|
import { Agent, tool } from '@strands-agents/sdk';
|
|
70
|
-
import {
|
|
73
|
+
import { RemoteAgentClientStrands } from ':my-scope/agent-connection';
|
|
71
74
|
import { z } from 'zod';
|
|
72
75
|
|
|
73
76
|
export const getAgent = async (sessionId: string) => {
|
|
74
|
-
const remoteAgent = await
|
|
77
|
+
const remoteAgent = await RemoteAgentClientStrands.create(sessionId);
|
|
75
78
|
const remoteAgentTool = tool({
|
|
76
79
|
name: 'askRemoteAgent',
|
|
77
80
|
description: 'Delegate a question to the remote RemoteAgent A2A agent and return its reply.',
|
|
@@ -87,7 +90,7 @@ export const getAgent = async (sessionId: string) => {
|
|
|
87
90
|
|
|
88
91
|
The `sessionId` parameter is plumbed through from the caller, ensuring consistency for [Bedrock AgentCore Observability](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/observability.html).
|
|
89
92
|
|
|
90
|
-
Under the hood, `
|
|
93
|
+
Under the hood, `RemoteAgentClientStrands.create(sessionId)` returns a Strands `A2AAgent` configured with a SigV4-signing `clientFactory` when deployed to AWS, and a plain `http://localhost:<port>/` endpoint when `LOCAL_DEV=true`. The signing and endpoint resolution live in the framework-agnostic `agentcore-a2a-client-config.ts`; only the thin `agentcore-a2a-client-strands.ts` depends on Strands.
|
|
91
94
|
|
|
92
95
|
## Infrastructure
|
|
93
96
|
|
|
@@ -95,12 +98,12 @@ Under the hood, `RemoteAgentClient.create(sessionId)` returns a Strands `A2AAgen
|
|
|
95
98
|
|
|
96
99
|
## Local Development
|
|
97
100
|
|
|
98
|
-
The generator configures the host agent's `
|
|
101
|
+
The generator configures the host agent's `dev` target to:
|
|
99
102
|
1. Start the connected A2A agent(s) automatically
|
|
100
|
-
2. Set `
|
|
103
|
+
2. Set `LOCAL_DEV=true` so the generated client connects directly to `http://localhost:<port>/` instead of AgentCore
|
|
101
104
|
|
|
102
105
|
Run the agent locally with:
|
|
103
106
|
|
|
104
|
-
<NxCommands commands={["<agent-name>-
|
|
107
|
+
<NxCommands commands={["<agent-name>-dev <project-name>"]} />
|
|
105
108
|
|
|
106
109
|
This will start both the host agent and all connected A2A agents, with the host agent calling the remote agents over plain HTTP on their assigned local ports.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: TypeScript Agent to DynamoDB
|
|
3
|
-
description: Connect a TypeScript Agent to a DynamoDB
|
|
3
|
+
description: Connect a TypeScript Agent to a TypeScript DynamoDB project
|
|
4
4
|
when:
|
|
5
5
|
sourceType: ts#agent
|
|
6
6
|
targetType: ts#dynamodb
|
|
@@ -12,7 +12,7 @@ import NxCommands from '@components/nx-commands.astro';
|
|
|
12
12
|
import Infrastructure from '@components/infrastructure.astro';
|
|
13
13
|
import Snippet from '@components/snippet.astro';
|
|
14
14
|
|
|
15
|
-
The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
15
|
+
The `connection` generator wires a <Link path="guides/ts-agent">TypeScript Agent</Link> to a <Link path="guides/ts-dynamodb">TypeScript DynamoDB</Link> project, configuring local development so both start together automatically.
|
|
16
16
|
|
|
17
17
|
## Prerequisites
|
|
18
18
|
|
|
@@ -35,7 +35,7 @@ Select your Agent project as the source and your DynamoDB project as the target.
|
|
|
35
35
|
|
|
36
36
|
## Generator Output
|
|
37
37
|
|
|
38
|
-
The generator updates the agent's `<agent-name>-
|
|
38
|
+
The generator updates the agent's `<agent-name>-dev` target in `project.json` to depend on the DynamoDB project's `dev` target. No source files are modified.
|
|
39
39
|
|
|
40
40
|
## Using DynamoDB in Agents
|
|
41
41
|
|