You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update quickstart example for agentcore-strands CI integration (#311)
* docs: update quickstart example for agentcore-strands CI integration
* fix: update Launch logs to match the new experience
---------
Co-authored-by: Sundar Raghavan <sdraghav@amazon.com>
@@ -8,10 +8,11 @@ For Gateway and Identity features, see the [Gateway quickstart](https://github.c
8
8
9
9
## Prerequisites
10
10
11
-
-**AWS Permissions**: Root users or privileged roles (such as admins) can skip this step. Others need to attach the [starter toolkit policy](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-permissions.html#runtime-permissions-starter-toolkit) and [AmazonBedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html) managed policy.
12
-
-[AWS CLI version 2.0 or later](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) configured (`aws configure`)
13
-
-**Amazon Bedrock model access enabled for Claude 3.7 Sonnet** (Go to AWS Console → Bedrock → Model access → Enable "Claude 3.7 Sonnet" in your region). For information about using a different model with Strands Agents, see the Model Providers section in the [Strands Agents SDK](https://strandsagents.com/latest/documentation/docs/) documentation.
14
-
- Python 3.10 or newer
11
+
Before you start, make sure you have:
12
+
13
+
-**AWS permissions**: AWS root users or users with privileged roles (such as the AdministratorAccess role) can skip this step. Others need to attach the [starter toolkit policy](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/runtime-permissions.html#runtime-permissions-starter-toolkit) and [AmazonBedrockAgentCoreFullAccess](https://docs.aws.amazon.com/aws-managed-policy/latest/reference/BedrockAgentCoreFullAccess.html) managed policy.
14
+
-**AWS CLI version 2.0 or later**: Configure the AWS CLI using `aws configure`. For more information, see the [AWS Command Line Interface User Guide for Version 2](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
15
+
-**Python 3.10 or newer**
15
16
16
17
> **Important: Ensure AWS Region Consistency**
17
18
>
@@ -21,18 +22,20 @@ For Gateway and Identity features, see the [Gateway quickstart](https://github.c
21
22
> - The region where you've enabled Bedrock model access
22
23
> - All resources created during deployment will use this region
23
24
24
-
### Installation (version 0.1.21 or later)
25
+
### Install the AgentCore starter toolkit
26
+
27
+
Install the AgentCore starter toolkit:
25
28
26
29
```bash
27
30
# Create virtual environment
28
31
python -m venv .venv
29
32
source .venv/bin/activate # On Windows: .venv\Scripts\activate
system_prompt="You are a helpful assistant. Use tools when appropriate.",
113
-
tools=[calculate]
89
+
session_manager=session_manager,
90
+
system_prompt="""You are a helpful assistant with code execution capabilities. Use tools when appropriate.
91
+
Response format when using code:
92
+
1. Brief explanation of your approach
93
+
2. Code block showing the executed code
94
+
3. Results and analysis
95
+
""",
96
+
tools=[code_interpreter.code_interpreter]
114
97
)
115
98
116
99
result = agent(payload.get("prompt", ""))
@@ -125,21 +108,22 @@ Create `requirements.txt`:
125
108
```text
126
109
strands-agents
127
110
bedrock-agentcore
111
+
strands-agents-tools
128
112
```
129
113
130
-
## Step 1B: Transform an Existing Agent to be Compatible with Runtime
114
+
## Step 2: Configure and deploy the agent
131
115
132
-
1. Import the Runtime App with from bedrock_agentcore.runtime import BedrockAgentCoreApp
133
-
2. Initialize the App in your code with app = BedrockAgentCoreApp()
134
-
3. Decorate the invocation function with the @app.entrypoint decorator
135
-
4. Create a requirements.txt file with needed packages. Note: if strands-tools is detected, the correct library to add is strands-agents-tools
136
-
5. Let AgentCore Runtime control the running of the agent with app.run()
116
+
In this step, you'll use the AgentCore CLI to configure and deploy your agent.
137
117
138
-
##Step 2: Configure and Deploy
118
+
### Configure the agent
139
119
140
-
The AgentCore CLI automates deployment with provisioning.
120
+
Configure the agent with memory and execution settings:
141
121
142
-
### Configure the Agent
122
+
**For this tutorial**: When prompted for the execution role, press Enter to auto-create a new role with all required permissions for the Runtime, Memory, Code Interpreter, and Observability features. When prompted for long-term memory, type **yes**.
123
+
124
+
> **Note**
125
+
>
126
+
> If the memory configuration prompts do not appear during `agentcore configure`, refer to the [Troubleshooting](#troubleshooting) section (Memory configuration not appearing) for instructions on how to check whether the correct toolkit version is installed.
# 1. Execution Role: Press Enter to auto-create or provide existing role ARN/name
150
134
# 2. ECR Repository: Press Enter to auto-create or provide existing ECR URI
151
-
# 3. OAuth Configuration: Configure OAuth authorizer? (yes/no) - Type `no` for this tutorial
152
-
# 4. Request Header Allowlist: Configure request header allowlist? (yes/no) - Type `no` for this tutorial
153
-
# 5. Memory Configuration:
135
+
# 3. Requirements File: Confirm the detected requirements.txt file or specify a different path
136
+
# 4. OAuth Configuration: Configure OAuth authorizer? (yes/no) - Type `no` for this tutorial
137
+
# 5. Request Header Allowlist: Configure request header allowlist? (yes/no) - Type `no` for this tutorial
138
+
# 6. Memory Configuration:
154
139
# - If existing memories found: Choose from list or press Enter to create new
155
-
# - If creating new: Enable long-term memory extraction? (yes/no) - Type `yes` for this tutorial
156
-
#- Note: Short-term memory is always enabled by default
157
-
# If interactive mode fails, use "--non-interactive" for default configs
140
+
# - If creating new: Press Enter to create new memory
141
+
# - Enable long-term memory extraction? (yes/no) - Type `yes` for this tutorial
142
+
#. - Type 's' to skip memory setup
158
143
```
159
-
**For this tutorial**: When prompted for the execution role, press Enter to auto-create a new role with all required permissions for Runtime, Memory, Code Interpreter, and Observability. When prompted for long-term memory, type **yes** for this tutorial.
160
-
161
-
**Note**: If the memory configuration prompts do not appear during `agentcore configure`, refer to the [Troubleshooting](#troubleshooting) section (Memory Configuration Not Appearing) to ensure the correct toolkit version is installed.
162
-
163
144
164
145
### Deploy to AgentCore
165
146
147
+
Launch your agent to the AgentCore runtime environment:
148
+
166
149
```bash
167
150
agentcore launch
168
151
@@ -176,9 +159,18 @@ agentcore launch
176
159
```
177
160
178
161
**Expected output:**
162
+
During launch, you'll see memory creation progress with elapsed time indicators. Memory provisioning may take around 2-5 minutes to activate:
agentcore status # Verify resource provisioning status
194
186
```
187
+
195
188
Refer to the [Troubleshooting](#troubleshooting) section if you see any issues.
196
189
197
190
## Step 3: Monitor Deployment
198
191
199
-
Check deployment status:
192
+
Check the agent's deployment status:
200
193
201
194
```bash
202
195
agentcore status
203
196
204
197
# Shows:
205
198
# Memory ID: agentcore_starter_strands_mem-abc123
206
-
# Memory Status: CREATING (if still provisioning)
207
-
# Memory Type: STM+LTM (provisioning...) (if creating with LTM)
208
199
# Memory Type: STM+LTM (3 strategies) (when active with strategies)
209
200
# Memory Type: STM only (if configured without LTM)
210
201
# Observability: Enabled
211
202
```
212
203
213
-
**Note**: LTM strategies require 2-5 minutes to activate. STM is provisioned immediately if LTM is not selected.
214
-
215
204
## Step 4: Test Memory and Code Interpreter
216
205
206
+
In this section, you'll test your agent's memory capabilities and code execution features.
207
+
217
208
### Test Short-Term Memory (STM)
218
209
219
-
Testing within a single session:
210
+
Test short-term memory within a single session:
220
211
221
212
```bash
222
213
# Store information (session IDs must be 33+ characters)
223
214
agentcore invoke '{"prompt": "Remember that my favorite agent platform is AgentCore"}'
224
215
225
-
# If invoked too early (memory still provisioning), you'll see:
226
-
# "Memory is still provisioning (current status: CREATING).
227
-
# Long-term memory extraction takes 60-180 seconds to activate.
228
-
#
229
-
# Please wait and check status with:
230
-
# agentcore status"
231
-
232
216
# Retrieve within same session
233
217
agentcore invoke '{"prompt": "What is my favorite agent platform?"}'
234
218
235
219
# Expected response:
236
220
# "Your favorite agent platform is AgentCore."
237
221
```
238
222
239
-
### Test Long-Term Memory (LTM) - Cross-Session Persistence
223
+
### Test long-term memory – cross-session persistence
224
+
225
+
Long-term memory (LTM) lets information persist across different sessions. This requires waiting for long-term memory to be extracted before starting a new session.
240
226
241
-
LTM enables information persistence across different sessions. This requires waiting for LTM extraction after storing information.
227
+
Test long-term memory by starting a session:
242
228
243
229
```bash
244
230
# Session 1: Store facts
245
231
agentcore invoke '{"prompt": "My email is user@example.com and I am an AgentCore user"}'
246
232
```
247
233
248
-
Wait for extraction that runs in the background by AgentCore. This typically takes 10-30 seconds. If you do not see the facts, wait a few more seconds and try again.
234
+
After invoking the agent, AgentCore runs in the background to perform an extraction. Wait for the extraction to finish. This typically takes 10-30 seconds. If you do not see any facts, wait a few more seconds.
235
+
236
+
Start another session:
249
237
250
238
```bash
251
239
sleep 20
@@ -260,6 +248,8 @@ agentcore invoke '{"prompt": "Tell me about myself?"}' --session-id $SESSION_ID
260
248
261
249
### Test Code Interpreter
262
250
251
+
Test AgentCore Code Interpreter:
252
+
263
253
```bash
264
254
# Store data
265
255
agentcore invoke '{"prompt": "My dataset has values: 23, 45, 67, 89, 12, 34, 56."}'
@@ -272,7 +262,9 @@ agentcore invoke '{"prompt": "Create a text-based bar chart visualization showin
272
262
273
263
## Step 5: View Traces and Logs
274
264
275
-
### Access CloudWatch Dashboard
265
+
In this section, you'll use observability features to monitor your agent's performance.
266
+
267
+
### Access the Amazon CloudWatch dashboard
276
268
277
269
Navigate to the GenAI Observability dashboard to view end-to-end request traces including agent execution tracking, memory retrieval operations, code interpreter executions, agent reasoning steps, and latency breakdown by component. The dashboard provides a service map view showing agent runtime connections to Memory and Code Interpreter services with request flow visualization and latency metrics, as well as detailed X-Ray traces for debugging and performance analysis.
0 commit comments