bedrock-agentcore-starter-toolkit 0.1.13__py3-none-any.whl → 0.1.15__py3-none-any.whl

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.

Potentially problematic release.


This version of bedrock-agentcore-starter-toolkit might be problematic. Click here for more details.

Files changed (30) hide show
  1. bedrock_agentcore_starter_toolkit/cli/runtime/commands.py +35 -2
  2. bedrock_agentcore_starter_toolkit/cli/runtime/configuration_manager.py +127 -1
  3. bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py +3 -0
  4. bedrock_agentcore_starter_toolkit/operations/memory/README.md +1109 -0
  5. bedrock_agentcore_starter_toolkit/operations/memory/constants.py +1 -9
  6. bedrock_agentcore_starter_toolkit/operations/memory/manager.py +248 -57
  7. bedrock_agentcore_starter_toolkit/operations/memory/models/__init__.py +106 -0
  8. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/__init__.py +52 -0
  9. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/base.py +77 -0
  10. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/custom.py +194 -0
  11. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/semantic.py +35 -0
  12. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/summary.py +35 -0
  13. bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/user_preference.py +34 -0
  14. bedrock_agentcore_starter_toolkit/operations/memory/strategy_validator.py +395 -0
  15. bedrock_agentcore_starter_toolkit/operations/runtime/configure.py +78 -0
  16. bedrock_agentcore_starter_toolkit/operations/runtime/destroy.py +43 -3
  17. bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py +45 -0
  18. bedrock_agentcore_starter_toolkit/operations/runtime/launch.py +164 -0
  19. bedrock_agentcore_starter_toolkit/operations/runtime/models.py +7 -0
  20. bedrock_agentcore_starter_toolkit/operations/runtime/status.py +62 -0
  21. bedrock_agentcore_starter_toolkit/utils/runtime/container.py +4 -0
  22. bedrock_agentcore_starter_toolkit/utils/runtime/schema.py +27 -1
  23. bedrock_agentcore_starter_toolkit/utils/runtime/templates/Dockerfile.j2 +10 -3
  24. bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2 +31 -0
  25. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/METADATA +1 -1
  26. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/RECORD +30 -21
  27. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/WHEEL +0 -0
  28. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/entry_points.txt +0 -0
  29. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/licenses/LICENSE.txt +0 -0
  30. {bedrock_agentcore_starter_toolkit-0.1.13.dist-info → bedrock_agentcore_starter_toolkit-0.1.15.dist-info}/licenses/NOTICE.txt +0 -0
@@ -167,6 +167,7 @@ def configure(
167
167
  entrypoint: Optional[str] = typer.Option(None, "--entrypoint", "-e", help="Python file with BedrockAgentCoreApp"),
168
168
  agent_name: Optional[str] = typer.Option(None, "--name", "-n"),
169
169
  execution_role: Optional[str] = typer.Option(None, "--execution-role", "-er"),
170
+ code_build_execution_role: Optional[str] = typer.Option(None, "--code-build-execution-role", "-cber"),
170
171
  ecr_repository: Optional[str] = typer.Option(None, "--ecr", "-ecr"),
171
172
  container_runtime: Optional[str] = typer.Option(None, "--container-runtime", "-ctr"),
172
173
  requirements_file: Optional[str] = typer.Option(
@@ -268,6 +269,7 @@ def configure(
268
269
  agent_name=agent_name,
269
270
  entrypoint_path=Path(entrypoint),
270
271
  execution_role=execution_role,
272
+ code_build_execution_role=code_build_execution_role,
271
273
  ecr_repository=ecr_repository,
272
274
  container_runtime=container_runtime,
273
275
  auto_create_ecr=auto_create_ecr,
@@ -278,6 +280,7 @@ def configure(
278
280
  verbose=verbose,
279
281
  region=region,
280
282
  protocol=protocol.upper() if protocol else None,
283
+ non_interactive=non_interactive,
281
284
  )
282
285
 
283
286
  # Prepare authorization info for summary
@@ -304,8 +307,9 @@ def configure(
304
307
  f"ECR Repository: [dim]"
305
308
  f"{'Auto-create' if result.auto_create_ecr else result.ecr_repository or 'N/A'}"
306
309
  f"[/dim]\n"
307
- f"Authorization: [dim]{auth_info}[/dim]\n"
310
+ f"Authorization: [dim]{auth_info}[/dim]\n\n"
308
311
  f"{headers_info}\n"
312
+ f"Memory: [dim]Short-term memory (30-day retention)[/dim]\n\n"
309
313
  f"📄 Config saved to: [dim]{result.config_path}[/dim]\n\n"
310
314
  f"[bold]Next Steps:[/bold]\n"
311
315
  f" [cyan]agentcore launch[/cyan]",
@@ -326,7 +330,7 @@ def launch(
326
330
  None, "--agent", "-a", help="Agent name (use 'agentcore configure list' to see available agents)"
327
331
  ),
328
332
  local: bool = typer.Option(
329
- False, "--local", "-l", help="Build locally and run container locally - requires Docker/Finch/Podman"
333
+ False, "--local", "-l", help="Local build + local runtime - requires Docker/Finch/Podman"
330
334
  ),
331
335
  local_build: bool = typer.Option(
332
336
  False,
@@ -850,6 +854,11 @@ def status(
850
854
 
851
855
  # Determine overall status
852
856
  endpoint_status = endpoint_data.get("status", "Unknown") if endpoint_data else "Not Ready"
857
+ # memory_info = ""
858
+ # if hasattr(status_json["config"], "memory_id") and status_json["config"].get("memory_id"):
859
+ # memory_type = status_json["config"].get("memory_type", "Short-term")
860
+ # memory_id = status_json["config"].get("memory_id")
861
+ # memory_info = f"Memory: [cyan]{memory_type}[/cyan] ([dim]{memory_id}[/dim])\n"
853
862
  if endpoint_status == "READY":
854
863
  status_text = "Ready - Agent deployed and endpoint available"
855
864
  else:
@@ -865,6 +874,30 @@ def status(
865
874
  f"([cyan]{endpoint_status}[/cyan])\n"
866
875
  f"Region: [cyan]{status_json['config']['region']}[/cyan] | "
867
876
  f"Account: [dim]{status_json['config'].get('account', 'Not available')}[/dim]\n\n"
877
+ )
878
+
879
+ # Add memory status with proper provisioning indication
880
+ if "memory_id" in status_json.get("config", {}) and status_json["config"]["memory_id"]:
881
+ memory_type = status_json["config"].get("memory_type", "Unknown")
882
+ memory_id = status_json["config"]["memory_id"]
883
+ memory_status = status_json["config"].get("memory_status", "Unknown")
884
+
885
+ # Color-code based on status
886
+ if memory_status == "ACTIVE":
887
+ panel_content += f"Memory: [green]{memory_type}[/green] ([dim]{memory_id}[/dim])\n"
888
+ elif memory_status in ["CREATING", "UPDATING"]:
889
+ panel_content += f"Memory: [yellow]{memory_type}[/yellow] ([dim]{memory_id}[/dim])\n"
890
+ panel_content += (
891
+ " [yellow]⚠️ Memory is provisioning. "
892
+ "STM will be available once ACTIVE.[/yellow]\n"
893
+ )
894
+ else:
895
+ panel_content += f"Memory: [red]{memory_type}[/red] ([dim]{memory_id}[/dim])\n"
896
+
897
+ panel_content += "\n"
898
+
899
+ # Continue building the panel
900
+ panel_content += (
868
901
  f"[bold]Deployment Info:[/bold]\n"
869
902
  f"Created: [dim]{agent_data.get('createdAt', 'Not available')}[/dim]\n"
870
903
  f"Last Updated: [dim]"
@@ -2,7 +2,7 @@
2
2
 
3
3
  import os
4
4
  from pathlib import Path
5
- from typing import Dict, Optional
5
+ from typing import Dict, Optional, Tuple
6
6
 
7
7
  from ..common import _handle_error, _print_success, _prompt_with_default, console
8
8
 
@@ -198,3 +198,129 @@ class ConfigurationManager:
198
198
  _print_success(f"Request header allowlist configured with {len(headers)} headers")
199
199
 
200
200
  return {"requestHeaderAllowlist": headers}
201
+
202
+ def prompt_memory_type(self) -> tuple[bool, bool]:
203
+ """Prompt user for memory configuration preference.
204
+
205
+ Returns:
206
+ Tuple of (enable_memory, enable_ltm)
207
+ """
208
+ console.print("\n🧠 [cyan]Memory Configuration[/cyan]")
209
+ console.print("Short-term memory stores conversation within sessions.")
210
+ console.print("Long-term memory extracts preferences and facts across sessions.")
211
+ console.print()
212
+
213
+ # First ask if they want memory at all
214
+ enable_memory_response = _prompt_with_default("Enable memory for your agent? (yes/no)", "yes").strip().lower()
215
+
216
+ enable_memory = enable_memory_response in ["yes", "y"]
217
+
218
+ if not enable_memory:
219
+ _print_success("Memory disabled")
220
+ return False, False
221
+
222
+ # If memory is enabled, ask about long-term memory
223
+ console.print("\n[dim]Long-term memory extracts:[/dim]")
224
+ console.print(" • User preferences (e.g., 'I prefer Python')")
225
+ console.print(" • Semantic facts (e.g., 'My birthday is in January')")
226
+ console.print(" • Session summaries")
227
+ console.print()
228
+
229
+ enable_ltm_response = _prompt_with_default("Enable long-term memory extraction? (yes/no)", "no").strip().lower()
230
+
231
+ enable_ltm = enable_ltm_response in ["yes", "y"]
232
+
233
+ if enable_ltm:
234
+ _print_success("Long-term memory will be configured")
235
+ else:
236
+ _print_success("Using short-term memory only")
237
+
238
+ return enable_memory, enable_ltm
239
+
240
+ def prompt_memory_selection(self) -> Tuple[str, str]:
241
+ """Prompt user to select existing memory or create new.
242
+
243
+ Returns:
244
+ Tuple of (action, value) where:
245
+ - action is "USE_EXISTING", "CREATE_NEW"
246
+ - value is memory_id for USE_EXISTING, mode for CREATE_NEW
247
+ """
248
+ if self.non_interactive:
249
+ # In non-interactive mode, default to creating new STM
250
+ return ("CREATE_NEW", "STM_ONLY")
251
+
252
+ console.print("\n🧠 [cyan]Memory Configuration[/cyan]")
253
+
254
+ # Try to list existing memories
255
+ try:
256
+ from ...operations.memory.manager import MemoryManager
257
+
258
+ # Need region - will be passed from configure.py
259
+ region = self.existing_config.aws.region if self.existing_config else None
260
+ if not region:
261
+ # Fall back to new memory creation if no region
262
+ return self._prompt_new_memory_config()
263
+
264
+ memory_manager = MemoryManager(region_name=region)
265
+ existing_memories = memory_manager.list_memories(max_results=10)
266
+
267
+ if existing_memories:
268
+ console.print("\n[cyan]Existing memory resources found:[/cyan]")
269
+ for i, mem in enumerate(existing_memories, 1):
270
+ # Display memory summary
271
+ mem_id = mem.get("id", "unknown")
272
+ mem_name = mem.get("name", "")
273
+ if "memory-" in mem_id:
274
+ display_name = mem_id.split("memory-")[0] + "memory"
275
+ else:
276
+ display_name = mem_name or mem_id[:40]
277
+
278
+ console.print(f" {i}. [bold]{display_name}[/bold]")
279
+ if mem.get("description"):
280
+ console.print(f" [dim]{mem.get('description')}[/dim]")
281
+ console.print(f" [dim]ID: {mem_id}[/dim]")
282
+
283
+ console.print("\n[dim]Options:[/dim]")
284
+ console.print("[dim] • Enter a number to use existing memory[/dim]")
285
+ console.print("[dim] • Press Enter to create new memory[/dim]")
286
+ console.print("[dim] • Type 's' to skip memory setup[/dim]")
287
+
288
+ response = _prompt_with_default("Your choice", "").strip().lower()
289
+
290
+ if response.isdigit():
291
+ idx = int(response) - 1
292
+ if 0 <= idx < len(existing_memories):
293
+ selected = existing_memories[idx]
294
+ _print_success(f"Using existing memory: {selected.get('name', selected.get('id'))}")
295
+ return ("USE_EXISTING", selected.get("id"))
296
+ elif response == "s":
297
+ _print_success("Skipping memory configuration")
298
+ return ("SKIP", None)
299
+ except Exception as e:
300
+ console.print(f"[dim]Could not list existing memories: {e}[/dim]")
301
+
302
+ # Fall back to creating new memory
303
+ return self._prompt_new_memory_config()
304
+
305
+ def _prompt_new_memory_config(self) -> Tuple[str, str]:
306
+ """Prompt for new memory configuration."""
307
+ console.print("\n🧠 [cyan]Memory Configuration[/cyan]")
308
+ console.print("[green]✓ Short-term memory is enabled by default[/green]")
309
+ console.print(" • Stores conversations within sessions")
310
+ console.print(" • Provides immediate context recall")
311
+ console.print()
312
+ console.print("[cyan]Optional: Long-term memory[/cyan]")
313
+ console.print(" • Extracts user preferences across sessions")
314
+ console.print(" • Remembers facts and patterns")
315
+ console.print(" • Creates session summaries")
316
+ console.print(" • [dim]Note: Takes 60-90 seconds to process[/dim]")
317
+ console.print()
318
+
319
+ response = _prompt_with_default("Enable long-term memory extraction? (yes/no)", "no").strip().lower()
320
+
321
+ if response in ["yes", "y"]:
322
+ _print_success("Configuring short-term + long-term memory")
323
+ return ("CREATE_NEW", "STM_AND_LTM")
324
+ else:
325
+ _print_success("Using short-term memory only")
326
+ return ("CREATE_NEW", "STM_ONLY")
@@ -35,6 +35,7 @@ class Runtime:
35
35
  self,
36
36
  entrypoint: str,
37
37
  execution_role: Optional[str] = None,
38
+ code_build_execution_role: Optional[str] = None,
38
39
  agent_name: Optional[str] = None,
39
40
  requirements: Optional[List[str]] = None,
40
41
  requirements_file: Optional[str] = None,
@@ -53,6 +54,7 @@ class Runtime:
53
54
  entrypoint: Path to Python file with optional Bedrock AgentCore name
54
55
  (e.g., "handler.py" or "handler.py:bedrock_agentcore")
55
56
  execution_role: AWS IAM execution role ARN or name (optional if auto_create_execution_role=True)
57
+ code_build_execution_role: Optional separate CodeBuild execution role ARN or name
56
58
  agent_name: name of the agent
57
59
  requirements: Optional list of requirements to generate requirements.txt
58
60
  requirements_file: Optional path to existing requirements file
@@ -109,6 +111,7 @@ class Runtime:
109
111
  entrypoint_path=Path(file_path),
110
112
  auto_create_execution_role=auto_create_execution_role,
111
113
  execution_role=execution_role,
114
+ code_build_execution_role=code_build_execution_role,
112
115
  ecr_repository=ecr_repository,
113
116
  container_runtime=container_runtime,
114
117
  auto_create_ecr=auto_create_ecr,