@aws/nx-plugin-mcp 1.0.0-rc.20 → 1.0.0-rc.22
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/docs/guides/agentcore-gateway.mdx +39 -7
- package/docs/guides/connection/py-agent-a2a.mdx +39 -10
- package/docs/guides/connection/py-agent-gateway.mdx +33 -7
- package/docs/guides/connection/py-agent-mcp.mdx +34 -8
- package/docs/guides/fastapi.mdx +235 -1
- package/docs/guides/py-agent.mdx +155 -38
- package/docs/guides/py-dynamodb.mdx +36 -9
- package/docs/guides/py-mcp-server.mdx +42 -1
- package/docs/guides/react-website.mdx +53 -1
- package/docs/guides/trpc.mdx +35 -5
- package/docs/guides/ts-agent.mdx +73 -1
- package/docs/guides/ts-dynamodb.mdx +39 -10
- package/docs/guides/ts-mcp-server.mdx +47 -1
- package/docs/guides/ts-rdb.mdx +39 -10
- package/docs/guides/ts-smithy-api.mdx +176 -1
- package/package.json +1 -1
- package/src/py/agent/schema.json +1 -1
package/docs/guides/py-agent.mdx
CHANGED
|
@@ -4,7 +4,9 @@ description: Generate a Python Agent for building AI agents with tools and deplo
|
|
|
4
4
|
generator: py#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';
|
|
@@ -14,18 +16,9 @@ import GeneratorParameters from '@components/generator-parameters.astro';
|
|
|
14
16
|
import Drawer from '@components/drawer.astro';
|
|
15
17
|
import OptionFilter from '@components/option-filter.astro';
|
|
16
18
|
|
|
17
|
-
Generate a Python
|
|
19
|
+
Generate a Python AI agent for building agents with tools, and optionally deploy it to [Amazon Bedrock AgentCore Runtime](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/). Choose the agent framework with the `framework` option: [Strands](https://strandsagents.com/) (the default) or [LangChain](https://docs.langchain.com/oss/python/langchain/overview) (built on [LangGraph](https://docs.langchain.com/oss/python/langgraph/overview)).
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[Strands](https://strandsagents.com/docs/user-guide/quickstart/overview/) is a lightweight, production-ready Python framework for building AI agents. Key features include:
|
|
22
|
-
|
|
23
|
-
- **Lightweight and customizable**: Simple agent loop that gets out of your way
|
|
24
|
-
- **Production ready**: Full observability, tracing, and deployment options for scale
|
|
25
|
-
- **Model and provider agnostic**: Supports many different models from various providers
|
|
26
|
-
- **Community-driven tools**: Powerful set of community-contributed tools
|
|
27
|
-
- **Multi-agent support**: Advanced techniques like agent teams and autonomous agents
|
|
28
|
-
- **Flexible interaction modes**: Conversational, streaming, and non-streaming support
|
|
21
|
+
The generator exposes your agent over a server `protocol`. Both frameworks support [HTTP](https://fastapi.tiangolo.com/) (the default), the [Agent-to-Agent (A2A)](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-a2a.html) protocol for interoperability with other A2A-compatible agents, and the [AG-UI](https://docs.ag-ui.com/) protocol for direct frontend integration via [CopilotKit](https://docs.copilotkit.ai/).
|
|
29
22
|
|
|
30
23
|
## Usage
|
|
31
24
|
|
|
@@ -64,10 +57,10 @@ The generator will add the following files to your existing Python project. The
|
|
|
64
57
|
</FileTree>
|
|
65
58
|
</OptionFilter>
|
|
66
59
|
|
|
67
|
-
<OptionFilter when={{ protocol: 'a2a' }} description="
|
|
60
|
+
<OptionFilter when={{ protocol: 'a2a' }} description="A2A server layout">
|
|
68
61
|
### A2A Protocol
|
|
69
62
|
|
|
70
|
-
The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent)
|
|
63
|
+
The entry point exposes your agent over the A2A protocol (Strands uses the [Strands A2A Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent); LangChain wraps the graph in an [`a2a-sdk`](https://a2a-protocol.org/) executor), mounted onto a FastAPI app:
|
|
71
64
|
|
|
72
65
|
<FileTree>
|
|
73
66
|
- your-project/
|
|
@@ -77,7 +70,7 @@ The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/use
|
|
|
77
70
|
- agent.py Main agent definition with sample tools
|
|
78
71
|
- main.py A2A server entry point
|
|
79
72
|
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
80
|
-
- pyproject.toml Updated with
|
|
73
|
+
- pyproject.toml Updated with framework and A2A dependencies
|
|
81
74
|
- project.json Updated with agent serve targets
|
|
82
75
|
</FileTree>
|
|
83
76
|
</OptionFilter>
|
|
@@ -85,7 +78,7 @@ The entry point uses the [Strands A2A Server](https://strandsagents.com/docs/use
|
|
|
85
78
|
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server layout">
|
|
86
79
|
### AG-UI Protocol
|
|
87
80
|
|
|
88
|
-
The entry point
|
|
81
|
+
The entry point exposes your agent via the [AG-UI](https://docs.ag-ui.com/) protocol for direct frontend integration with [CopilotKit](https://docs.copilotkit.ai/). Strands agents use the [ag-ui-strands](https://docs.ag-ui.com/) integration; LangChain agents use [ag-ui-langgraph](https://docs.ag-ui.com/):
|
|
89
82
|
|
|
90
83
|
<FileTree>
|
|
91
84
|
- your-project/
|
|
@@ -93,14 +86,14 @@ The entry point uses the [ag-ui-strands](https://docs.ag-ui.com/) integration, w
|
|
|
93
86
|
- agent/ (or custom name if specified)
|
|
94
87
|
- \_\_init\_\_.py Python package initialization
|
|
95
88
|
- agent.py Main agent definition with sample tools
|
|
96
|
-
- main.py AG-UI server entry point
|
|
89
|
+
- main.py AG-UI server entry point
|
|
97
90
|
- Dockerfile Entry point for hosting your agent (excluded when `infra` is set to `None`)
|
|
98
|
-
- pyproject.toml Updated with
|
|
91
|
+
- pyproject.toml Updated with framework and AG-UI dependencies
|
|
99
92
|
- project.json Updated with agent serve targets
|
|
100
93
|
</FileTree>
|
|
101
94
|
|
|
102
95
|
:::tip[Connect to a React website]
|
|
103
|
-
AG-UI agents can be connected to a React frontend using the <Link path="/guides/connection/react-agui">`connection` generator</Link>, which will set up [CopilotKit](https://docs.copilotkit.ai/
|
|
96
|
+
AG-UI agents can be connected to a React frontend using the <Link path="/guides/connection/react-agui">`connection` generator</Link>, which will set up [CopilotKit](https://docs.copilotkit.ai/) components for a rich chat experience.
|
|
104
97
|
:::
|
|
105
98
|
</OptionFilter>
|
|
106
99
|
|
|
@@ -146,12 +139,14 @@ If you selected `none` for `infra`, no CDK constructs or Terraform modules are g
|
|
|
146
139
|
|
|
147
140
|
## Working with Your Agent
|
|
148
141
|
|
|
149
|
-
|
|
142
|
+
You can edit `agent.py` to add tools, configure the model and customize the system prompt. The API depends on the framework you chose.
|
|
150
143
|
|
|
151
|
-
|
|
144
|
+
### Adding Tools
|
|
152
145
|
|
|
153
|
-
|
|
146
|
+
Tools are functions that the AI agent can call to perform actions. Both frameworks use a decorator-based approach for defining tools, derive the tool name and description from the function name and docstring, and generate the input schema from your type hints.
|
|
154
147
|
|
|
148
|
+
<Tabs syncKey="agent-framework">
|
|
149
|
+
<TabItem label="Strands" _filter={{ framework: 'strands' }}>
|
|
155
150
|
```python
|
|
156
151
|
from strands import Agent, tool
|
|
157
152
|
|
|
@@ -172,14 +167,38 @@ agent = Agent(
|
|
|
172
167
|
tools=[calculate_sum, get_weather],
|
|
173
168
|
)
|
|
174
169
|
```
|
|
170
|
+
</TabItem>
|
|
171
|
+
<TabItem label="LangChain" _filter={{ framework: 'langchain' }}>
|
|
172
|
+
```python
|
|
173
|
+
from langchain.agents import create_agent
|
|
174
|
+
from langchain_aws import ChatBedrockConverse
|
|
175
|
+
from langchain_core.tools import tool
|
|
176
|
+
|
|
177
|
+
@tool
|
|
178
|
+
def calculate_sum(numbers: list[int]) -> int:
|
|
179
|
+
"""Calculate the sum of a list of numbers"""
|
|
180
|
+
return sum(numbers)
|
|
175
181
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
182
|
+
@tool
|
|
183
|
+
def get_weather(city: str) -> str:
|
|
184
|
+
"""Get weather information for a city"""
|
|
185
|
+
# Your weather API integration here
|
|
186
|
+
return f"Weather in {city}: Sunny, 25°C"
|
|
187
|
+
|
|
188
|
+
# Add tools to your agent
|
|
189
|
+
agent = create_agent(
|
|
190
|
+
model=ChatBedrockConverse(model=MODEL_ID, region_name=REGION),
|
|
191
|
+
tools=[calculate_sum, get_weather],
|
|
192
|
+
system_prompt="You are a helpful assistant with access to various tools.",
|
|
193
|
+
)
|
|
194
|
+
```
|
|
195
|
+
</TabItem>
|
|
196
|
+
</Tabs>
|
|
180
197
|
|
|
181
198
|
### Using Pre-built Tools
|
|
182
199
|
|
|
200
|
+
<Tabs syncKey="agent-framework">
|
|
201
|
+
<TabItem label="Strands" _filter={{ framework: 'strands' }}>
|
|
183
202
|
Strands provides a collection of pre-built tools through the `strands-tools` package:
|
|
184
203
|
|
|
185
204
|
```python
|
|
@@ -190,9 +209,26 @@ agent = Agent(
|
|
|
190
209
|
tools=[current_time, http_request, file_read],
|
|
191
210
|
)
|
|
192
211
|
```
|
|
212
|
+
</TabItem>
|
|
213
|
+
<TabItem label="LangChain" _filter={{ framework: 'langchain' }}>
|
|
214
|
+
LangChain provides a large ecosystem of [tools and integrations](https://docs.langchain.com/oss/python/integrations/tools). Install the relevant integration package, then pass the tools to `create_agent`:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
from langchain_community.tools import DuckDuckGoSearchRun
|
|
218
|
+
|
|
219
|
+
agent = create_agent(
|
|
220
|
+
model=ChatBedrockConverse(model=MODEL_ID, region_name=REGION),
|
|
221
|
+
tools=[DuckDuckGoSearchRun()],
|
|
222
|
+
system_prompt="You are a helpful assistant.",
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
</TabItem>
|
|
226
|
+
</Tabs>
|
|
193
227
|
|
|
194
228
|
### Model Configuration
|
|
195
229
|
|
|
230
|
+
<Tabs syncKey="agent-framework">
|
|
231
|
+
<TabItem label="Strands" _filter={{ framework: 'strands' }}>
|
|
196
232
|
By default, Strands agents use Claude 4 Sonnet, but you can customize the model provider. See the [Strands documentation on model providers](https://strandsagents.com/docs/user-guide/concepts/model-providers/) for configuration options:
|
|
197
233
|
|
|
198
234
|
```python
|
|
@@ -208,30 +244,45 @@ bedrock_model = BedrockModel(
|
|
|
208
244
|
|
|
209
245
|
agent = Agent(model=bedrock_model)
|
|
210
246
|
```
|
|
247
|
+
</TabItem>
|
|
248
|
+
<TabItem label="LangChain" _filter={{ framework: 'langchain' }}>
|
|
249
|
+
LangChain agents use a [`ChatBedrockConverse`](https://docs.langchain.com/oss/python/integrations/chat/bedrock_converse) model. The generated agent reads the model id and region from the `MODEL_ID` and `AWS_REGION` environment variables, but you can configure the model directly in `agent.py`:
|
|
211
250
|
|
|
212
|
-
|
|
251
|
+
```python
|
|
252
|
+
from langchain_aws import ChatBedrockConverse
|
|
253
|
+
|
|
254
|
+
model = ChatBedrockConverse(
|
|
255
|
+
model="anthropic.claude-sonnet-4-20250514-v1:0",
|
|
256
|
+
region_name="us-west-2",
|
|
257
|
+
temperature=0.3,
|
|
258
|
+
)
|
|
259
|
+
```
|
|
260
|
+
</TabItem>
|
|
261
|
+
</Tabs>
|
|
213
262
|
|
|
214
|
-
|
|
263
|
+
### Consuming MCP Servers
|
|
215
264
|
|
|
216
|
-
For consuming MCP Servers which you have created using the <Link path="/guides/py-mcp-server">`py#mcp-server`</Link> or <Link path="/guides/ts-mcp-server">`ts#mcp-server`</Link> generators you can make use of the <Link path="/guides/connection/py-agent-mcp">`connection` generator</Link
|
|
265
|
+
For consuming MCP Servers which you have created using the <Link path="/guides/py-mcp-server">`py#mcp-server`</Link> or <Link path="/guides/ts-mcp-server">`ts#mcp-server`</Link> generators you can make use of the <Link path="/guides/connection/py-agent-mcp">`connection` generator</Link>, which wires the MCP server's tools into your agent for both frameworks.
|
|
217
266
|
|
|
218
267
|
<RunGenerator generator="connection" />
|
|
219
268
|
|
|
220
269
|
Refer to the <Link path="/guides/connection/py-agent-mcp">`connection` generator guide</Link> for details about how the connection is set up.
|
|
221
270
|
|
|
222
|
-
For other MCP servers,
|
|
271
|
+
For other MCP servers, refer to the [Strands](https://strandsagents.com/docs/user-guide/concepts/tools/mcp-tools/) or [LangChain](https://docs.langchain.com/oss/python/langchain/mcp) MCP documentation.
|
|
223
272
|
|
|
224
273
|
### More
|
|
225
274
|
|
|
226
|
-
For a more in-depth guide to writing
|
|
275
|
+
For a more in-depth guide to writing agents, refer to the [Strands](https://strandsagents.com/docs/user-guide/quickstart/overview/) or [LangChain](https://docs.langchain.com/oss/python/langchain/overview) documentation.
|
|
227
276
|
|
|
228
277
|
## Protocol
|
|
229
278
|
|
|
230
279
|
Your agent's server protocol determines how it communicates. All options are served by [FastAPI](https://fastapi.tiangolo.com/) — the entry point differs:
|
|
231
280
|
|
|
232
281
|
- **HTTP** (default): A standard FastAPI server with a custom `/invocations` endpoint, CORS, and streaming. Best for custom client integrations.
|
|
233
|
-
- **A2A**:
|
|
234
|
-
- **AG-UI**: The [
|
|
282
|
+
- **A2A**: An [Agent-to-Agent](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-a2a.html) server mounted onto a FastAPI app (Strands uses the [Strands A2A Server](https://strandsagents.com/docs/user-guide/concepts/multi-agent/agent-to-agent); LangChain uses the framework-agnostic [`a2a-sdk`](https://a2a-protocol.org/)). Best when your agent needs to be discoverable and invokable by other A2A-compatible agents.
|
|
283
|
+
- **AG-UI**: The [AG-UI protocol](https://docs.ag-ui.com/) over SSE (Strands uses `ag-ui-strands`; LangChain uses `ag-ui-langgraph`). Best for direct frontend integration with [CopilotKit](https://docs.copilotkit.ai/) in a React website.
|
|
284
|
+
|
|
285
|
+
The server entry point differs by framework (Strands yields a context-managed `Agent`, while LangChain drives a compiled `create_agent` graph), but the external contract for each protocol is the same.
|
|
235
286
|
|
|
236
287
|
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
288
|
|
|
@@ -322,20 +373,23 @@ Since the generator vends CDK or Terraform infrastructure which manages deployin
|
|
|
322
373
|
<OptionFilter when={{ protocol: 'a2a' }} description="A2A server details">
|
|
323
374
|
## A2A Server (A2A protocol)
|
|
324
375
|
|
|
325
|
-
The generated `main.py` mounts
|
|
376
|
+
The generated `main.py` mounts an A2A server onto a parent FastAPI app that also exposes `/ping`. Strands agents use the Strands `A2AServer`; LangChain agents wrap the compiled graph in an [`a2a-sdk`](https://a2a-protocol.org/) `AgentExecutor`. When deployed to AgentCore, the entry point resolves the runtime's public ARN from AppConfig and advertises it in the agent card.
|
|
326
377
|
|
|
327
|
-
Most users will not need to modify this file
|
|
378
|
+
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's `name` and `description`.
|
|
328
379
|
</OptionFilter>
|
|
329
380
|
|
|
330
381
|
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / CopilotKit server details">
|
|
331
382
|
## AG-UI Server (AG-UI protocol)
|
|
332
383
|
|
|
333
|
-
The generated `main.py`
|
|
384
|
+
The generated `main.py` 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. The wiring depends on the framework:
|
|
385
|
+
|
|
386
|
+
- **Strands**: wraps your `Agent` in an `ag_ui_strands.StrandsAgent` and creates the FastAPI app via `create_strands_app()`.
|
|
387
|
+
- **LangChain**: wraps the compiled graph in an `ag_ui_langgraph.LangGraphAgent` and serves it from a hand-rolled FastAPI `/invocations` loop.
|
|
334
388
|
|
|
335
389
|
Most users will not need to modify this file — edit `agent.py` to change tools or the system prompt.
|
|
336
390
|
|
|
337
391
|
:::tip[Connecting to a React website]
|
|
338
|
-
AG-UI agents are designed to be consumed directly by a frontend. Use the <Link path="/guides/connection/react-agui">`connection` generator</Link> to wire your React website up to the agent with a [CopilotKit](https://docs.copilotkit.ai/
|
|
392
|
+
AG-UI agents are designed to be consumed directly by a frontend. Use the <Link path="/guides/connection/react-agui">`connection` generator</Link> to wire your React website up to the agent with a [CopilotKit](https://docs.copilotkit.ai/) provider and [AG-UI HttpAgent](https://docs.ag-ui.com/) client.
|
|
339
393
|
:::
|
|
340
394
|
</OptionFilter>
|
|
341
395
|
|
|
@@ -514,9 +568,72 @@ Refer to the <Link path="/guides/connection/py-agent-a2a">`connection` generator
|
|
|
514
568
|
<OptionFilter when={{ protocol: 'ag-ui' }} description="AG-UI / React connection details">
|
|
515
569
|
### Invoking an AG-UI Agent
|
|
516
570
|
|
|
517
|
-
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/
|
|
571
|
+
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/) client configured for your deployed agent with the correct authentication (IAM or Cognito).
|
|
518
572
|
|
|
519
573
|
<RunGenerator generator="connection" />
|
|
520
574
|
|
|
521
575
|
Refer to the <Link path="/guides/connection/react-agui">`connection` generator guide</Link> for details about how the connection is set up.
|
|
522
576
|
</OptionFilter>
|
|
577
|
+
|
|
578
|
+
## Connections
|
|
579
|
+
|
|
580
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
581
|
+
|
|
582
|
+
<CardGrid>
|
|
583
|
+
<ConnectionCard
|
|
584
|
+
title="React to Python Agent"
|
|
585
|
+
description="Call a Python Agent from a React website"
|
|
586
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-py-agent`}
|
|
587
|
+
source="react"
|
|
588
|
+
target="strands"
|
|
589
|
+
targetBadge="python"
|
|
590
|
+
/>
|
|
591
|
+
<ConnectionCard
|
|
592
|
+
title="React to AG-UI Agent"
|
|
593
|
+
description="Call an Agent exposing the AG-UI protocol from a React website via CopilotKit"
|
|
594
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-agui`}
|
|
595
|
+
source="react"
|
|
596
|
+
target="copilotkit"
|
|
597
|
+
/>
|
|
598
|
+
<ConnectionCard
|
|
599
|
+
title="Python Agent to MCP"
|
|
600
|
+
description="Connect a Python Agent to an MCP server"
|
|
601
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-mcp`}
|
|
602
|
+
source="strands"
|
|
603
|
+
sourceBadge="python"
|
|
604
|
+
target="mcp"
|
|
605
|
+
/>
|
|
606
|
+
<ConnectionCard
|
|
607
|
+
title="Python Agent to A2A Agent"
|
|
608
|
+
description="Connect a Python Agent to a remote A2A agent"
|
|
609
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-a2a`}
|
|
610
|
+
source="strands"
|
|
611
|
+
sourceBadge="python"
|
|
612
|
+
target="a2a"
|
|
613
|
+
/>
|
|
614
|
+
<ConnectionCard
|
|
615
|
+
title="TypeScript Agent to A2A Agent"
|
|
616
|
+
description="Connect a TypeScript Agent to a remote A2A agent"
|
|
617
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-a2a`}
|
|
618
|
+
source="strands"
|
|
619
|
+
sourceBadge="typescript"
|
|
620
|
+
target="a2a"
|
|
621
|
+
/>
|
|
622
|
+
<ConnectionCard
|
|
623
|
+
title="Python Agent to Python DynamoDB"
|
|
624
|
+
description="Connect a Python Agent to a DynamoDB table"
|
|
625
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-dynamodb`}
|
|
626
|
+
source="strands"
|
|
627
|
+
sourceBadge="python"
|
|
628
|
+
target="dynamodb"
|
|
629
|
+
targetBadge="python"
|
|
630
|
+
/>
|
|
631
|
+
<ConnectionCard
|
|
632
|
+
title="Python Agent to AgentCore Gateway"
|
|
633
|
+
description="Connect a Python Agent to an AgentCore Gateway"
|
|
634
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-gateway`}
|
|
635
|
+
source="strands"
|
|
636
|
+
sourceBadge="python"
|
|
637
|
+
target="agentcore"
|
|
638
|
+
/>
|
|
639
|
+
</CardGrid>
|
|
@@ -4,7 +4,9 @@ description: Create a Python DynamoDB project
|
|
|
4
4
|
generator: py#dynamodb
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileTree } from '@astrojs/starlight/components';
|
|
7
|
+
import { FileTree, CardGrid } from '@astrojs/starlight/components';
|
|
8
|
+
import Astro from '@astrojs/react';
|
|
9
|
+
import ConnectionCard from '@components/connection-card.astro';
|
|
8
10
|
import Link from '@components/link.astro';
|
|
9
11
|
import RunGenerator from '@components/run-generator.astro';
|
|
10
12
|
import GeneratorParameters from '@components/generator-parameters.astro';
|
|
@@ -436,14 +438,39 @@ item = ExampleModel.get_by_id('123')
|
|
|
436
438
|
When running in AWS, `get_table_name()` fetches the table name from AWS AppConfig using the `RUNTIME_CONFIG_APP_ID` environment variable. Projects built with this plugin already have this variable configured automatically. For other Python projects, ensure `RUNTIME_CONFIG_APP_ID` is set in the runtime environment with the AppConfig application ID provisioned by your infrastructure. For more information, see the <Link path="guides/runtime-config">Runtime Configuration guide</Link>.
|
|
437
439
|
:::
|
|
438
440
|
|
|
439
|
-
### Connection Generators
|
|
440
|
-
|
|
441
|
-
For specific project types, use the `connection` generator to automatically wire up local development dependencies so DynamoDB Local starts automatically alongside your project, and add the DynamoDB package as a workspace dependency:
|
|
442
|
-
|
|
443
|
-
- <Link path="guides/connection/py-fast-api-dynamodb">FastAPI → DynamoDB</Link>
|
|
444
|
-
- <Link path="guides/connection/py-agent-dynamodb">Python Agent → DynamoDB</Link>
|
|
445
|
-
- <Link path="guides/connection/py-mcp-server-dynamodb">Python MCP Server → DynamoDB</Link>
|
|
446
|
-
|
|
447
441
|
## Deploying your Table
|
|
448
442
|
|
|
449
443
|
<Snippet name="dynamodb/deploying-table" parentHeading="Deploying your Table" />
|
|
444
|
+
|
|
445
|
+
## Connections
|
|
446
|
+
|
|
447
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
448
|
+
|
|
449
|
+
<CardGrid>
|
|
450
|
+
<ConnectionCard
|
|
451
|
+
title="FastAPI to Python DynamoDB"
|
|
452
|
+
description="Connect a FastAPI to a DynamoDB table"
|
|
453
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-fast-api-dynamodb`}
|
|
454
|
+
source="fastapi"
|
|
455
|
+
target="dynamodb"
|
|
456
|
+
targetBadge="python"
|
|
457
|
+
/>
|
|
458
|
+
<ConnectionCard
|
|
459
|
+
title="Python Agent to Python DynamoDB"
|
|
460
|
+
description="Connect a Python Agent to a DynamoDB table"
|
|
461
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-dynamodb`}
|
|
462
|
+
source="strands"
|
|
463
|
+
sourceBadge="python"
|
|
464
|
+
target="dynamodb"
|
|
465
|
+
targetBadge="python"
|
|
466
|
+
/>
|
|
467
|
+
<ConnectionCard
|
|
468
|
+
title="Python MCP Server to Python DynamoDB"
|
|
469
|
+
description="Connect a Python MCP Server to a DynamoDB table"
|
|
470
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-mcp-server-dynamodb`}
|
|
471
|
+
source="mcp"
|
|
472
|
+
sourceBadge="python"
|
|
473
|
+
target="dynamodb"
|
|
474
|
+
targetBadge="python"
|
|
475
|
+
/>
|
|
476
|
+
</CardGrid>
|
|
@@ -4,7 +4,9 @@ description: Generate a Python Model Context Protocol (MCP) server for providing
|
|
|
4
4
|
generator: py#mcp-server
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
import { FileTree } from '@astrojs/starlight/components';
|
|
7
|
+
import { FileTree, 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';
|
|
@@ -163,3 +165,42 @@ A `docker` target specific to your MCP server is also added, which copies the `D
|
|
|
163
165
|
|
|
164
166
|
<Snippet name="mcp/observability" parentHeading="Observability" />
|
|
165
167
|
</OptionFilter>
|
|
168
|
+
|
|
169
|
+
## Connections
|
|
170
|
+
|
|
171
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
172
|
+
|
|
173
|
+
<CardGrid>
|
|
174
|
+
<ConnectionCard
|
|
175
|
+
title="TypeScript Agent to MCP"
|
|
176
|
+
description="Connect a TypeScript Agent to an MCP server"
|
|
177
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/ts-agent-mcp`}
|
|
178
|
+
source="strands"
|
|
179
|
+
sourceBadge="typescript"
|
|
180
|
+
target="mcp"
|
|
181
|
+
/>
|
|
182
|
+
<ConnectionCard
|
|
183
|
+
title="Python Agent to MCP"
|
|
184
|
+
description="Connect a Python Agent to an MCP server"
|
|
185
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-agent-mcp`}
|
|
186
|
+
source="strands"
|
|
187
|
+
sourceBadge="python"
|
|
188
|
+
target="mcp"
|
|
189
|
+
/>
|
|
190
|
+
<ConnectionCard
|
|
191
|
+
title="Python MCP Server to Python DynamoDB"
|
|
192
|
+
description="Connect a Python MCP Server to a DynamoDB table"
|
|
193
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/py-mcp-server-dynamodb`}
|
|
194
|
+
source="mcp"
|
|
195
|
+
sourceBadge="python"
|
|
196
|
+
target="dynamodb"
|
|
197
|
+
targetBadge="python"
|
|
198
|
+
/>
|
|
199
|
+
<ConnectionCard
|
|
200
|
+
title="AgentCore Gateway to MCP Server"
|
|
201
|
+
description="Aggregate an MCP server behind an AgentCore Gateway"
|
|
202
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/agentcore-gateway-mcp`}
|
|
203
|
+
source="agentcore"
|
|
204
|
+
target="mcp"
|
|
205
|
+
/>
|
|
206
|
+
</CardGrid>
|
|
@@ -6,7 +6,9 @@ when:
|
|
|
6
6
|
framework:
|
|
7
7
|
- react
|
|
8
8
|
---
|
|
9
|
-
import { FileTree, Steps } from '@astrojs/starlight/components';
|
|
9
|
+
import { FileTree, Steps, 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';
|
|
@@ -430,3 +432,53 @@ provider "aws" {
|
|
|
430
432
|
</Fragment>
|
|
431
433
|
</Infrastructure>
|
|
432
434
|
|
|
435
|
+
## Connections
|
|
436
|
+
|
|
437
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
438
|
+
|
|
439
|
+
<CardGrid>
|
|
440
|
+
<ConnectionCard
|
|
441
|
+
title="React to tRPC"
|
|
442
|
+
description="Call a tRPC API from a React website"
|
|
443
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-trpc`}
|
|
444
|
+
source="react"
|
|
445
|
+
target="trpc"
|
|
446
|
+
/>
|
|
447
|
+
<ConnectionCard
|
|
448
|
+
title="React to FastAPI"
|
|
449
|
+
description="Call a Python FastAPI from a React website"
|
|
450
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-fastapi`}
|
|
451
|
+
source="react"
|
|
452
|
+
target="fastapi"
|
|
453
|
+
/>
|
|
454
|
+
<ConnectionCard
|
|
455
|
+
title="React to Smithy API"
|
|
456
|
+
description="Call a Smithy API from a React website"
|
|
457
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-smithy`}
|
|
458
|
+
source="react"
|
|
459
|
+
target="smithy"
|
|
460
|
+
/>
|
|
461
|
+
<ConnectionCard
|
|
462
|
+
title="React to Python Agent"
|
|
463
|
+
description="Call a Python Agent from a React website"
|
|
464
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-py-agent`}
|
|
465
|
+
source="react"
|
|
466
|
+
target="strands"
|
|
467
|
+
targetBadge="python"
|
|
468
|
+
/>
|
|
469
|
+
<ConnectionCard
|
|
470
|
+
title="React to TypeScript Agent"
|
|
471
|
+
description="Call a TypeScript Agent from a React website"
|
|
472
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-ts-agent`}
|
|
473
|
+
source="react"
|
|
474
|
+
target="strands"
|
|
475
|
+
targetBadge="typescript"
|
|
476
|
+
/>
|
|
477
|
+
<ConnectionCard
|
|
478
|
+
title="React to AG-UI Agent"
|
|
479
|
+
description="Call an Agent exposing the AG-UI protocol from a React website via CopilotKit"
|
|
480
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-agui`}
|
|
481
|
+
source="react"
|
|
482
|
+
target="copilotkit"
|
|
483
|
+
/>
|
|
484
|
+
</CardGrid>
|
package/docs/guides/trpc.mdx
CHANGED
|
@@ -6,7 +6,9 @@ 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';
|
|
@@ -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
|
|
|
@@ -817,3 +819,31 @@ If you are calling your API from a React website, consider using the <Link path=
|
|
|
817
819
|
## More Information
|
|
818
820
|
|
|
819
821
|
For more information about tRPC, please refer to the [tRPC documentation](https://trpc.io/docs).
|
|
822
|
+
|
|
823
|
+
## Connections
|
|
824
|
+
|
|
825
|
+
Use the <Link path="guides/connection">`connection`</Link> generator to integrate this project with others in your workspace. The following connections involve this project:
|
|
826
|
+
|
|
827
|
+
<CardGrid>
|
|
828
|
+
<ConnectionCard
|
|
829
|
+
title="React to tRPC"
|
|
830
|
+
description="Call a tRPC API from a React website"
|
|
831
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/react-trpc`}
|
|
832
|
+
source="react"
|
|
833
|
+
target="trpc"
|
|
834
|
+
/>
|
|
835
|
+
<ConnectionCard
|
|
836
|
+
title="tRPC API to Relational Database"
|
|
837
|
+
description="Connect a tRPC API to an Aurora relational database"
|
|
838
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-rdb`}
|
|
839
|
+
source="trpc"
|
|
840
|
+
target="aurora"
|
|
841
|
+
/>
|
|
842
|
+
<ConnectionCard
|
|
843
|
+
title="tRPC API to TypeScript DynamoDB"
|
|
844
|
+
description="Connect a tRPC API to a DynamoDB table"
|
|
845
|
+
href={`/nx-plugin-for-aws/${Astro.currentLocale || 'en'}/guides/connection/trpc-dynamodb`}
|
|
846
|
+
source="trpc"
|
|
847
|
+
target="dynamodb"
|
|
848
|
+
/>
|
|
849
|
+
</CardGrid>
|