bedrock-agentcore-starter-toolkit 0.0.1__py3-none-any.whl → 0.1.1__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/__init__.py +5 -0
- bedrock_agentcore_starter_toolkit/cli/cli.py +32 -0
- bedrock_agentcore_starter_toolkit/cli/common.py +44 -0
- bedrock_agentcore_starter_toolkit/cli/gateway/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/cli/gateway/commands.py +88 -0
- bedrock_agentcore_starter_toolkit/cli/runtime/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/cli/runtime/commands.py +651 -0
- bedrock_agentcore_starter_toolkit/cli/runtime/configuration_manager.py +133 -0
- bedrock_agentcore_starter_toolkit/notebook/__init__.py +5 -0
- bedrock_agentcore_starter_toolkit/notebook/runtime/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py +239 -0
- bedrock_agentcore_starter_toolkit/operations/__init__.py +1 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/README.md +277 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/__init__.py +6 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/client.py +456 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/constants.py +152 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/create_lambda.py +85 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/create_role.py +90 -0
- bedrock_agentcore_starter_toolkit/operations/gateway/exceptions.py +13 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/__init__.py +26 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/configure.py +241 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/create_role.py +404 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/invoke.py +129 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/launch.py +439 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/models.py +79 -0
- bedrock_agentcore_starter_toolkit/operations/runtime/status.py +66 -0
- bedrock_agentcore_starter_toolkit/services/codebuild.py +332 -0
- bedrock_agentcore_starter_toolkit/services/ecr.py +84 -0
- bedrock_agentcore_starter_toolkit/services/runtime.py +473 -0
- bedrock_agentcore_starter_toolkit/utils/endpoints.py +32 -0
- bedrock_agentcore_starter_toolkit/utils/logging_config.py +72 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/config.py +129 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/container.py +310 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/entrypoint.py +197 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/logs.py +33 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/policy_template.py +74 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/schema.py +151 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/Dockerfile.j2 +44 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/dockerignore.template +68 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_policy.json.j2 +98 -0
- bedrock_agentcore_starter_toolkit/utils/runtime/templates/execution_role_trust_policy.json.j2 +21 -0
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/METADATA +137 -0
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/RECORD +47 -0
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/entry_points.txt +2 -0
- bedrock_agentcore_starter_toolkit-0.1.1.dist-info/licenses/NOTICE.txt +190 -0
- bedrock_agentcore_starter_toolkit/init.py +0 -3
- bedrock_agentcore_starter_toolkit-0.0.1.dist-info/METADATA +0 -26
- bedrock_agentcore_starter_toolkit-0.0.1.dist-info/RECORD +0 -5
- {bedrock_agentcore_starter_toolkit-0.0.1.dist-info → bedrock_agentcore_starter_toolkit-0.1.1.dist-info}/WHEEL +0 -0
- /bedrock_agentcore_starter_toolkit-0.0.1.dist-info/licenses/LICENSE → /bedrock_agentcore_starter_toolkit-0.1.1.dist-info/licenses/LICENSE.txt +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""BedrockAgentCore CLI main module."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from ..cli.gateway.commands import create_mcp_gateway, create_mcp_gateway_target, gateway_app
|
|
6
|
+
from ..utils.logging_config import setup_toolkit_logging
|
|
7
|
+
from .runtime.commands import configure_app, invoke, launch, status
|
|
8
|
+
|
|
9
|
+
app = typer.Typer(name="agentcore", help="BedrockAgentCore CLI", add_completion=False)
|
|
10
|
+
|
|
11
|
+
# Setup centralized logging for CLI
|
|
12
|
+
setup_toolkit_logging(mode="cli")
|
|
13
|
+
|
|
14
|
+
# runtime
|
|
15
|
+
app.command("invoke")(invoke)
|
|
16
|
+
app.command("status")(status)
|
|
17
|
+
app.command("launch")(launch)
|
|
18
|
+
app.add_typer(configure_app)
|
|
19
|
+
|
|
20
|
+
# gateway
|
|
21
|
+
app.command("create_mcp_gateway")(create_mcp_gateway)
|
|
22
|
+
app.command("create_mcp_gateway_target")(create_mcp_gateway_target)
|
|
23
|
+
app.add_typer(gateway_app, name="gateway")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def main():
|
|
27
|
+
"""Entry point for the CLI application."""
|
|
28
|
+
app()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
if __name__ == "__main__":
|
|
32
|
+
main()
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Common utilities for BedrockAgentCore CLI."""
|
|
2
|
+
|
|
3
|
+
from typing import NoReturn, Optional
|
|
4
|
+
|
|
5
|
+
import typer
|
|
6
|
+
from prompt_toolkit import prompt
|
|
7
|
+
from rich.console import Console
|
|
8
|
+
|
|
9
|
+
console = Console()
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _handle_error(message: str, exception: Optional[Exception] = None) -> NoReturn:
|
|
13
|
+
"""Handle errors with consistent formatting and exit."""
|
|
14
|
+
console.print(f"[red]❌ {message}[/red]")
|
|
15
|
+
if exception:
|
|
16
|
+
raise typer.Exit(1) from exception
|
|
17
|
+
else:
|
|
18
|
+
raise typer.Exit(1)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def _handle_warn(message: str) -> NoReturn:
|
|
22
|
+
"""Handle errors with consistent formatting and exit."""
|
|
23
|
+
console.print(f"⚠️ {message}", new_line_start=True, style="bold yellow underline")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _print_success(message: str) -> None:
|
|
27
|
+
"""Print success message with consistent formatting."""
|
|
28
|
+
console.print(f"[green]✓[/green] {message}")
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _prompt_with_default(question: str, default_value: Optional[str] = "") -> str:
|
|
32
|
+
"""Prompt user with AWS CLI style [default] format and empty input field."""
|
|
33
|
+
prompt_text = question
|
|
34
|
+
if default_value:
|
|
35
|
+
prompt_text += f" [{default_value}]"
|
|
36
|
+
prompt_text += ": "
|
|
37
|
+
|
|
38
|
+
response = prompt(prompt_text, default="")
|
|
39
|
+
|
|
40
|
+
# If user pressed Enter without typing, use default
|
|
41
|
+
if not response and default_value:
|
|
42
|
+
return default_value
|
|
43
|
+
|
|
44
|
+
return response
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""BedrockAgentCore Gateway Starter Toolkit cli gateway package."""
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"""Bedrock AgentCore CLI - Command line interface for Bedrock AgentCore."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
|
|
8
|
+
from ...operations.gateway import GatewayClient
|
|
9
|
+
from ..common import console
|
|
10
|
+
|
|
11
|
+
# Create a Typer app for gateway commands
|
|
12
|
+
gateway_app = typer.Typer(help="Manage Bedrock AgentCore Gateways")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@gateway_app.command()
|
|
16
|
+
def create_mcp_gateway(
|
|
17
|
+
region: str = None,
|
|
18
|
+
name: Optional[str] = None,
|
|
19
|
+
role_arn: Optional[str] = None,
|
|
20
|
+
authorizer_config: Optional[str] = None,
|
|
21
|
+
enable_semantic_search: Optional[bool] = typer.Option(True, "--enable_semantic_search", "-sem"),
|
|
22
|
+
) -> None:
|
|
23
|
+
"""Creates an MCP Gateway.
|
|
24
|
+
|
|
25
|
+
:param region: optional - region to use (defaults to us-west-2).
|
|
26
|
+
:param name: optional - the name of the gateway (defaults to TestGateway).
|
|
27
|
+
:param role_arn: optional - the role arn to use (creates one if none provided).
|
|
28
|
+
:param authorizer_config: optional - the serialized authorizer config (will create one if none provided).
|
|
29
|
+
:param enable_semantic_search: optional - whether to enable search tool (defaults to True).
|
|
30
|
+
:return:
|
|
31
|
+
"""
|
|
32
|
+
client = GatewayClient(region_name=region)
|
|
33
|
+
json_authorizer_config = ""
|
|
34
|
+
if authorizer_config:
|
|
35
|
+
json_authorizer_config = json.loads(authorizer_config)
|
|
36
|
+
gateway = client.create_mcp_gateway(name, role_arn, json_authorizer_config, enable_semantic_search)
|
|
37
|
+
console.print(gateway)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@gateway_app.command()
|
|
41
|
+
def create_mcp_gateway_target(
|
|
42
|
+
gateway_arn: str = None,
|
|
43
|
+
gateway_url: str = None,
|
|
44
|
+
role_arn: str = None,
|
|
45
|
+
region: str = None,
|
|
46
|
+
name: Optional[str] = None,
|
|
47
|
+
target_type: Optional[str] = None,
|
|
48
|
+
target_payload: Optional[str] = None,
|
|
49
|
+
credentials: Optional[str] = None,
|
|
50
|
+
) -> None:
|
|
51
|
+
"""Creates an MCP Gateway Target.
|
|
52
|
+
|
|
53
|
+
:param gateway_arn: required - the arn of the created gateway
|
|
54
|
+
:param gateway_url: required - the url of the created gateway
|
|
55
|
+
:param role_arn: required - the role arn of the created gateway
|
|
56
|
+
:param region: optional - the region to use, defaults to us-west-2
|
|
57
|
+
:param name: optional - the name of the target (defaults to TestGatewayTarget).
|
|
58
|
+
:param target_type: optional - the type of the target e.g. one of "lambda" |
|
|
59
|
+
"openApiSchema" | "smithyModel" (defaults to "lambda").
|
|
60
|
+
:param target_payload: only required for openApiSchema target - the specification of that target.
|
|
61
|
+
:param credentials: only use with openApiSchema target - the credentials for calling this target
|
|
62
|
+
(api key or oauth2).
|
|
63
|
+
:return:
|
|
64
|
+
"""
|
|
65
|
+
client = GatewayClient(region_name=region)
|
|
66
|
+
json_credentials = ""
|
|
67
|
+
json_target_payload = ""
|
|
68
|
+
if credentials:
|
|
69
|
+
json_credentials = json.loads(credentials)
|
|
70
|
+
if target_payload:
|
|
71
|
+
json_target_payload = json.loads(target_payload)
|
|
72
|
+
target = client.create_mcp_gateway_target(
|
|
73
|
+
gateway={
|
|
74
|
+
"gatewayArn": gateway_arn,
|
|
75
|
+
"gatewayUrl": gateway_url,
|
|
76
|
+
"gatewayId": gateway_arn.split("/")[-1],
|
|
77
|
+
"roleArn": role_arn,
|
|
78
|
+
},
|
|
79
|
+
name=name,
|
|
80
|
+
target_type=target_type,
|
|
81
|
+
target_payload=json_target_payload,
|
|
82
|
+
credentials=json_credentials,
|
|
83
|
+
)
|
|
84
|
+
console.print(target)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
if __name__ == "__main__":
|
|
88
|
+
gateway_app()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""BedrockAgentCore Starter Toolkit cli runtime package."""
|