bedrock-agentcore-starter-toolkit 0.1.2__py3-none-any.whl → 0.1.4__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 (35) hide show
  1. bedrock_agentcore_starter_toolkit/cli/__init__.py +1 -0
  2. bedrock_agentcore_starter_toolkit/cli/cli.py +3 -1
  3. bedrock_agentcore_starter_toolkit/cli/common.py +1 -1
  4. bedrock_agentcore_starter_toolkit/cli/import_agent/README.md +35 -0
  5. bedrock_agentcore_starter_toolkit/cli/import_agent/__init__.py +1 -0
  6. bedrock_agentcore_starter_toolkit/cli/import_agent/agent_info.py +230 -0
  7. bedrock_agentcore_starter_toolkit/cli/import_agent/commands.py +518 -0
  8. bedrock_agentcore_starter_toolkit/cli/runtime/commands.py +132 -42
  9. bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py +120 -22
  10. bedrock_agentcore_starter_toolkit/operations/gateway/client.py +2 -2
  11. bedrock_agentcore_starter_toolkit/operations/runtime/configure.py +5 -2
  12. bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py +1 -1
  13. bedrock_agentcore_starter_toolkit/operations/runtime/launch.py +108 -30
  14. bedrock_agentcore_starter_toolkit/operations/runtime/models.py +1 -1
  15. bedrock_agentcore_starter_toolkit/services/__init__.py +1 -0
  16. bedrock_agentcore_starter_toolkit/services/import_agent/__init__.py +1 -0
  17. bedrock_agentcore_starter_toolkit/services/import_agent/assets/memory_manager_template.py +207 -0
  18. bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_langchain.j2 +9 -0
  19. bedrock_agentcore_starter_toolkit/services/import_agent/assets/requirements_strands.j2 +5 -0
  20. bedrock_agentcore_starter_toolkit/services/import_agent/assets/template_fixtures_merged.json +1102 -0
  21. bedrock_agentcore_starter_toolkit/services/import_agent/scripts/__init__.py +1 -0
  22. bedrock_agentcore_starter_toolkit/services/import_agent/scripts/base_bedrock_translate.py +1668 -0
  23. bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_langchain.py +382 -0
  24. bedrock_agentcore_starter_toolkit/services/import_agent/scripts/bedrock_to_strands.py +374 -0
  25. bedrock_agentcore_starter_toolkit/services/import_agent/utils.py +417 -0
  26. bedrock_agentcore_starter_toolkit/services/runtime.py +35 -12
  27. bedrock_agentcore_starter_toolkit/utils/runtime/container.py +54 -3
  28. bedrock_agentcore_starter_toolkit/utils/runtime/entrypoint.py +11 -5
  29. bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2 +2 -1
  30. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/METADATA +22 -2
  31. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/RECORD +35 -19
  32. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/WHEEL +0 -0
  33. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/entry_points.txt +0 -0
  34. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/licenses/LICENSE.txt +0 -0
  35. {bedrock_agentcore_starter_toolkit-0.1.2.dist-info → bedrock_agentcore_starter_toolkit-0.1.4.dist-info}/licenses/NOTICE.txt +0 -0
@@ -262,35 +262,102 @@ def launch(
262
262
  agent: Optional[str] = typer.Option(
263
263
  None, "--agent", "-a", help="Agent name (use 'agentcore configure list' to see available agents)"
264
264
  ),
265
- local: bool = typer.Option(False, "--local", "-l", help="Run locally"),
266
- push_ecr: bool = typer.Option(False, "--push-ecr", "-p", help="Build and push to ECR only (no deployment)"),
267
- codebuild: bool = typer.Option(False, "--codebuild", "-cb", help="Use CodeBuild for ARM64 builds"),
265
+ local: bool = typer.Option(
266
+ False, "--local", "-l", help="Build locally and run container locally - requires Docker/Finch/Podman"
267
+ ),
268
+ local_build: bool = typer.Option(
269
+ False,
270
+ "--local-build",
271
+ "-lb",
272
+ help="Build locally and deploy to cloud runtime - requires Docker/Finch/Podman",
273
+ ),
268
274
  auto_update_on_conflict: bool = typer.Option(
269
- False, "--auto-update-on-conflict", help="Enable automatic update when agent already exists"
275
+ False,
276
+ "--auto-update-on-conflict",
277
+ "-auc",
278
+ help="Automatically update existing agent instead of failing with ConflictException",
270
279
  ),
271
280
  envs: List[str] = typer.Option( # noqa: B008
272
281
  None, "--env", "-env", help="Environment variables for agent (format: KEY=VALUE)"
273
282
  ),
283
+ code_build: bool = typer.Option(
284
+ False,
285
+ "--code-build",
286
+ help="[DEPRECATED] CodeBuild is now the default. Use no flags for CodeBuild deployment.",
287
+ hidden=True,
288
+ ),
274
289
  ):
275
- """Launch Bedrock AgentCore locally or to cloud."""
290
+ """Launch Bedrock AgentCore with three deployment modes.
291
+
292
+ 🚀 DEFAULT (no flags): CodeBuild + cloud runtime (RECOMMENDED)
293
+ - Build ARM64 containers in the cloud with CodeBuild
294
+ - Deploy to Bedrock AgentCore runtime
295
+ - No local Docker required
296
+ - CHANGED: CodeBuild is now the default (previously required --code-build flag)
297
+
298
+ 💻 --local: Local build + local runtime
299
+ - Build container locally and run locally
300
+ - requires Docker/Finch/Podman
301
+ - For local development and testing
302
+
303
+ 🔧 --local-build: Local build + cloud runtime
304
+ - Build container locally with Docker
305
+ - Deploy to Bedrock AgentCore runtime
306
+ - requires Docker/Finch/Podman
307
+ - Use when you need custom build control but want cloud deployment
308
+
309
+ MIGRATION GUIDE:
310
+ - OLD: agentcore launch --code-build → NEW: agentcore launch
311
+ - OLD: agentcore launch --local → NEW: agentcore launch --local (unchanged)
312
+ - NEW: agentcore launch --local-build (build locally + deploy to cloud)
313
+ """
314
+ # Handle deprecated --code-build flag
315
+ if code_build:
316
+ console.print("[yellow]⚠️ DEPRECATION WARNING: --code-build flag is deprecated[/yellow]")
317
+ console.print("[yellow] CodeBuild is now the default deployment method[/yellow]")
318
+ console.print("[yellow] MIGRATION: Simply use 'agentcore launch' (no flags needed)[/yellow]")
319
+ console.print("[yellow] This flag will be removed in a future version[/yellow]\n")
320
+
276
321
  # Validate mutually exclusive options
277
- if sum([local, push_ecr, codebuild]) > 1:
278
- _handle_error("Error: --local, --push-ecr, and --codebuild cannot be used together")
322
+ if sum([local, local_build, code_build]) > 1:
323
+ _handle_error("Error: --local, --local-build, and --code-build cannot be used together")
279
324
 
280
325
  config_path = Path.cwd() / ".bedrock_agentcore.yaml"
281
326
 
282
327
  try:
283
- # Show launch mode
328
+ # Show launch mode with enhanced migration guidance
284
329
  if local:
285
330
  mode = "local"
286
- elif push_ecr:
287
- mode = "push-ecr"
288
- elif codebuild:
331
+ console.print(f"[cyan]🏠 Launching Bedrock AgentCore ({mode} mode)...[/cyan]")
332
+ console.print("[dim] • Build and run container locally[/dim]")
333
+ console.print("[dim] • Requires Docker/Finch/Podman to be installed[/dim]")
334
+ console.print("[dim] • Perfect for development and testing[/dim]\n")
335
+ elif local_build:
336
+ mode = "local-build"
337
+ console.print(f"[cyan]🔧 Launching Bedrock AgentCore ({mode} mode - NEW!)...[/cyan]")
338
+ console.print("[dim] • Build container locally with Docker[/dim]")
339
+ console.print("[dim] • Deploy to Bedrock AgentCore cloud runtime[/dim]")
340
+ console.print("[dim] • Requires Docker/Finch/Podman to be installed[/dim]")
341
+ console.print("[dim] • Use when you need custom build control[/dim]\n")
342
+ elif code_build:
343
+ # Handle deprecated flag - treat as default
289
344
  mode = "codebuild"
345
+ console.print(f"[cyan]🚀 Launching Bedrock AgentCore ({mode} mode - RECOMMENDED)...[/cyan]")
346
+ console.print("[dim] • Build ARM64 containers in the cloud with CodeBuild[/dim]")
347
+ console.print("[dim] • No local Docker required[/dim]")
348
+ console.print("[dim] • Production-ready deployment[/dim]\n")
290
349
  else:
291
- mode = "cloud"
350
+ mode = "codebuild"
351
+ console.print(f"[cyan]🚀 Launching Bedrock AgentCore ({mode} mode - RECOMMENDED)...[/cyan]")
352
+ console.print("[dim] • Build ARM64 containers in the cloud with CodeBuild[/dim]")
353
+ console.print("[dim] • No local Docker required (DEFAULT behavior)[/dim]")
354
+ console.print("[dim] • Production-ready deployment[/dim]\n")
292
355
 
293
- console.print(f"[cyan]Launching Bedrock AgentCore ({mode} mode)...[/cyan]\n")
356
+ # Show deployment options hint for first-time users
357
+ console.print("[dim]💡 Deployment options:[/dim]")
358
+ console.print("[dim] • agentcore launch → CodeBuild (current)[/dim]")
359
+ console.print("[dim] • agentcore launch --local → Local development[/dim]")
360
+ console.print("[dim] • agentcore launch --local-build → Local build + cloud deploy[/dim]\n")
294
361
 
295
362
  # Use the operations module
296
363
  with console.status("[bold]Launching Bedrock AgentCore...[/bold]"):
@@ -304,13 +371,12 @@ def launch(
304
371
  key, value = env_var.split("=", 1)
305
372
  env_vars[key] = value
306
373
 
307
- # Call the operation
374
+ # Call the operation - CodeBuild is now default, unless --local-build is specified
308
375
  result = launch_bedrock_agentcore(
309
376
  config_path=config_path,
310
377
  agent_name=agent,
311
378
  local=local,
312
- push_ecr_only=push_ecr,
313
- use_codebuild=codebuild,
379
+ use_codebuild=not local_build,
314
380
  env_vars=env_vars,
315
381
  auto_update_on_conflict=auto_update_on_conflict,
316
382
  )
@@ -330,20 +396,6 @@ def launch(
330
396
  except KeyboardInterrupt:
331
397
  console.print("\n[yellow]Stopped[/yellow]")
332
398
 
333
- elif result.mode == "push-ecr":
334
- _print_success(f"Image pushed to ECR: [cyan]{result.ecr_uri}:latest[/cyan]")
335
- console.print(
336
- Panel(
337
- f"[green]ECR Push Successful![/green]\n\n"
338
- f"Image: [cyan]{result.tag}[/cyan]\n"
339
- f"ECR URI: [cyan]{result.ecr_uri}:latest[/cyan]\n\n"
340
- f"Your image is now available in ECR.\n"
341
- f"Run [cyan]agentcore launch[/cyan] to deploy to Bedrock AgentCore.",
342
- title="Push to ECR Complete",
343
- border_style="green",
344
- )
345
- )
346
-
347
399
  elif result.mode == "codebuild":
348
400
  _print_success(f"CodeBuild completed: [cyan]{result.codebuild_id}[/cyan]")
349
401
  _print_success(f"ARM64 image pushed to ECR: [cyan]{result.ecr_uri}:latest[/cyan]")
@@ -386,13 +438,22 @@ def launch(
386
438
  )
387
439
  )
388
440
 
389
- else: # cloud mode
441
+ else: # cloud mode (either CodeBuild default or local-build)
390
442
  _print_success(f"Image pushed to ECR: [cyan]{result.ecr_uri}:latest[/cyan]")
391
443
 
392
444
  # Show deployment success panel
393
445
  agent_name = result.tag.split(":")[0].replace("bedrock_agentcore-", "")
446
+
447
+ # Determine deployment type for panel title
448
+ if local_build:
449
+ title = "Local Build Deployment Complete"
450
+ deployment_type = "Local Docker Build Deployment Successful!"
451
+ else:
452
+ title = "CodeBuild Deployment Complete"
453
+ deployment_type = "CodeBuild Deployment Successful!"
454
+
394
455
  deploy_panel = (
395
- f"[green]Deployment Successful![/green]\n\n"
456
+ f"[green]{deployment_type}[/green]\n\n"
396
457
  f"Agent Name: {agent_name}\n"
397
458
  f"Agent ARN: [cyan]{result.agent_arn}[/cyan]\n"
398
459
  f"ECR URI: [cyan]{result.ecr_uri}[/cyan]\n\n"
@@ -420,7 +481,7 @@ def launch(
420
481
  console.print(
421
482
  Panel(
422
483
  deploy_panel,
423
- title="Bedrock AgentCore Deployed",
484
+ title=title,
424
485
  border_style="green",
425
486
  )
426
487
  )
@@ -484,7 +545,14 @@ def invoke(
484
545
 
485
546
  # Display payload
486
547
  console.print("[bold]Payload:[/bold]")
487
- console.print(Syntax(json.dumps(payload_data, indent=2), "json", background_color="default", word_wrap=True))
548
+ console.print(
549
+ Syntax(
550
+ json.dumps(payload_data, indent=2, ensure_ascii=False),
551
+ "json",
552
+ background_color="default",
553
+ word_wrap=True,
554
+ )
555
+ )
488
556
 
489
557
  # Invoke
490
558
  result = invoke_bedrock_agentcore(
@@ -497,17 +565,31 @@ def invoke(
497
565
  local_mode=local_mode,
498
566
  )
499
567
  console.print(f"Session ID: [cyan]{result.session_id}[/cyan]")
500
- console.print("\n[bold]Response:[/bold]")
501
- console.print(
502
- Syntax(
503
- json.dumps(result.response, indent=2, default=str), "json", background_color="default", word_wrap=True
568
+ if result.response != {}:
569
+ console.print("\n[bold]Response:[/bold]")
570
+ console.print(
571
+ Syntax(
572
+ json.dumps(result.response, indent=2, default=str, ensure_ascii=False),
573
+ "json",
574
+ background_color="default",
575
+ word_wrap=True,
576
+ )
504
577
  )
505
- )
506
578
 
507
579
  except FileNotFoundError:
508
- _handle_error(".bedrock_agentcore.yaml not found. Run 'bedrock_agentcore configure --entrypoint <file>' first")
580
+ console.print("[red].bedrock_agentcore.yaml not found[/red]")
581
+ console.print("Run the following commands to get started:")
582
+ console.print(" 1. agentcore configure --entrypoint your_agent.py")
583
+ console.print(" 2. agentcore launch")
584
+ console.print(' 3. agentcore invoke \'{"message": "Hello"}\'')
585
+ raise typer.Exit(1) from None
509
586
  except ValueError as e:
510
587
  if "not deployed" in str(e):
588
+ console.print("[yellow]Agent not deployed yet[/yellow]")
589
+ console.print("Deploy your agent first:")
590
+ console.print(" agentcore launch # Deploy to AWS (recommended)")
591
+ console.print(" agentcore launch --local # Run locally")
592
+ console.print("Then check status: agentcore status")
511
593
  _handle_error("Bedrock AgentCore not deployed. Run 'bedrock_agentcore launch' first", e)
512
594
  else:
513
595
  _handle_error(f"Invocation failed: {e}", e)
@@ -639,12 +721,20 @@ def status(
639
721
  else: # full json verbose output
640
722
  console.print(
641
723
  Syntax(
642
- json.dumps(status_json, indent=2, default=str), "json", background_color="default", word_wrap=True
724
+ json.dumps(status_json, indent=2, default=str, ensure_ascii=False),
725
+ "json",
726
+ background_color="default",
727
+ word_wrap=True,
643
728
  )
644
729
  )
645
730
 
646
731
  except FileNotFoundError:
647
- _handle_error(".bedrock_agentcore.yaml not found. Run 'bedrock_agentcore configure --entrypoint <file>' first")
732
+ console.print("[yellow]Configuration not found[/yellow]")
733
+ console.print("Run the following commands to get started:")
734
+ console.print(" 1. agentcore configure --entrypoint your_agent.py")
735
+ console.print(" 2. agentcore launch")
736
+ console.print(' 3. agentcore invoke \'{"message": "Hello"}\'')
737
+ raise typer.Exit(1) from None
648
738
  except ValueError as e:
649
739
  _handle_error(f"Status failed: {e}", e)
650
740
  except Exception as e:
@@ -45,6 +45,7 @@ class Runtime:
45
45
  authorizer_configuration: Optional[Dict[str, Any]] = None,
46
46
  region: Optional[str] = None,
47
47
  protocol: Optional[Literal["HTTP", "MCP"]] = None,
48
+ disable_otel: bool = False,
48
49
  ) -> ConfigureResult:
49
50
  """Configure Bedrock AgentCore from notebook using an entrypoint file.
50
51
 
@@ -62,6 +63,7 @@ class Runtime:
62
63
  authorizer_configuration: JWT authorizer configuration dictionary
63
64
  region: AWS region for deployment
64
65
  protocol: agent server protocol, must be either HTTP or MCP
66
+ disable_otel: Whether to disable OpenTelemetry observability (default: False)
65
67
 
66
68
  Returns:
67
69
  ConfigureResult with configuration details
@@ -110,6 +112,7 @@ class Runtime:
110
112
  ecr_repository=ecr_repository,
111
113
  container_runtime=container_runtime,
112
114
  auto_create_ecr=auto_create_ecr,
115
+ enable_observability=not disable_otel,
113
116
  requirements_file=final_requirements_file,
114
117
  authorizer_configuration=authorizer_configuration,
115
118
  region=region,
@@ -123,17 +126,15 @@ class Runtime:
123
126
  def launch(
124
127
  self,
125
128
  local: bool = False,
126
- push_ecr: bool = False,
127
- use_codebuild: bool = False,
129
+ local_build: bool = False,
128
130
  auto_update_on_conflict: bool = False,
129
131
  env_vars: Optional[Dict] = None,
130
132
  ) -> LaunchResult:
131
133
  """Launch Bedrock AgentCore from notebook.
132
134
 
133
135
  Args:
134
- local: Whether to build for local execution only
135
- push_ecr: Whether to push to ECR only (no deployment)
136
- use_codebuild: Whether to use CodeBuild for ARM64 builds (cloud deployment only)
136
+ local: Whether to build and run locally (requires Docker/Finch/Podman)
137
+ local_build: Whether to build locally and deploy to cloud (requires Docker/Finch/Podman)
137
138
  auto_update_on_conflict: Whether to automatically update resources on conflict (default: False)
138
139
  env_vars: environment variables for agent container
139
140
 
@@ -141,26 +142,75 @@ class Runtime:
141
142
  LaunchResult with deployment details
142
143
  """
143
144
  if not self._config_path:
145
+ log.warning("Configuration required before launching")
146
+ log.info("Call .configure() first to set up your agent")
147
+ log.info("Example: runtime.configure(entrypoint='my_agent.py')")
144
148
  raise ValueError("Must configure before launching. Call .configure() first.")
145
149
 
146
- # Validate mutually exclusive options
147
- exclusive_options = [local, push_ecr, use_codebuild]
148
- if sum(exclusive_options) > 1:
149
- raise ValueError("Only one of 'local', 'push_ecr', or 'use_codebuild' can be True")
150
-
151
- result = launch_bedrock_agentcore(
152
- self._config_path,
153
- local=local,
154
- push_ecr_only=push_ecr,
155
- use_codebuild=use_codebuild,
156
- auto_update_on_conflict=auto_update_on_conflict,
157
- env_vars=env_vars,
158
- )
150
+ # Enhanced validation for mutually exclusive options with helpful guidance
151
+ if local and local_build:
152
+ raise ValueError(
153
+ "Cannot use both 'local' and 'local_build' flags together.\n"
154
+ "Choose one deployment mode:\n"
155
+ "• runtime.launch(local=True) - for local development\n"
156
+ "• runtime.launch(local_build=True) - for local build + cloud deployment\n"
157
+ "• runtime.launch() - for CodeBuild deployment (recommended)"
158
+ )
159
+
160
+ # Inform user about deployment mode with enhanced migration guidance
161
+ if local:
162
+ log.info("🏠 Local mode: building and running locally")
163
+ log.info(" • Build and run container locally")
164
+ log.info(" • Requires Docker/Finch/Podman to be installed")
165
+ log.info(" • Perfect for development and testing")
166
+ elif local_build:
167
+ log.info("🔧 Local build mode: building locally, deploying to cloud (NEW OPTION!)")
168
+ log.info(" • Build container locally with Docker")
169
+ log.info(" • Deploy to Bedrock AgentCore cloud runtime")
170
+ log.info(" • Requires Docker/Finch/Podman to be installed")
171
+ log.info(" • Use when you need custom build control")
172
+ else:
173
+ log.info("🚀 CodeBuild mode: building in cloud (RECOMMENDED - DEFAULT)")
174
+ log.info(" • Build ARM64 containers in the cloud with CodeBuild")
175
+ log.info(" • No local Docker required")
176
+
177
+ # Show deployment options hint for first-time notebook users
178
+ log.info("💡 Available deployment modes:")
179
+ log.info(" • runtime.launch() → CodeBuild (current)")
180
+ log.info(" • runtime.launch(local=True) → Local development")
181
+ log.info(" • runtime.launch(local_build=True) → Local build + cloud deploy (NEW)")
182
+
183
+ # Map to the underlying operation's use_codebuild parameter
184
+ # use_codebuild=False when local=True OR local_build=True
185
+ use_codebuild = not (local or local_build)
186
+
187
+ try:
188
+ result = launch_bedrock_agentcore(
189
+ self._config_path,
190
+ local=local,
191
+ use_codebuild=use_codebuild,
192
+ auto_update_on_conflict=auto_update_on_conflict,
193
+ env_vars=env_vars,
194
+ )
195
+ except RuntimeError as e:
196
+ # Enhance Docker-related error messages
197
+ error_msg = str(e)
198
+ if "docker" in error_msg.lower() or "container runtime" in error_msg.lower():
199
+ if local or local_build:
200
+ enhanced_msg = (
201
+ f"Docker/Finch/Podman is required for {'local' if local else 'local-build'} mode.\n\n"
202
+ )
203
+ enhanced_msg += "Options to fix this:\n"
204
+ enhanced_msg += "1. Install Docker/Finch/Podman and try again\n"
205
+ enhanced_msg += "2. Use CodeBuild mode instead: runtime.launch() - no Docker required\n\n"
206
+ enhanced_msg += f"Original error: {error_msg}"
207
+ raise RuntimeError(enhanced_msg) from e
208
+ raise
159
209
 
160
210
  if result.mode == "cloud":
161
211
  log.info("Deployed to cloud: %s", result.agent_arn)
162
- # Show log information for cloud deployments
163
- if result.agent_id:
212
+ # For local_build mode, show minimal output; for pure cloud mode, show log details
213
+ if not local_build and result.agent_id:
164
214
  from ...utils.runtime.logs import get_agent_log_paths, get_aws_tail_commands
165
215
 
166
216
  runtime_logs, otel_logs = get_agent_log_paths(result.agent_id)
@@ -185,11 +235,14 @@ class Runtime:
185
235
  log.info(" %s", otel_logs)
186
236
  log.info("💡 Tail logs with: %s", follow_cmd)
187
237
  log.info("💡 Or view recent logs: %s", since_cmd)
188
- elif result.mode == "push-ecr":
189
- log.info("Pushed to ECR: %s", result.ecr_uri)
190
238
  else:
191
239
  log.info("Built for local: %s", result.tag)
192
240
 
241
+ # For notebook interface, clear verbose build output to keep output clean
242
+ # especially for local_build mode where build logs can be very verbose
243
+ if local_build and hasattr(result, "build_output"):
244
+ result.build_output = None
245
+
193
246
  return result
194
247
 
195
248
  def invoke(
@@ -213,6 +266,12 @@ class Runtime:
213
266
  Response from the Bedrock AgentCore endpoint
214
267
  """
215
268
  if not self._config_path:
269
+ log.warning("Agent not configured and deployed")
270
+ log.info("Required workflow: .configure() → .launch() → .invoke()")
271
+ log.info("Example:")
272
+ log.info(" runtime.configure(entrypoint='my_agent.py')")
273
+ log.info(" runtime.launch()")
274
+ log.info(" runtime.invoke({'message': 'Hello'})")
216
275
  raise ValueError("Must configure and launch first.")
217
276
 
218
277
  result = invoke_bedrock_agentcore(
@@ -232,8 +291,47 @@ class Runtime:
232
291
  StatusResult with configuration, agent, and endpoint status
233
292
  """
234
293
  if not self._config_path:
294
+ log.warning("Configuration not found")
295
+ log.info("Call .configure() first to set up your agent")
296
+ log.info("Example: runtime.configure(entrypoint='my_agent.py')")
235
297
  raise ValueError("Must configure first. Call .configure() first.")
236
298
 
237
299
  result = get_status(self._config_path)
238
300
  log.info("Retrieved Bedrock AgentCore status for: %s", self.name or "Bedrock AgentCore")
239
301
  return result
302
+
303
+ def help_deployment_modes(self):
304
+ """Display information about available deployment modes and migration guidance."""
305
+ print("\n🚀 Bedrock AgentCore Deployment Modes:")
306
+ print("=" * 50)
307
+
308
+ print("\n1. 📦 CodeBuild Mode (RECOMMENDED - DEFAULT)")
309
+ print(" Usage: runtime.launch()")
310
+ print(" • Build ARM64 containers in the cloud with CodeBuild")
311
+ print(" • No local Docker/Finch/Podman required")
312
+ print(" • ✅ Works in SageMaker Notebooks, Cloud9, laptops")
313
+
314
+ print("\n2. 🏠 Local Development Mode")
315
+ print(" Usage: runtime.launch(local=True)")
316
+ print(" • Build and run container locally")
317
+ print(" • Requires Docker/Finch/Podman installation")
318
+ print(" • Perfect for development and testing")
319
+ print(" • Fast iteration and debugging")
320
+
321
+ print("\n3. 🔧 Local Build Mode (NEW!)")
322
+ print(" Usage: runtime.launch(local_build=True)")
323
+ print(" • Build container locally with Docker")
324
+ print(" • Deploy to Bedrock AgentCore cloud runtime")
325
+ print(" • Requires Docker/Finch/Podman installation")
326
+ print(" • Use when you need custom build control")
327
+
328
+ print("\n📋 Migration Guide:")
329
+ print(" • CodeBuild is now the default (no code changes needed)")
330
+ print(" • Previous --code-build flag is deprecated")
331
+ print(" • local_build=True option for hybrid workflows")
332
+
333
+ print("\n💡 Quick Start:")
334
+ print(" runtime.configure(entrypoint='my_agent.py')")
335
+ print(" runtime.launch() # Uses CodeBuild by default")
336
+ print(' runtime.invoke({"prompt": "Hello"})')
337
+ print()
@@ -65,7 +65,7 @@ class GatewayClient:
65
65
  :param role_arn: optional - the role arn to use (creates one if none provided).
66
66
  :param authorizer_config: optional - the authorizer config (will create one if none provided).
67
67
  :param enable_semantic_search: optional - whether to enable search tool (defaults to True).
68
- :return: the created Gateway.
68
+ :return: the created Gateway
69
69
  """
70
70
  if not name:
71
71
  name = f"TestGateway{GatewayClient.generate_random_id()}"
@@ -130,6 +130,7 @@ class GatewayClient:
130
130
  "gatewayIdentifier": gateway["gatewayId"],
131
131
  "name": name,
132
132
  "targetConfiguration": {"mcp": {target_type: target_payload}},
133
+ "credentialProviderConfigurations": [{"credentialProviderType": "GATEWAY_IAM_ROLE"}],
133
134
  }
134
135
  # handle cases of missing target payloads across smithy and lambda (default to something)
135
136
  if not target_payload and target_type == "lambda":
@@ -183,7 +184,6 @@ class GatewayClient:
183
184
 
184
185
  return {
185
186
  "targetConfiguration": {"mcp": {"lambda": {"lambdaArn": lambda_arn, "toolSchema": LAMBDA_CONFIG}}},
186
- "credentialProviderConfigurations": [{"credentialProviderType": "GATEWAY_IAM_ROLE"}],
187
187
  }
188
188
 
189
189
  def __handle_openapi_target_credential_provider_creation(
@@ -145,11 +145,14 @@ def configure_bedrock_agentcore(
145
145
  log.debug("Agent name from BedrockAgentCoreApp: %s", agent_name)
146
146
  log.debug("Config path: %s", config_path)
147
147
 
148
+ # Convert to POSIX for cross-platform compatibility
149
+ entrypoint_path_str = entrypoint_path.as_posix()
150
+
148
151
  # Determine entrypoint format
149
152
  if bedrock_agentcore_name:
150
- entrypoint = f"{str(entrypoint_path)}:{bedrock_agentcore_name}"
153
+ entrypoint = f"{entrypoint_path_str}:{bedrock_agentcore_name}"
151
154
  else:
152
- entrypoint = str(entrypoint_path)
155
+ entrypoint = entrypoint_path_str
153
156
 
154
157
  if verbose:
155
158
  log.debug("Using entrypoint format: %s", entrypoint)
@@ -53,7 +53,7 @@ def invoke_bedrock_agentcore(
53
53
 
54
54
  # Convert payload to string if needed
55
55
  if isinstance(payload, dict):
56
- payload_str = json.dumps(payload)
56
+ payload_str = json.dumps(payload, ensure_ascii=False)
57
57
  else:
58
58
  payload_str = str(payload)
59
59