serverless-bedrock-agentcore-plugin 0.1.0
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/CHANGELOG.md +52 -0
- package/LICENSE +21 -0
- package/README.md +476 -0
- package/package.json +96 -0
- package/src/compilers/browser.js +110 -0
- package/src/compilers/codeInterpreter.js +64 -0
- package/src/compilers/gateway.js +98 -0
- package/src/compilers/gatewayTarget.js +285 -0
- package/src/compilers/index.js +15 -0
- package/src/compilers/memory.js +168 -0
- package/src/compilers/runtime.js +234 -0
- package/src/compilers/runtimeEndpoint.js +37 -0
- package/src/compilers/workloadIdentity.js +36 -0
- package/src/docker/builder.js +236 -0
- package/src/iam/policies.js +591 -0
- package/src/index.js +1354 -0
- package/src/utils/index.js +9 -0
- package/src/utils/naming.js +79 -0
- package/src/utils/tags.js +56 -0
- package/src/validators/schema.js +250 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0] - 2025-12-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Initial release of serverless-bedrock-agentcore plugin
|
|
15
|
+
- Support for AWS::BedrockAgentCore::Runtime resource
|
|
16
|
+
- Container image and S3 artifact support
|
|
17
|
+
- Network configuration (PUBLIC and VPC modes)
|
|
18
|
+
- Protocol configuration (HTTP, MCP, A2A)
|
|
19
|
+
- Environment variables
|
|
20
|
+
- Authorizer configuration (AWS_IAM, CUSTOM_JWT)
|
|
21
|
+
- Lifecycle configuration
|
|
22
|
+
- Support for AWS::BedrockAgentCore::RuntimeEndpoint resource
|
|
23
|
+
- Multiple endpoints per runtime
|
|
24
|
+
- Version targeting
|
|
25
|
+
- Support for AWS::BedrockAgentCore::Memory resource
|
|
26
|
+
- Event expiry duration configuration
|
|
27
|
+
- Memory strategies (semantic, userPreference, summary, custom)
|
|
28
|
+
- Encryption key support
|
|
29
|
+
- Support for AWS::BedrockAgentCore::Gateway resource
|
|
30
|
+
- AWS_IAM and CUSTOM_JWT authorization
|
|
31
|
+
- MCP protocol support
|
|
32
|
+
- KMS encryption support
|
|
33
|
+
- Support for AWS::BedrockAgentCore::GatewayTarget resource
|
|
34
|
+
- Lambda function targets
|
|
35
|
+
- OpenAPI specification targets
|
|
36
|
+
- Smithy model targets
|
|
37
|
+
- OAuth and API Key credential providers
|
|
38
|
+
- Automatic IAM role generation with least-privilege permissions
|
|
39
|
+
- Schema validation for serverless.yml configuration
|
|
40
|
+
- Custom command: `sls agentcore info`
|
|
41
|
+
- CloudFormation outputs for all resources
|
|
42
|
+
- Automatic tagging with service, stage, and resource metadata
|
|
43
|
+
- Example projects:
|
|
44
|
+
- basic-runtime: Simple runtime deployment
|
|
45
|
+
- with-memory: Runtime with conversation memory
|
|
46
|
+
- full-stack: Complete setup with runtime, memory, gateway, and Lambda functions
|
|
47
|
+
|
|
48
|
+
### Security
|
|
49
|
+
|
|
50
|
+
- IAM roles follow least-privilege principle
|
|
51
|
+
- Support for KMS encryption for Memory and Gateway resources
|
|
52
|
+
- Support for VPC deployment for Runtime resources
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 The serverless-bedrock-agentcore-plugin contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,476 @@
|
|
|
1
|
+
# serverless-bedrock-agentcore
|
|
2
|
+
|
|
3
|
+
Deploy AWS Bedrock AgentCore resources with Serverless Framework.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Define AgentCore resources in `serverless.yml`
|
|
8
|
+
- Supports all AgentCore resource types:
|
|
9
|
+
- **Runtime** - Deploy containerized AI agents
|
|
10
|
+
- **Memory** - Conversation history with semantic search
|
|
11
|
+
- **Gateway** - External API integrations
|
|
12
|
+
- **Browser** - Web browsing capabilities
|
|
13
|
+
- **CodeInterpreter** - Sandboxed code execution
|
|
14
|
+
- **WorkloadIdentity** - OAuth2 authentication
|
|
15
|
+
- Auto-generates IAM roles with least-privilege permissions
|
|
16
|
+
- Automatic tagging and naming conventions
|
|
17
|
+
- CloudFormation outputs for cross-stack references
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install serverless-bedrock-agentcore --save-dev
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Add to `serverless.yml`:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
plugins:
|
|
29
|
+
- serverless-bedrock-agentcore
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
service: my-agent
|
|
36
|
+
|
|
37
|
+
provider:
|
|
38
|
+
name: aws
|
|
39
|
+
region: us-east-1
|
|
40
|
+
|
|
41
|
+
plugins:
|
|
42
|
+
- serverless-bedrock-agentcore
|
|
43
|
+
|
|
44
|
+
agents:
|
|
45
|
+
myAgent:
|
|
46
|
+
type: runtime
|
|
47
|
+
description: My AI agent
|
|
48
|
+
handler:
|
|
49
|
+
type: docker
|
|
50
|
+
image:
|
|
51
|
+
dockerfile: ./Dockerfile
|
|
52
|
+
context: .
|
|
53
|
+
protocol: AWS_MCP
|
|
54
|
+
networkMode: PUBLIC
|
|
55
|
+
authorizationConfig:
|
|
56
|
+
authorizationType: NONE
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Resource Types
|
|
60
|
+
|
|
61
|
+
### Runtime
|
|
62
|
+
|
|
63
|
+
Deploy containerized AI agents with the AgentCore Runtime.
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
agents:
|
|
67
|
+
myAgent:
|
|
68
|
+
type: runtime
|
|
69
|
+
description: My AI agent
|
|
70
|
+
handler:
|
|
71
|
+
type: docker
|
|
72
|
+
image:
|
|
73
|
+
dockerfile: ./Dockerfile
|
|
74
|
+
context: .
|
|
75
|
+
protocol: AWS_MCP # AWS_MCP, HTTP, or A2A
|
|
76
|
+
networkMode: PUBLIC # PUBLIC or VPC
|
|
77
|
+
authorizationConfig:
|
|
78
|
+
authorizationType: NONE # NONE or AWS_IAM
|
|
79
|
+
# Optional: Pass specific headers to the runtime
|
|
80
|
+
requestHeaders:
|
|
81
|
+
allowlist:
|
|
82
|
+
- X-User-Id
|
|
83
|
+
- X-Session-Id
|
|
84
|
+
- Authorization
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
| Property | Required | Description |
|
|
88
|
+
| --------------------------------------- | -------- | ----------------------------------- |
|
|
89
|
+
| `type` | Yes | `runtime` |
|
|
90
|
+
| `handler.type` | Yes | `docker` |
|
|
91
|
+
| `handler.image.dockerfile` | Yes | Path to Dockerfile |
|
|
92
|
+
| `handler.image.context` | Yes | Docker build context |
|
|
93
|
+
| `protocol` | No | `AWS_MCP`, `HTTP`, or `A2A` |
|
|
94
|
+
| `networkMode` | No | `PUBLIC` or `VPC` |
|
|
95
|
+
| `authorizationConfig.authorizationType` | No | `NONE` or `AWS_IAM` |
|
|
96
|
+
| `requestHeaders.allowlist` | No | Headers to pass to runtime (max 20) |
|
|
97
|
+
| `description` | No | Runtime description |
|
|
98
|
+
| `roleArn` | No | Custom IAM role ARN |
|
|
99
|
+
|
|
100
|
+
### Memory
|
|
101
|
+
|
|
102
|
+
Store conversation history with semantic search and summarization.
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
agents:
|
|
106
|
+
conversationMemory:
|
|
107
|
+
type: memory
|
|
108
|
+
description: Conversation memory with semantic search
|
|
109
|
+
eventExpiryDuration: 90
|
|
110
|
+
strategies:
|
|
111
|
+
# Semantic search strategy
|
|
112
|
+
- SemanticMemoryStrategy:
|
|
113
|
+
Name: ConversationSearch
|
|
114
|
+
Type: SEMANTIC
|
|
115
|
+
Namespaces:
|
|
116
|
+
- /conversations/{sessionId}
|
|
117
|
+
SemanticMemoryConfiguration:
|
|
118
|
+
ModelId: amazon.titan-embed-text-v2:0
|
|
119
|
+
SimilarityThreshold: 0.75
|
|
120
|
+
|
|
121
|
+
# Summarization strategy
|
|
122
|
+
- SummaryMemoryStrategy:
|
|
123
|
+
Name: SessionSummary
|
|
124
|
+
Type: SUMMARIZATION
|
|
125
|
+
SummaryConfiguration:
|
|
126
|
+
SummaryModelId: anthropic.claude-3-haiku-20240307-v1:0
|
|
127
|
+
MaxMessages: 100
|
|
128
|
+
|
|
129
|
+
# User preference strategy
|
|
130
|
+
- UserPreferenceMemoryStrategy:
|
|
131
|
+
Name: UserPrefs
|
|
132
|
+
Type: USER_PREFERENCE
|
|
133
|
+
Namespaces:
|
|
134
|
+
- /users/{userId}/preferences
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Property | Required | Description |
|
|
138
|
+
| --------------------- | -------- | ----------------------------------- |
|
|
139
|
+
| `type` | Yes | `memory` |
|
|
140
|
+
| `eventExpiryDuration` | No | Days to retain (7-365, default: 30) |
|
|
141
|
+
| `strategies` | No | Memory strategies array |
|
|
142
|
+
| `description` | No | Memory description |
|
|
143
|
+
| `encryptionKeyArn` | No | KMS key for encryption |
|
|
144
|
+
| `roleArn` | No | Custom IAM role ARN |
|
|
145
|
+
|
|
146
|
+
#### Memory Strategy Types
|
|
147
|
+
|
|
148
|
+
**SemanticMemoryStrategy** - Semantic search over conversations:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
- SemanticMemoryStrategy:
|
|
152
|
+
Name: Search
|
|
153
|
+
Type: SEMANTIC
|
|
154
|
+
Namespaces:
|
|
155
|
+
- /sessions/{sessionId}
|
|
156
|
+
SemanticMemoryConfiguration:
|
|
157
|
+
ModelId: amazon.titan-embed-text-v2:0
|
|
158
|
+
SimilarityThreshold: 0.75
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
**SummaryMemoryStrategy** - Summarize long conversations:
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
- SummaryMemoryStrategy:
|
|
165
|
+
Name: Summary
|
|
166
|
+
Type: SUMMARIZATION
|
|
167
|
+
SummaryConfiguration:
|
|
168
|
+
SummaryModelId: anthropic.claude-3-haiku-20240307-v1:0
|
|
169
|
+
MaxMessages: 100
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**UserPreferenceMemoryStrategy** - Track user preferences:
|
|
173
|
+
|
|
174
|
+
```yaml
|
|
175
|
+
- UserPreferenceMemoryStrategy:
|
|
176
|
+
Name: Preferences
|
|
177
|
+
Type: USER_PREFERENCE
|
|
178
|
+
Namespaces:
|
|
179
|
+
- /users/{userId}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**CustomMemoryStrategy** - Custom memory handling:
|
|
183
|
+
|
|
184
|
+
```yaml
|
|
185
|
+
- CustomMemoryStrategy:
|
|
186
|
+
Name: Custom
|
|
187
|
+
Type: CUSTOM
|
|
188
|
+
CustomConfiguration:
|
|
189
|
+
key: value
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Browser
|
|
193
|
+
|
|
194
|
+
Enable web browsing capabilities for agents.
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
agents:
|
|
198
|
+
webBrowser:
|
|
199
|
+
type: browser
|
|
200
|
+
description: Web browser for agent
|
|
201
|
+
network:
|
|
202
|
+
networkMode: PUBLIC # PUBLIC or VPC
|
|
203
|
+
signing:
|
|
204
|
+
enabled: true
|
|
205
|
+
recording:
|
|
206
|
+
enabled: true
|
|
207
|
+
s3Location:
|
|
208
|
+
bucket: my-recordings-bucket
|
|
209
|
+
prefix: browser-sessions/
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
| Property | Required | Description |
|
|
213
|
+
| ---------------------- | -------- | ----------------------------------------- |
|
|
214
|
+
| `type` | Yes | `browser` |
|
|
215
|
+
| `network.networkMode` | No | `PUBLIC` or `VPC` (default: `PUBLIC`) |
|
|
216
|
+
| `network.vpcConfig` | No | VPC configuration (required for VPC mode) |
|
|
217
|
+
| `signing.enabled` | No | Enable request signing |
|
|
218
|
+
| `recording.enabled` | No | Enable session recording |
|
|
219
|
+
| `recording.s3Location` | No | S3 bucket/prefix for recordings |
|
|
220
|
+
| `description` | No | Browser description |
|
|
221
|
+
| `roleArn` | No | Custom IAM role ARN |
|
|
222
|
+
|
|
223
|
+
### CodeInterpreter
|
|
224
|
+
|
|
225
|
+
Enable sandboxed code execution.
|
|
226
|
+
|
|
227
|
+
```yaml
|
|
228
|
+
agents:
|
|
229
|
+
codeExecutor:
|
|
230
|
+
type: codeInterpreter
|
|
231
|
+
description: Python code execution
|
|
232
|
+
network:
|
|
233
|
+
networkMode: SANDBOX # SANDBOX, PUBLIC, or VPC
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
| Property | Required | Description |
|
|
237
|
+
| --------------------- | -------- | -------------------------------------------------- |
|
|
238
|
+
| `type` | Yes | `codeInterpreter` |
|
|
239
|
+
| `network.networkMode` | No | `SANDBOX`, `PUBLIC`, or `VPC` (default: `SANDBOX`) |
|
|
240
|
+
| `network.vpcConfig` | No | VPC configuration (required for VPC mode) |
|
|
241
|
+
| `description` | No | CodeInterpreter description |
|
|
242
|
+
| `roleArn` | No | Custom IAM role ARN |
|
|
243
|
+
|
|
244
|
+
### WorkloadIdentity
|
|
245
|
+
|
|
246
|
+
Enable OAuth2 authentication for agents.
|
|
247
|
+
|
|
248
|
+
```yaml
|
|
249
|
+
agents:
|
|
250
|
+
agentIdentity:
|
|
251
|
+
type: workloadIdentity
|
|
252
|
+
oauth2ReturnUrls:
|
|
253
|
+
- https://example.com/callback
|
|
254
|
+
- http://localhost:3000/auth/callback
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
| Property | Required | Description |
|
|
258
|
+
| ------------------ | -------- | ---------------------------- |
|
|
259
|
+
| `type` | Yes | `workloadIdentity` |
|
|
260
|
+
| `oauth2ReturnUrls` | No | Allowed OAuth2 redirect URLs |
|
|
261
|
+
|
|
262
|
+
### Gateway
|
|
263
|
+
|
|
264
|
+
Integrate external APIs as agent tools.
|
|
265
|
+
|
|
266
|
+
```yaml
|
|
267
|
+
agents:
|
|
268
|
+
apiGateway:
|
|
269
|
+
type: gateway
|
|
270
|
+
description: External API gateway
|
|
271
|
+
authorizationType: NONE
|
|
272
|
+
targets:
|
|
273
|
+
weatherApi:
|
|
274
|
+
type: lambdaArn
|
|
275
|
+
lambdaArn:
|
|
276
|
+
Fn::GetAtt:
|
|
277
|
+
- WeatherFunction
|
|
278
|
+
- Arn
|
|
279
|
+
name: WeatherAPI
|
|
280
|
+
description: Get weather data
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
| Property | Required | Description |
|
|
284
|
+
| ------------------- | -------- | ---------------------------------- |
|
|
285
|
+
| `type` | Yes | `gateway` |
|
|
286
|
+
| `authorizationType` | No | `NONE` or `AWS_IAM` |
|
|
287
|
+
| `targets` | No | Gateway targets (Lambda functions) |
|
|
288
|
+
| `description` | No | Gateway description |
|
|
289
|
+
| `roleArn` | No | Custom IAM role ARN |
|
|
290
|
+
|
|
291
|
+
## Commands
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
sls agentcore info # Show defined resources
|
|
295
|
+
sls package # Generate CloudFormation
|
|
296
|
+
sls deploy # Deploy to AWS
|
|
297
|
+
sls remove # Remove deployed resources
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
## Examples
|
|
301
|
+
|
|
302
|
+
The `examples/` directory contains complete working examples:
|
|
303
|
+
|
|
304
|
+
### Full-Stack Agent (`examples/full-stack-agent/`)
|
|
305
|
+
|
|
306
|
+
A comprehensive example showing all resource types working together:
|
|
307
|
+
|
|
308
|
+
- Runtime with Docker handler
|
|
309
|
+
- Memory with multiple strategies
|
|
310
|
+
- Browser for web interactions
|
|
311
|
+
- CodeInterpreter for code execution
|
|
312
|
+
- WorkloadIdentity for OAuth2
|
|
313
|
+
- Gateway for external APIs
|
|
314
|
+
|
|
315
|
+
### Memory Strategies (`examples/memory-strategies/`)
|
|
316
|
+
|
|
317
|
+
Detailed examples of all memory strategy types:
|
|
318
|
+
|
|
319
|
+
- Semantic search configuration
|
|
320
|
+
- Summarization settings
|
|
321
|
+
- User preference tracking
|
|
322
|
+
- Custom strategies
|
|
323
|
+
- Multi-strategy memory
|
|
324
|
+
|
|
325
|
+
### Browser & CodeInterpreter (`examples/browser-code-interpreter/`)
|
|
326
|
+
|
|
327
|
+
Examples of browser and code interpreter configurations:
|
|
328
|
+
|
|
329
|
+
- Public, VPC, and sandbox network modes
|
|
330
|
+
- Session recording
|
|
331
|
+
- Request signing
|
|
332
|
+
- Custom IAM roles
|
|
333
|
+
|
|
334
|
+
### Google ADK (`examples/google-adk/`)
|
|
335
|
+
|
|
336
|
+
Deploy a Google ADK agent to AWS Bedrock AgentCore.
|
|
337
|
+
|
|
338
|
+
### Strands Framework Examples
|
|
339
|
+
|
|
340
|
+
The [Strands Agents SDK](https://github.com/strands-agents/sdk-python) is a lightweight, model-driven framework for building AI agents. These examples show how to deploy Strands agents to AgentCore:
|
|
341
|
+
|
|
342
|
+
#### Strands Basic (`examples/strands-basic/`)
|
|
343
|
+
|
|
344
|
+
Simple Strands agent with custom tools:
|
|
345
|
+
|
|
346
|
+
- Custom `@tool` decorated functions
|
|
347
|
+
- Basic prompt/response flow
|
|
348
|
+
- Minimal setup example
|
|
349
|
+
|
|
350
|
+
```python
|
|
351
|
+
from strands import Agent, tool
|
|
352
|
+
|
|
353
|
+
@tool
|
|
354
|
+
def get_weather(location: str) -> str:
|
|
355
|
+
"""Get weather for a location."""
|
|
356
|
+
return f"Weather in {location}: Sunny, 72°F"
|
|
357
|
+
|
|
358
|
+
agent = Agent(
|
|
359
|
+
model="us.anthropic.claude-3-7-sonnet-20250219-v1:0",
|
|
360
|
+
tools=[get_weather],
|
|
361
|
+
)
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
#### Strands Streaming (`examples/strands-streaming/`)
|
|
365
|
+
|
|
366
|
+
Async agent with streaming responses:
|
|
367
|
+
|
|
368
|
+
- `stream_async()` for real-time streaming
|
|
369
|
+
- Async event iteration
|
|
370
|
+
- Suitable for long-form responses
|
|
371
|
+
|
|
372
|
+
#### Strands Memory (`examples/strands-memory/`)
|
|
373
|
+
|
|
374
|
+
Agent with AgentCore Memory integration:
|
|
375
|
+
|
|
376
|
+
- MemoryHook provider for automatic memory ops
|
|
377
|
+
- Short-term memory (within session)
|
|
378
|
+
- Long-term memory with semantic search
|
|
379
|
+
- User preference tracking
|
|
380
|
+
|
|
381
|
+
#### Strands MCP Tools (`examples/strands-mcp-tools/`)
|
|
382
|
+
|
|
383
|
+
Agent with Gateway/MCP tool integration:
|
|
384
|
+
|
|
385
|
+
- MCP protocol for tool discovery
|
|
386
|
+
- Gateway targets with Lambda functions
|
|
387
|
+
- Dynamic tool registration
|
|
388
|
+
|
|
389
|
+
#### Strands OAuth Identity (`examples/strands-oauth-identity/`)
|
|
390
|
+
|
|
391
|
+
Agent with WorkloadIdentity for external API credentials:
|
|
392
|
+
|
|
393
|
+
- `@requires_api_key` decorator for secure credential retrieval
|
|
394
|
+
- OAuth2 flows for external services (OpenAI, GitHub)
|
|
395
|
+
- Secure credential storage without hardcoding
|
|
396
|
+
|
|
397
|
+
#### Strands Cognito JWT (`examples/strands-cognito-jwt/`)
|
|
398
|
+
|
|
399
|
+
Agent protected by Cognito JWT authentication:
|
|
400
|
+
|
|
401
|
+
- CustomJWTAuthorizer configuration
|
|
402
|
+
- Cognito User Pool and Client setup
|
|
403
|
+
- JWT token validation at AgentCore level
|
|
404
|
+
- Secure endpoints requiring authentication
|
|
405
|
+
|
|
406
|
+
## Configuration Options
|
|
407
|
+
|
|
408
|
+
### Default Tags
|
|
409
|
+
|
|
410
|
+
Apply tags to all resources:
|
|
411
|
+
|
|
412
|
+
```yaml
|
|
413
|
+
custom:
|
|
414
|
+
agentCore:
|
|
415
|
+
defaultTags:
|
|
416
|
+
Project: MyProject
|
|
417
|
+
Environment: ${self:provider.stage}
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
### VPC Configuration
|
|
421
|
+
|
|
422
|
+
For resources that support VPC mode:
|
|
423
|
+
|
|
424
|
+
```yaml
|
|
425
|
+
network:
|
|
426
|
+
networkMode: VPC
|
|
427
|
+
vpcConfig:
|
|
428
|
+
subnetIds:
|
|
429
|
+
- subnet-12345678
|
|
430
|
+
- subnet-87654321
|
|
431
|
+
securityGroupIds:
|
|
432
|
+
- sg-12345678
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
### Custom IAM Roles
|
|
436
|
+
|
|
437
|
+
Bring your own IAM roles:
|
|
438
|
+
|
|
439
|
+
```yaml
|
|
440
|
+
agents:
|
|
441
|
+
myAgent:
|
|
442
|
+
type: runtime
|
|
443
|
+
roleArn: arn:aws:iam::123456789012:role/MyCustomRole
|
|
444
|
+
# ... other config
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
## Migration Guide
|
|
448
|
+
|
|
449
|
+
### Memory Strategy Format (v0.2.0+)
|
|
450
|
+
|
|
451
|
+
The memory strategy format has changed to a typed union structure. The legacy format is deprecated but still supported with a warning.
|
|
452
|
+
|
|
453
|
+
**Legacy format (deprecated):**
|
|
454
|
+
|
|
455
|
+
```yaml
|
|
456
|
+
strategies:
|
|
457
|
+
- type: semantic
|
|
458
|
+
name: Search
|
|
459
|
+
configuration:
|
|
460
|
+
modelId: amazon.titan-embed-text-v2:0
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
**New format:**
|
|
464
|
+
|
|
465
|
+
```yaml
|
|
466
|
+
strategies:
|
|
467
|
+
- SemanticMemoryStrategy:
|
|
468
|
+
Name: Search
|
|
469
|
+
Type: SEMANTIC
|
|
470
|
+
SemanticMemoryConfiguration:
|
|
471
|
+
ModelId: amazon.titan-embed-text-v2:0
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
## License
|
|
475
|
+
|
|
476
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "serverless-bedrock-agentcore-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Serverless Framework plugin for AWS Bedrock AgentCore - deploy Runtime, Memory, and Gateway resources",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18.0.0"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"serverless",
|
|
11
|
+
"serverless-plugin",
|
|
12
|
+
"aws",
|
|
13
|
+
"bedrock",
|
|
14
|
+
"agentcore",
|
|
15
|
+
"ai-agents",
|
|
16
|
+
"mcp",
|
|
17
|
+
"cloudformation",
|
|
18
|
+
"lambda"
|
|
19
|
+
],
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"homepage": "https://github.com/LawProAI/serverless-bedrock-agentcore-plugin",
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/LawProAI/serverless-bedrock-agentcore-plugin.git"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/LawProAI/serverless-bedrock-agentcore-plugin/issues"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"serverless": ">=3.0.0 || >=4.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"eslint": "^8.57.0",
|
|
34
|
+
"eslint-config-prettier": "^9.1.0",
|
|
35
|
+
"husky": "^9.0.0",
|
|
36
|
+
"jest": "^29.7.0",
|
|
37
|
+
"js-yaml": "^4.1.0",
|
|
38
|
+
"lint-staged": "^15.2.0",
|
|
39
|
+
"prettier": "^3.2.0",
|
|
40
|
+
"sinon": "^17.0.0"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"test": "jest",
|
|
44
|
+
"test:unit": "jest test/unit",
|
|
45
|
+
"test:integration": "jest test/integration",
|
|
46
|
+
"test:watch": "jest --watch",
|
|
47
|
+
"test:coverage": "jest --coverage",
|
|
48
|
+
"lint": "eslint src/",
|
|
49
|
+
"lint:fix": "eslint src/ --fix",
|
|
50
|
+
"format": "prettier --write .",
|
|
51
|
+
"format:check": "prettier --check .",
|
|
52
|
+
"prepare": "husky",
|
|
53
|
+
"prepublishOnly": "npm test && npm run lint",
|
|
54
|
+
"examples:list": "./scripts/deploy-examples.sh --list",
|
|
55
|
+
"examples:info": "./scripts/deploy-examples.sh --info",
|
|
56
|
+
"examples:deploy": "./scripts/deploy-examples.sh --deploy",
|
|
57
|
+
"examples:deploy:parallel": "./scripts/deploy-examples.sh --deploy --parallel",
|
|
58
|
+
"examples:remove": "./scripts/deploy-examples.sh --remove"
|
|
59
|
+
},
|
|
60
|
+
"lint-staged": {
|
|
61
|
+
"*.js": [
|
|
62
|
+
"eslint --fix",
|
|
63
|
+
"prettier --write"
|
|
64
|
+
],
|
|
65
|
+
"*.{json,md,yml,yaml}": [
|
|
66
|
+
"prettier --write"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"jest": {
|
|
70
|
+
"testEnvironment": "node",
|
|
71
|
+
"testTimeout": 30000,
|
|
72
|
+
"testMatch": [
|
|
73
|
+
"**/test/**/*.test.js"
|
|
74
|
+
],
|
|
75
|
+
"collectCoverageFrom": [
|
|
76
|
+
"src/**/*.js"
|
|
77
|
+
],
|
|
78
|
+
"coveragePathIgnorePatterns": [
|
|
79
|
+
"/node_modules/",
|
|
80
|
+
"/test/"
|
|
81
|
+
],
|
|
82
|
+
"coverageThreshold": {
|
|
83
|
+
"global": {
|
|
84
|
+
"branches": 70,
|
|
85
|
+
"functions": 70,
|
|
86
|
+
"lines": 70,
|
|
87
|
+
"statements": 70
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"files": [
|
|
92
|
+
"src/**/*.js",
|
|
93
|
+
"README.md",
|
|
94
|
+
"CHANGELOG.md"
|
|
95
|
+
]
|
|
96
|
+
}
|