bedrock-agentcore-starter-toolkit 0.1.14__py3-none-any.whl → 0.1.16__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.
- bedrock_agentcore_starter_toolkit/cli/runtime/commands.py +33 -2
- bedrock_agentcore_starter_toolkit/cli/runtime/configuration_manager.py +127 -1
- bedrock_agentcore_starter_toolkit/operations/memory/README.md +1109 -0
- bedrock_agentcore_starter_toolkit/operations/memory/constants.py +1 -9
- bedrock_agentcore_starter_toolkit/operations/memory/manager.py +248 -57
- bedrock_agentcore_starter_toolkit/operations/memory/models/__init__.py +106 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/__init__.py +52 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/base.py +77 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/custom.py +194 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/semantic.py +35 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/summary.py +35 -0
- bedrock_agentcore_starter_toolkit/operations/memory/models/strategies/user_preference.py +34 -0
- bedrock_agentcore_starter_toolkit/operations/memory/strategy_validator.py +408 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/configure.py +54 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/destroy.py +43 -3
- bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py +45 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/launch.py +164 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/models.py +7 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/status.py +62 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/container.py +4 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/schema.py +27 -1
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/Dockerfile.j2 +9 -2
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2 +31 -0
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/METADATA +1 -1
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/RECORD +29 -20
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/WHEEL +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/entry_points.txt +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/licenses/LICENSE.txt +0 -0
- {bedrock_agentcore_starter_toolkit-0.1.14.dist-info → bedrock_agentcore_starter_toolkit-0.1.16.dist-info}/licenses/NOTICE.txt +0 -0
|
@@ -280,6 +280,7 @@ def configure(
|
|
|
280
280
|
verbose=verbose,
|
|
281
281
|
region=region,
|
|
282
282
|
protocol=protocol.upper() if protocol else None,
|
|
283
|
+
non_interactive=non_interactive,
|
|
283
284
|
)
|
|
284
285
|
|
|
285
286
|
# Prepare authorization info for summary
|
|
@@ -306,8 +307,9 @@ def configure(
|
|
|
306
307
|
f"ECR Repository: [dim]"
|
|
307
308
|
f"{'Auto-create' if result.auto_create_ecr else result.ecr_repository or 'N/A'}"
|
|
308
309
|
f"[/dim]\n"
|
|
309
|
-
f"Authorization: [dim]{auth_info}[/dim]\n"
|
|
310
|
+
f"Authorization: [dim]{auth_info}[/dim]\n\n"
|
|
310
311
|
f"{headers_info}\n"
|
|
312
|
+
f"Memory: [dim]Short-term memory (30-day retention)[/dim]\n\n"
|
|
311
313
|
f"📄 Config saved to: [dim]{result.config_path}[/dim]\n\n"
|
|
312
314
|
f"[bold]Next Steps:[/bold]\n"
|
|
313
315
|
f" [cyan]agentcore launch[/cyan]",
|
|
@@ -328,7 +330,7 @@ def launch(
|
|
|
328
330
|
None, "--agent", "-a", help="Agent name (use 'agentcore configure list' to see available agents)"
|
|
329
331
|
),
|
|
330
332
|
local: bool = typer.Option(
|
|
331
|
-
False, "--local", "-l", help="
|
|
333
|
+
False, "--local", "-l", help="Local build + local runtime - requires Docker/Finch/Podman"
|
|
332
334
|
),
|
|
333
335
|
local_build: bool = typer.Option(
|
|
334
336
|
False,
|
|
@@ -852,6 +854,11 @@ def status(
|
|
|
852
854
|
|
|
853
855
|
# Determine overall status
|
|
854
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"
|
|
855
862
|
if endpoint_status == "READY":
|
|
856
863
|
status_text = "Ready - Agent deployed and endpoint available"
|
|
857
864
|
else:
|
|
@@ -867,6 +874,30 @@ def status(
|
|
|
867
874
|
f"([cyan]{endpoint_status}[/cyan])\n"
|
|
868
875
|
f"Region: [cyan]{status_json['config']['region']}[/cyan] | "
|
|
869
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 += (
|
|
870
901
|
f"[bold]Deployment Info:[/bold]\n"
|
|
871
902
|
f"Created: [dim]{agent_data.get('createdAt', 'Not available')}[/dim]\n"
|
|
872
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")
|