bedrock-agentcore-starter-toolkit 0.1.1__py3-none-any.whl → 0.1.3__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 (18) hide show
  1. bedrock_agentcore_starter_toolkit/cli/cli.py +1 -1
  2. bedrock_agentcore_starter_toolkit/cli/common.py +1 -1
  3. bedrock_agentcore_starter_toolkit/cli/runtime/commands.py +132 -42
  4. bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py +120 -22
  5. bedrock_agentcore_starter_toolkit/operations/runtime/configure.py +5 -2
  6. bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py +1 -1
  7. bedrock_agentcore_starter_toolkit/operations/runtime/launch.py +108 -30
  8. bedrock_agentcore_starter_toolkit/operations/runtime/models.py +1 -1
  9. bedrock_agentcore_starter_toolkit/services/codebuild.py +6 -1
  10. bedrock_agentcore_starter_toolkit/services/runtime.py +35 -12
  11. bedrock_agentcore_starter_toolkit/utils/runtime/container.py +54 -3
  12. bedrock_agentcore_starter_toolkit/utils/runtime/entrypoint.py +11 -5
  13. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/METADATA +2 -2
  14. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/RECORD +18 -18
  15. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/WHEEL +0 -0
  16. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/entry_points.txt +0 -0
  17. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/licenses/LICENSE.txt +0 -0
  18. {bedrock_agentcore_starter_toolkit-0.1.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.3.dist-info}/licenses/NOTICE.txt +0 -0
@@ -6,7 +6,7 @@ from ..cli.gateway.commands import create_mcp_gateway, create_mcp_gateway_target
6
6
  from ..utils.logging_config import setup_toolkit_logging
7
7
  from .runtime.commands import configure_app, invoke, launch, status
8
8
 
9
- app = typer.Typer(name="agentcore", help="BedrockAgentCore CLI", add_completion=False)
9
+ app = typer.Typer(name="agentcore", help="BedrockAgentCore CLI", add_completion=False, rich_markup_mode="rich")
10
10
 
11
11
  # Setup centralized logging for CLI
12
12
  setup_toolkit_logging(mode="cli")
@@ -18,7 +18,7 @@ def _handle_error(message: str, exception: Optional[Exception] = None) -> NoRetu
18
18
  raise typer.Exit(1)
19
19
 
20
20
 
21
- def _handle_warn(message: str) -> NoReturn:
21
+ def _handle_warn(message: str) -> None:
22
22
  """Handle errors with consistent formatting and exit."""
23
23
  console.print(f"⚠️ {message}", new_line_start=True, style="bold yellow underline")
24
24
 
@@ -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()
@@ -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
 
@@ -15,6 +15,7 @@ from ...services.ecr import deploy_to_ecr, get_or_create_ecr_repository
15
15
  from ...services.runtime import BedrockAgentCoreClient
16
16
  from ...utils.runtime.config import load_config, save_config
17
17
  from ...utils.runtime.container import ContainerRuntime
18
+ from ...utils.runtime.schema import BedrockAgentCoreAgentSchema, BedrockAgentCoreConfigSchema
18
19
  from .create_role import get_or_create_runtime_execution_role
19
20
  from .models import LaunchResult
20
21
 
@@ -137,7 +138,14 @@ def _ensure_execution_role(agent_config, project_config, config_path, agent_name
137
138
 
138
139
 
139
140
  def _deploy_to_bedrock_agentcore(
140
- agent_config, project_config, config_path, agent_name, ecr_uri, region, env_vars=None, auto_update_on_conflict=False
141
+ agent_config: BedrockAgentCoreAgentSchema,
142
+ project_config: BedrockAgentCoreConfigSchema,
143
+ config_path: Path,
144
+ agent_name: str,
145
+ ecr_uri: str,
146
+ region: str,
147
+ env_vars: Optional[dict] = None,
148
+ auto_update_on_conflict: bool = False,
141
149
  ):
142
150
  """Deploy agent to Bedrock AgentCore with retry logic for role validation."""
143
151
  log.info("Deploying to Bedrock AgentCore...")
@@ -215,6 +223,16 @@ def _deploy_to_bedrock_agentcore(
215
223
  agent_config.bedrock_agentcore.agent_id = agent_id
216
224
  agent_config.bedrock_agentcore.agent_arn = agent_arn
217
225
 
226
+ # Reset session id if present
227
+ existing_session_id = agent_config.bedrock_agentcore.agent_session_id
228
+ if existing_session_id is not None:
229
+ log.warning(
230
+ "⚠️ Session ID will be reset to connect to the updated agent. "
231
+ "The previous agent remains accessible via the original session ID: %s",
232
+ existing_session_id,
233
+ )
234
+ agent_config.bedrock_agentcore.agent_session_id = None
235
+
218
236
  # Update the project config and save
219
237
  project_config.agents[agent_config.name] = agent_config
220
238
  save_config(project_config, config_path)
@@ -233,8 +251,7 @@ def launch_bedrock_agentcore(
233
251
  config_path: Path,
234
252
  agent_name: Optional[str] = None,
235
253
  local: bool = False,
236
- push_ecr_only: bool = False,
237
- use_codebuild: bool = False,
254
+ use_codebuild: bool = True,
238
255
  env_vars: Optional[dict] = None,
239
256
  auto_update_on_conflict: bool = False,
240
257
  ) -> LaunchResult:
@@ -244,7 +261,6 @@ def launch_bedrock_agentcore(
244
261
  config_path: Path to BedrockAgentCore configuration file
245
262
  agent_name: Name of agent to launch (for project configurations)
246
263
  local: Whether to run locally
247
- push_ecr_only: Whether to only build and push to ECR without deploying
248
264
  use_codebuild: Whether to use CodeBuild for ARM64 builds
249
265
  env_vars: Environment variables to pass to local container (dict of key-value pairs)
250
266
  auto_update_on_conflict: Whether to automatically update when agent already exists (default: False)
@@ -256,18 +272,19 @@ def launch_bedrock_agentcore(
256
272
  project_config = load_config(config_path)
257
273
  agent_config = project_config.get_agent_config(agent_name)
258
274
 
259
- # Handle CodeBuild deployment
260
- if use_codebuild:
275
+ # Handle CodeBuild deployment (but not for local mode)
276
+ if use_codebuild and not local:
261
277
  return _launch_with_codebuild(
262
278
  config_path=config_path,
263
279
  agent_name=agent_config.name,
264
280
  agent_config=agent_config,
265
281
  project_config=project_config,
266
282
  auto_update_on_conflict=auto_update_on_conflict,
283
+ env_vars=env_vars,
267
284
  )
268
285
 
269
286
  # Log which agent is being launched
270
- mode = "locally" if local else "to ECR only" if push_ecr_only else "to cloud"
287
+ mode = "locally" if local else "to cloud"
271
288
  log.info("Launching Bedrock AgentCore agent '%s' %s", agent_config.name, mode)
272
289
 
273
290
  # Validate configuration
@@ -278,17 +295,45 @@ def launch_bedrock_agentcore(
278
295
  # Initialize container runtime
279
296
  runtime = ContainerRuntime(agent_config.container_runtime)
280
297
 
298
+ # Check if we need local runtime for this operation
299
+ if local and not runtime.has_local_runtime:
300
+ raise RuntimeError(
301
+ "Cannot run locally - no container runtime available\n"
302
+ "💡 Recommendation: Use CodeBuild for cloud deployment\n"
303
+ "💡 Run 'agentcore launch' (without --local) for CodeBuild deployment\n"
304
+ "💡 For local runs, please install Docker, Finch, or Podman"
305
+ )
306
+
307
+ # Check if we need local runtime for local-build mode (cloud deployment with local build)
308
+ if not local and not use_codebuild and not runtime.has_local_runtime:
309
+ raise RuntimeError(
310
+ "Cannot build locally - no container runtime available\n"
311
+ "💡 Recommendation: Use CodeBuild for cloud deployment (no Docker needed)\n"
312
+ "💡 Run 'agentcore launch' (without --local-build) for CodeBuild deployment\n"
313
+ "💡 For local builds, please install Docker, Finch, or Podman"
314
+ )
315
+
281
316
  # Get build context - always use project root (where config and Dockerfile are)
282
317
  build_dir = config_path.parent
283
318
 
284
319
  bedrock_agentcore_name = agent_config.name
285
320
  tag = f"bedrock_agentcore-{bedrock_agentcore_name}:latest"
286
321
 
287
- # Step 1: Build Docker image
322
+ # Step 1: Build Docker image (only if we need it)
288
323
  success, output = runtime.build(build_dir, tag)
289
324
  if not success:
290
325
  error_lines = output[-10:] if len(output) > 10 else output
291
- raise RuntimeError(f"Build failed: {' '.join(error_lines)}")
326
+ error_message = " ".join(error_lines)
327
+
328
+ # Check if this is a container runtime issue and suggest CodeBuild
329
+ if "No container runtime available" in error_message:
330
+ raise RuntimeError(
331
+ f"Build failed: {error_message}\n"
332
+ "💡 Recommendation: Use CodeBuild for building containers in the cloud\n"
333
+ "💡 Run 'agentcore launch' (default) for CodeBuild deployment"
334
+ )
335
+ else:
336
+ raise RuntimeError(f"Build failed: {error_message}")
292
337
 
293
338
  log.info("Docker image built: %s", tag)
294
339
 
@@ -323,15 +368,6 @@ def launch_bedrock_agentcore(
323
368
 
324
369
  log.info("Image uploaded to ECR: %s", ecr_uri)
325
370
 
326
- # If push_ecr_only, return early
327
- if push_ecr_only:
328
- return LaunchResult(
329
- mode="push-ecr",
330
- tag=tag,
331
- ecr_uri=ecr_uri,
332
- build_output=output,
333
- )
334
-
335
371
  # Step 4: Deploy agent (with retry logic for role readiness)
336
372
  agent_id, agent_arn = _deploy_to_bedrock_agentcore(
337
373
  agent_config,
@@ -354,12 +390,14 @@ def launch_bedrock_agentcore(
354
390
  )
355
391
 
356
392
 
357
- def _launch_with_codebuild(
393
+ def _execute_codebuild_workflow(
358
394
  config_path: Path,
359
395
  agent_name: str,
360
396
  agent_config,
361
397
  project_config,
398
+ ecr_only: bool = False,
362
399
  auto_update_on_conflict: bool = False,
400
+ env_vars: Optional[dict] = None,
363
401
  ) -> LaunchResult:
364
402
  """Launch using CodeBuild for ARM64 builds."""
365
403
  log.info(
@@ -368,7 +406,6 @@ def _launch_with_codebuild(
368
406
  agent_config.aws.account,
369
407
  agent_config.aws.region,
370
408
  )
371
-
372
409
  # Validate configuration
373
410
  errors = agent_config.validate(for_local=False)
374
411
  if errors:
@@ -381,13 +418,16 @@ def _launch_with_codebuild(
381
418
  session = boto3.Session(region_name=region)
382
419
  account_id = agent_config.aws.account # Use existing account from config
383
420
 
384
- # Step 1: Setup AWS resources
385
- log.info("Setting up AWS resources (ECR repository, execution roles)...")
421
+ # Setup AWS resources
422
+ log.info("Setting up AWS resources (ECR repository%s)...", "" if ecr_only else ", execution roles")
386
423
  ecr_uri = _ensure_ecr_repository(agent_config, project_config, config_path, agent_name, region)
387
424
  ecr_repository_arn = f"arn:aws:ecr:{region}:{account_id}:repository/{ecr_uri.split('/')[-1]}"
388
- _ensure_execution_role(agent_config, project_config, config_path, agent_name, region, account_id)
389
425
 
390
- # Step 2: Prepare CodeBuild
426
+ # Setup execution role only if not ECR-only mode
427
+ if not ecr_only:
428
+ _ensure_execution_role(agent_config, project_config, config_path, agent_name, region, account_id)
429
+
430
+ # Prepare CodeBuild
391
431
  log.info("Preparing CodeBuild project and uploading source...")
392
432
  codebuild_service = CodeBuildService(session)
393
433
 
@@ -404,16 +444,54 @@ def _launch_with_codebuild(
404
444
  source_location=source_location,
405
445
  )
406
446
 
407
- # Step 3: Execute CodeBuild
447
+ # Execute CodeBuild
408
448
  log.info("Starting CodeBuild build (this may take several minutes)...")
409
449
  build_id = codebuild_service.start_build(project_name, source_location)
410
450
  codebuild_service.wait_for_completion(build_id)
411
451
  log.info("CodeBuild completed successfully")
412
452
 
413
- # Update CodeBuild config
414
- agent_config.codebuild.project_name = project_name
415
- agent_config.codebuild.execution_role = codebuild_execution_role
416
- agent_config.codebuild.source_bucket = codebuild_service.source_bucket
453
+ # Update CodeBuild config only for full deployments, not ECR-only
454
+ if not ecr_only:
455
+ agent_config.codebuild.project_name = project_name
456
+ agent_config.codebuild.execution_role = codebuild_execution_role
457
+ agent_config.codebuild.source_bucket = codebuild_service.source_bucket
458
+
459
+ # Save config changes
460
+ project_config.agents[agent_config.name] = agent_config
461
+ save_config(project_config, config_path)
462
+ log.info("✅ CodeBuild project configuration saved")
463
+ else:
464
+ log.info("✅ ECR-only build completed (project configuration not saved)")
465
+
466
+ return build_id, ecr_uri, region, account_id
467
+
468
+
469
+ def _launch_with_codebuild(
470
+ config_path: Path,
471
+ agent_name: str,
472
+ agent_config,
473
+ project_config,
474
+ auto_update_on_conflict: bool = False,
475
+ env_vars: Optional[dict] = None,
476
+ ) -> LaunchResult:
477
+ """Launch using CodeBuild for ARM64 builds."""
478
+ log.info(
479
+ "Starting CodeBuild ARM64 deployment for agent '%s' to account %s (%s)",
480
+ agent_name,
481
+ agent_config.aws.account,
482
+ agent_config.aws.region,
483
+ )
484
+
485
+ # Execute shared CodeBuild workflow with full deployment mode
486
+ build_id, ecr_uri, region, account_id = _execute_codebuild_workflow(
487
+ config_path=config_path,
488
+ agent_name=agent_name,
489
+ agent_config=agent_config,
490
+ project_config=project_config,
491
+ ecr_only=False,
492
+ auto_update_on_conflict=auto_update_on_conflict,
493
+ env_vars=env_vars,
494
+ )
417
495
 
418
496
  # Deploy to Bedrock AgentCore
419
497
  agent_id, agent_arn = _deploy_to_bedrock_agentcore(
@@ -423,7 +501,7 @@ def _launch_with_codebuild(
423
501
  agent_name,
424
502
  ecr_uri,
425
503
  region,
426
- env_vars=None,
504
+ env_vars=env_vars,
427
505
  auto_update_on_conflict=auto_update_on_conflict,
428
506
  )
429
507
 
@@ -27,7 +27,7 @@ class ConfigureResult(BaseModel):
27
27
  class LaunchResult(BaseModel):
28
28
  """Result of launch operation."""
29
29
 
30
- mode: str = Field(..., description="Launch mode: local, push-ecr, cloud, or codebuild")
30
+ mode: str = Field(..., description="Launch mode: local, cloud, or codebuild")
31
31
  tag: str = Field(..., description="Docker image tag")
32
32
  env_vars: Optional[Dict[str, str]] = Field(default=None, description="Environment variables for local deployment")
33
33
 
@@ -43,7 +43,12 @@ class CodeBuildService:
43
43
  except ClientError:
44
44
  # Create bucket
45
45
  region = self.session.region_name
46
- self.s3_client.create_bucket(Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": region})
46
+ if region == "us-east-1":
47
+ self.s3_client.create_bucket(Bucket=bucket_name)
48
+ else:
49
+ self.s3_client.create_bucket(
50
+ Bucket=bucket_name, CreateBucketConfiguration={"LocationConstraint": region}
51
+ )
47
52
 
48
53
  # Set lifecycle to cleanup old builds
49
54
  self.s3_client.put_bucket_lifecycle_configuration(
@@ -10,9 +10,13 @@ from typing import Any, Dict, Optional
10
10
  import boto3
11
11
  import requests
12
12
  from botocore.exceptions import ClientError
13
+ from rich.console import Console
13
14
 
14
15
  from ..utils.endpoints import get_control_plane_endpoint, get_data_plane_endpoint
15
16
 
17
+ logger = logging.getLogger(__name__)
18
+ console = Console()
19
+
16
20
 
17
21
  def generate_session_id() -> str:
18
22
  """Generate session ID."""
@@ -47,19 +51,26 @@ def _handle_aws_response(response) -> dict:
47
51
 
48
52
 
49
53
  def _handle_streaming_response(response) -> Dict[str, Any]:
50
- logger = logging.getLogger("bedrock_agentcore.stream")
51
- logger.setLevel(logging.INFO)
52
-
53
- content = []
54
+ complete_text = ""
54
55
  for line in response.iter_lines(chunk_size=1):
55
56
  if line:
56
57
  line = line.decode("utf-8")
57
58
  if line.startswith("data: "):
58
- line = line[6:]
59
- logger.info(line)
60
- content.append(line)
61
-
62
- return {"response": "\n".join(content)}
59
+ json_chunk = line[6:]
60
+ try:
61
+ parsed_chunk = json.loads(json_chunk)
62
+ if isinstance(parsed_chunk, str):
63
+ text_chunk = parsed_chunk
64
+ else:
65
+ text_chunk = json.dumps(parsed_chunk, ensure_ascii=False)
66
+ text_chunk += "\n"
67
+ console.print(text_chunk, end="", style="bold cyan")
68
+ complete_text += text_chunk
69
+ except json.JSONDecodeError:
70
+ console.print(json_chunk, style="bold cyan")
71
+ continue
72
+ console.print()
73
+ return {}
63
74
 
64
75
 
65
76
  class BedrockAgentCoreClient:
@@ -128,7 +139,19 @@ class BedrockAgentCoreClient:
128
139
  if error_code == "ConflictException":
129
140
  if not auto_update_on_conflict:
130
141
  self.logger.error("Agent '%s' already exists and auto_update_on_conflict is disabled", agent_name)
131
- raise
142
+ # Create a more helpful error message
143
+ raise ClientError(
144
+ {
145
+ "Error": {
146
+ "Code": "ConflictException",
147
+ "Message": (
148
+ f"Agent '{agent_name}' already exists. To update the existing agent, "
149
+ "use the --auto-update-on-conflict flag with the launch command."
150
+ ),
151
+ }
152
+ },
153
+ "CreateAgentRuntime",
154
+ ) from e
132
155
 
133
156
  self.logger.info("Agent '%s' already exists, searching for existing agent...", agent_name)
134
157
 
@@ -428,7 +451,7 @@ class HttpBedrockAgentCoreClient:
428
451
  params={"qualifier": endpoint_name},
429
452
  headers=headers,
430
453
  json=body,
431
- timeout=100,
454
+ timeout=900,
432
455
  stream=True,
433
456
  )
434
457
  return _handle_http_response(response)
@@ -466,7 +489,7 @@ class LocalBedrockAgentCoreClient:
466
489
 
467
490
  try:
468
491
  # Make request with timeout
469
- response = requests.post(url, headers=headers, json=body, timeout=100, stream=True)
492
+ response = requests.post(url, headers=headers, json=body, timeout=900, stream=True)
470
493
  return _handle_http_response(response)
471
494
  except requests.exceptions.RequestException as e:
472
495
  self.logger.error("Failed to invoke agent endpoint: %s", str(e))
@@ -29,21 +29,56 @@ class ContainerRuntime:
29
29
  """
30
30
  runtime_type = runtime_type or self.DEFAULT_RUNTIME
31
31
  self.available_runtimes = ["finch", "docker", "podman"]
32
+ self.runtime = None
33
+ self.has_local_runtime = False
32
34
 
33
35
  if runtime_type == "auto":
34
36
  for runtime in self.available_runtimes:
35
37
  if self._is_runtime_installed(runtime):
36
38
  self.runtime = runtime
39
+ self.has_local_runtime = True
37
40
  break
38
41
  else:
39
- raise RuntimeError("No container runtime found. Please install Docker, Finch, or Podman.")
42
+ # Informational message - default CodeBuild deployment works fine
43
+ _handle_warn(
44
+ "ℹ️ No container engine found (Docker/Finch/Podman not installed)\n"
45
+ "✅ Default deployment uses CodeBuild (no container engine needed)\n"
46
+ "💡 Run 'agentcore launch' for cloud-based building and deployment\n"
47
+ "💡 For local builds, install Docker, Finch, or Podman"
48
+ )
49
+ self.runtime = "none"
50
+ self.has_local_runtime = False
40
51
  elif runtime_type in self.available_runtimes:
41
52
  if self._is_runtime_installed(runtime_type):
42
53
  self.runtime = runtime_type
54
+ self.has_local_runtime = True
43
55
  else:
44
- raise RuntimeError(f"{runtime_type.capitalize()} is not installed")
56
+ # Convert hard error to warning - suggest CodeBuild instead
57
+ _handle_warn(
58
+ f"⚠️ {runtime_type.capitalize()} is not installed\n"
59
+ "💡 Recommendation: Use CodeBuild for building containers in the cloud\n"
60
+ "💡 Run 'agentcore launch' (default) for CodeBuild deployment\n"
61
+ f"💡 For local builds, please install {runtime_type.capitalize()}"
62
+ )
63
+ self.runtime = "none"
64
+ self.has_local_runtime = False
45
65
  else:
46
- raise ValueError(f"Unsupported runtime: {runtime_type}")
66
+ if runtime_type == "none":
67
+ raise ValueError(
68
+ "No supported container engine found.\n\n"
69
+ "AgentCore requires one of the following container engines for local builds:\n"
70
+ "• Docker (any recent version, including Docker Desktop)\n"
71
+ "• Finch (Amazon's open-source container engine)\n"
72
+ "• Podman (compatible alternative to Docker)\n\n"
73
+ "To install:\n"
74
+ "• Docker: https://docs.docker.com/get-docker/\n"
75
+ "• Finch: https://github.com/runfinch/finch\n"
76
+ "• Podman: https://podman.io/getting-started/installation\n\n"
77
+ "Alternative: Use CodeBuild for cloud-based building (no container engine needed):\n"
78
+ " agentcore launch # Uses CodeBuild (default)"
79
+ )
80
+ else:
81
+ raise ValueError(f"Unsupported runtime: {runtime_type}")
47
82
 
48
83
  def _is_runtime_installed(self, runtime: str) -> bool:
49
84
  """Check if runtime is installed."""
@@ -190,6 +225,14 @@ class ContainerRuntime:
190
225
 
191
226
  def build(self, dockerfile_dir: Path, tag: str, platform: Optional[str] = None) -> Tuple[bool, List[str]]:
192
227
  """Build container image."""
228
+ if not self.has_local_runtime:
229
+ return False, [
230
+ "No container runtime available for local build",
231
+ "💡 Recommendation: Use CodeBuild for building containers in the cloud",
232
+ "💡 Run 'agentcore launch' (default) for CodeBuild deployment",
233
+ "💡 For local builds, please install Docker, Finch, or Podman",
234
+ ]
235
+
193
236
  if not dockerfile_dir.exists():
194
237
  return False, [f"Directory not found: {dockerfile_dir}"]
195
238
 
@@ -212,6 +255,14 @@ class ContainerRuntime:
212
255
  port: Port to expose (default: 8080)
213
256
  env_vars: Additional environment variables to pass to container
214
257
  """
258
+ if not self.has_local_runtime:
259
+ raise RuntimeError(
260
+ "No container runtime available for local run\n"
261
+ "💡 Recommendation: Use CodeBuild for building containers in the cloud\n"
262
+ "💡 Run 'agentcore launch' (default) for CodeBuild deployment\n"
263
+ "💡 For local runs, please install Docker, Finch, or Podman"
264
+ )
265
+
215
266
  container_name = f"{tag.split(':')[0]}-{int(time.time())}"
216
267
  cmd = [self.runtime, "run", "-it", "--rm", "-p", f"{port}:8080", "--name", container_name]
217
268
 
@@ -144,7 +144,6 @@ def _handle_explicit_file(package_dir: Path, explicit_file: str) -> DependencyIn
144
144
  # Ensure file is within project directory for Docker context
145
145
  try:
146
146
  relative_path = explicit_path.relative_to(package_dir.resolve())
147
- file_path = str(relative_path)
148
147
  except ValueError:
149
148
  raise ValueError(
150
149
  f"Requirements file must be within project directory. File: {explicit_path}, Project: {package_dir}"
@@ -155,14 +154,21 @@ def _handle_explicit_file(package_dir: Path, explicit_file: str) -> DependencyIn
155
154
  install_path = None
156
155
 
157
156
  if file_type == "pyproject":
158
- if "/" in file_path:
157
+ if len(relative_path.parts) > 1:
159
158
  # pyproject.toml in subdirectory - install from that directory
160
- install_path = str(Path(file_path).parent)
159
+ install_path = Path(relative_path).parent
161
160
  else:
162
161
  # pyproject.toml in root - install from current directory
163
- install_path = "."
162
+ install_path = Path(".")
164
163
 
165
- return DependencyInfo(file=file_path, type=file_type, resolved_path=str(explicit_path), install_path=install_path)
164
+ # Get POSIX strings for file and install path
165
+ file_path = relative_path.as_posix()
166
+ install_path = install_path and install_path.as_posix()
167
+
168
+ # Maintain local format for explicit path
169
+ explicit_path = str(explicit_path)
170
+
171
+ return DependencyInfo(file=file_path, type=file_type, resolved_path=explicit_path, install_path=install_path)
166
172
 
167
173
 
168
174
  def validate_requirements_file(build_dir: Path, requirements_file: str) -> DependencyInfo:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bedrock-agentcore-starter-toolkit
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: A starter toolkit for using Bedrock AgentCore
5
5
  Project-URL: Homepage, https://github.com/aws/bedrock-agentcore-starter-toolkit
6
6
  Project-URL: Bug Tracker, https://github.com/aws/bedrock-agentcore-starter-toolkit/issues
@@ -21,7 +21,7 @@ Classifier: Programming Language :: Python :: 3.13
21
21
  Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
23
  Requires-Python: >=3.10
24
- Requires-Dist: bedrock-agentcore>=0.1.0
24
+ Requires-Dist: bedrock-agentcore>=0.1.1
25
25
  Requires-Dist: boto3>=1.39.7
26
26
  Requires-Dist: botocore>=1.39.7
27
27
  Requires-Dist: docstring-parser<1.0,>=0.15
@@ -1,14 +1,14 @@
1
1
  bedrock_agentcore_starter_toolkit/__init__.py,sha256=tN3-JWKvxk4ZSJQJIHQ4mMsDtt8J_cDCz-drcGU9USA,120
2
- bedrock_agentcore_starter_toolkit/cli/cli.py,sha256=cZ9rQ5i46kq38W3U4HxWH6zKQGWl0nUZkUB6UHu19Bw,850
3
- bedrock_agentcore_starter_toolkit/cli/common.py,sha256=eVjxsQQC4RjvyZouRBTUBPjoWDSE4yQ6q9Mi6WsuDrc,1315
2
+ bedrock_agentcore_starter_toolkit/cli/cli.py,sha256=r_SNlkUH5L6Cbvv17ssjd4McKP9gwgQhCTFULN0G0kA,875
3
+ bedrock_agentcore_starter_toolkit/cli/common.py,sha256=R9ZRKmW9gq7u7gkTiCUOTCQTno2lXnsplnq2x0-k2v8,1311
4
4
  bedrock_agentcore_starter_toolkit/cli/gateway/__init__.py,sha256=8IZ0kSe6Kz5s2j-SBsoc6qy04MbK85RMTQwZCiR2wmo,68
5
5
  bedrock_agentcore_starter_toolkit/cli/gateway/commands.py,sha256=3DuXCvqXlmHU2cmjGzDruyc2Fkrpgoi158myj0vc3nA,3265
6
6
  bedrock_agentcore_starter_toolkit/cli/runtime/__init__.py,sha256=0zKPPoYThoDIr3DZhIQJavq5nVTKRsgcE1s9--wx118,60
7
- bedrock_agentcore_starter_toolkit/cli/runtime/commands.py,sha256=LgErKPNHXqBavdz8Bqngc90tUEBSZg4V2oClqAw1G4w,28422
7
+ bedrock_agentcore_starter_toolkit/cli/runtime/commands.py,sha256=4Mk4ZjlgzYA55Zt--wCDxC84pgso7hpDhdLIUn1f3CI,33141
8
8
  bedrock_agentcore_starter_toolkit/cli/runtime/configuration_manager.py,sha256=5TJK80uzA1ARh263smLfthw1t5Ona3bAtdO1pE7OfNo,5808
9
9
  bedrock_agentcore_starter_toolkit/notebook/__init__.py,sha256=wH1ZzIVKsKT_P0qX2kIIoyVxeHj8K40odfR1YI3McHw,129
10
10
  bedrock_agentcore_starter_toolkit/notebook/runtime/__init__.py,sha256=DoGfB_uGFLANJVE9rSZtTH3ymw76WBWmD9vORvBIdXs,66
11
- bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py,sha256=ep-NVyzjHJfPRhVeuJxpcIbg8FEYHMFF4BwudurjBe0,9738
11
+ bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py,sha256=UvG-X9Ny_z4VhMG8BNTy-OaZMFU4VIQ8QIHz2lm7Dyo,15328
12
12
  bedrock_agentcore_starter_toolkit/operations/__init__.py,sha256=L7sCNjfZviiVVoh2f3NEs2sbjNqFkmIRI3ZPYMMWMz0,51
13
13
  bedrock_agentcore_starter_toolkit/operations/gateway/README.md,sha256=aJla3qAaZmM0b4t9q4lQYqfamAugU0FyyzsufFMRi_A,8192
14
14
  bedrock_agentcore_starter_toolkit/operations/gateway/__init__.py,sha256=5Qo1GeN-DghNp9g0coFUs7WpUJDboJoidOVs-5Co7fo,233
@@ -18,20 +18,20 @@ bedrock_agentcore_starter_toolkit/operations/gateway/create_lambda.py,sha256=MQs
18
18
  bedrock_agentcore_starter_toolkit/operations/gateway/create_role.py,sha256=a38JE28PbdRabskTgLXsiqHqWS1vt06jxEEGneYPO_g,3145
19
19
  bedrock_agentcore_starter_toolkit/operations/gateway/exceptions.py,sha256=WjsrE7lT2708CJniM_ISMzkfNX4IUteGgvOxleD9JZY,272
20
20
  bedrock_agentcore_starter_toolkit/operations/runtime/__init__.py,sha256=7ucAtIbabrDmEaHOfGqHtEr2CkQlEsb5O2tkHirXCqU,673
21
- bedrock_agentcore_starter_toolkit/operations/runtime/configure.py,sha256=BIvFX5EF73X8VNOKQThsyYSWTWLDUkM4di8HW1MGVe8,8948
21
+ bedrock_agentcore_starter_toolkit/operations/runtime/configure.py,sha256=7xjNN6fn1U2cv20W2tmHdlbSjc-RU953tnbOaH5iXPQ,9056
22
22
  bedrock_agentcore_starter_toolkit/operations/runtime/create_role.py,sha256=5-BL_EA1LFy6vSTl5Rppj1et7Y0tuaB8C9-Ze4ESt1A,15952
23
- bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py,sha256=klDICZq-EHcxDjJhb1oVa7-vuFUvq5-HioqWrk__H_E,4539
24
- bedrock_agentcore_starter_toolkit/operations/runtime/launch.py,sha256=6zOt6BEd4rcQz57WIH9MtOqCBN0FEUfp7B68gjXV3jk,15940
25
- bedrock_agentcore_starter_toolkit/operations/runtime/models.py,sha256=6xzNOTSeJj-9kXQKWOGECrBbYopHNNrZfUBsEvl1fNg,3683
23
+ bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py,sha256=ZcPXI7Zx7NO7G7fM2xY6JKVoo2CR2sdyBlBJ63Pd6MI,4559
24
+ bedrock_agentcore_starter_toolkit/operations/runtime/launch.py,sha256=vG6SFKVWtKNtxIkpDA9tHlvHDs1LYA4_t-M_RUXXfyo,19206
25
+ bedrock_agentcore_starter_toolkit/operations/runtime/models.py,sha256=Qr45hc73a25cqmiSErq9-degckPXuVhnENyDSshU_mU,3673
26
26
  bedrock_agentcore_starter_toolkit/operations/runtime/status.py,sha256=tpOtzAq1S3z_7baxR_WOT8Avo3MtWKGpelVOOfb-uMA,2516
27
- bedrock_agentcore_starter_toolkit/services/codebuild.py,sha256=gVYi8CKQwcpt567-qe1-GN5l3n0q3DSlU_dFwlBfy_4,13282
27
+ bedrock_agentcore_starter_toolkit/services/codebuild.py,sha256=i5VbjqAWrPsPwLUdGSWI-_beqFHPqN3FnVLKM4s3rSo,13445
28
28
  bedrock_agentcore_starter_toolkit/services/ecr.py,sha256=nW9wIZcXI6amZeLVSmM9F6awVBQP1-zrFXTozSNEDjo,2805
29
- bedrock_agentcore_starter_toolkit/services/runtime.py,sha256=qL1kk3PL-e7ivArFbVdKyf9PKIPyor2hRdI7rc_Bmws,17214
29
+ bedrock_agentcore_starter_toolkit/services/runtime.py,sha256=TPN2eElh-X-svPpVHn_dHF0Fzl1kAqUIgVSlG_vHaPc,18353
30
30
  bedrock_agentcore_starter_toolkit/utils/endpoints.py,sha256=1gIDRd1oO1fymYpiedVit7m6zl5k6N8Ns9N-2ix7ZaE,1153
31
31
  bedrock_agentcore_starter_toolkit/utils/logging_config.py,sha256=NtZDyndNKCAbz7jZ0leb13bb3UmjjRUTSVwI8MMlOfw,2191
32
32
  bedrock_agentcore_starter_toolkit/utils/runtime/config.py,sha256=qRQid59rD3zJ0d0hcBY4-8R52PNIWEIUt9iR3biuz_c,4495
33
- bedrock_agentcore_starter_toolkit/utils/runtime/container.py,sha256=6mYVA1YOTTWowBtCNdheLWTH1qL7t7Fd3ogloLIuvxQ,12829
34
- bedrock_agentcore_starter_toolkit/utils/runtime/entrypoint.py,sha256=FSZskJc0iZ27RsVbiL5-CYUi1fYdvIxVXUlR1IyvgiU,7144
33
+ bedrock_agentcore_starter_toolkit/utils/runtime/container.py,sha256=wGJLxwT2mhTGPxSoFb6x9lW7Tyz37YghIvSs4jBnO8A,15679
34
+ bedrock_agentcore_starter_toolkit/utils/runtime/entrypoint.py,sha256=0MlqXCUcW9Dvr_9I0KC5PDq7GdIgSueTBIaOUUVtcBA,7355
35
35
  bedrock_agentcore_starter_toolkit/utils/runtime/logs.py,sha256=RUP5W2rbkXf33Kis4MnaI8xIjkpidO1at3kiXmxAw0I,1082
36
36
  bedrock_agentcore_starter_toolkit/utils/runtime/policy_template.py,sha256=CgER7YXPh0BpR6JcTcumDL_k8bhmfLSEok1sf09-31I,2054
37
37
  bedrock_agentcore_starter_toolkit/utils/runtime/schema.py,sha256=gZ0zPvry-ZkXwqUEAy6Izz1RJvmZaXA6a2twnSdk1AY,6418
@@ -39,9 +39,9 @@ bedrock_agentcore_starter_toolkit/utils/runtime/templates/Dockerfile.j2,sha256=t
39
39
  bedrock_agentcore_starter_toolkit/utils/runtime/templates/dockerignore.template,sha256=b_70sBi0MwkTuA9TqxPqFcWK7TcmpaXBJ6M2Ipox65Q,691
40
40
  bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2,sha256=eFPp6sl7TS7p_FSdCqSMkXNZnDg-ahg9rhufT71A0SQ,2477
41
41
  bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_trust_policy.json.j2,sha256=PPJF6Ofq70W5DUE0NlbmnZjw5RkgepPgkskxEgEG28o,473
42
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/METADATA,sha256=7JZNYKxrMiGvKEtScwBnwGr3Du-MElHjtlUTHU8TKzI,6198
43
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/entry_points.txt,sha256=Tf94DkUf2Tp8P7p8MEXLxre7A7Pp_XNukteiz0wHnk8,77
45
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/licenses/LICENSE.txt,sha256=nNPOMinitYdtfbhdQgsPgz1UowBznU6QVN3Xs0pSTKU,10768
46
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/licenses/NOTICE.txt,sha256=rkBsg8DbKqfIoQbveqX9foR4uJPUVAokbkr02pRPilE,8674
47
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/RECORD,,
42
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/METADATA,sha256=iX0FQeMib-MtEBtK6nBnp-3nSk8_el-QjlN_8fG_fBk,6198
43
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
44
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/entry_points.txt,sha256=Tf94DkUf2Tp8P7p8MEXLxre7A7Pp_XNukteiz0wHnk8,77
45
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/licenses/LICENSE.txt,sha256=nNPOMinitYdtfbhdQgsPgz1UowBznU6QVN3Xs0pSTKU,10768
46
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/licenses/NOTICE.txt,sha256=rkBsg8DbKqfIoQbveqX9foR4uJPUVAokbkr02pRPilE,8674
47
+ bedrock_agentcore_starter_toolkit-0.1.3.dist-info/RECORD,,