agentcore-cli 0.31.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.
- agentcore/__init__.py +1 -0
- agentcore/agent_inspector/NOTICE +9 -0
- agentcore/agent_inspector/favicon.svg +60 -0
- agentcore/agent_inspector/index.css +1 -0
- agentcore/agent_inspector/index.html +14 -0
- agentcore/agent_inspector/index.js +289 -0
- agentcore/assets/AGENTS.md +60 -0
- agentcore/assets/README.md +108 -0
- agentcore/assets/agents/AGENTS.md +218 -0
- agentcore/assets/cdk/.prettierrc +8 -0
- agentcore/assets/cdk/README.md +26 -0
- agentcore/assets/cdk/bin/cdk.ts +216 -0
- agentcore/assets/cdk/cdk.json +88 -0
- agentcore/assets/cdk/gitignore.template +9 -0
- agentcore/assets/cdk/jest.config.js +9 -0
- agentcore/assets/cdk/lib/cdk-stack.ts +291 -0
- agentcore/assets/cdk/npmignore.template +6 -0
- agentcore/assets/cdk/package.json +30 -0
- agentcore/assets/cdk/test/cdk.test.ts +31 -0
- agentcore/assets/cdk/tsconfig.json +28 -0
- agentcore/assets/container/python/Dockerfile +47 -0
- agentcore/assets/container/python/dockerignore.template +27 -0
- agentcore/assets/container/typescript/Dockerfile +25 -0
- agentcore/assets/container/typescript/dockerignore.template +24 -0
- agentcore/assets/datasets/predefined-v1.jsonl +3 -0
- agentcore/assets/datasets/simulated-v1.jsonl +3 -0
- agentcore/assets/evaluators/autoevals-lambda/execution-role-policy.json +15 -0
- agentcore/assets/evaluators/autoevals-lambda/lambda_function.py +37 -0
- agentcore/assets/evaluators/autoevals-lambda/pyproject.toml +22 -0
- agentcore/assets/evaluators/deepeval-lambda/execution-role-policy.json +15 -0
- agentcore/assets/evaluators/deepeval-lambda/lambda_function.py +29 -0
- agentcore/assets/evaluators/deepeval-lambda/pyproject.toml +19 -0
- agentcore/assets/evaluators/python-lambda/execution-role-policy.json +10 -0
- agentcore/assets/evaluators/python-lambda/lambda_function.py +19 -0
- agentcore/assets/evaluators/python-lambda/pyproject.toml +15 -0
- agentcore/assets/harness/invoke.py.template +74 -0
- agentcore/assets/mcp/python/README.md +27 -0
- agentcore/assets/mcp/python/pyproject.toml +22 -0
- agentcore/assets/mcp/python/server.py +117 -0
- agentcore/assets/mcp/python-lambda/README.md +22 -0
- agentcore/assets/mcp/python-lambda/handler.py +144 -0
- agentcore/assets/mcp/python-lambda/pyproject.toml +15 -0
- agentcore/assets/python/a2a/googleadk/base/README.md +22 -0
- agentcore/assets/python/a2a/googleadk/base/gitignore.template +41 -0
- agentcore/assets/python/a2a/googleadk/base/main.py +124 -0
- agentcore/assets/python/a2a/googleadk/base/model/__init__.py +1 -0
- agentcore/assets/python/a2a/googleadk/base/model/load.py +41 -0
- agentcore/assets/python/a2a/googleadk/base/pyproject.toml +22 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/README.md +22 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/gitignore.template +41 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/main.py +144 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/model/__init__.py +1 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/model/load.py +123 -0
- agentcore/assets/python/a2a/langchain_langgraph/base/pyproject.toml +26 -0
- agentcore/assets/python/a2a/strands/base/README.md +22 -0
- agentcore/assets/python/a2a/strands/base/gitignore.template +41 -0
- agentcore/assets/python/a2a/strands/base/main.py +113 -0
- agentcore/assets/python/a2a/strands/base/model/__init__.py +1 -0
- agentcore/assets/python/a2a/strands/base/model/load.py +123 -0
- agentcore/assets/python/a2a/strands/base/pyproject.toml +23 -0
- agentcore/assets/python/a2a/strands/capabilities/memory/__init__.py +1 -0
- agentcore/assets/python/a2a/strands/capabilities/memory/session.py +46 -0
- agentcore/assets/python/agui/googleadk/base/README.md +30 -0
- agentcore/assets/python/agui/googleadk/base/gitignore.template +41 -0
- agentcore/assets/python/agui/googleadk/base/main.py +91 -0
- agentcore/assets/python/agui/googleadk/base/model/__init__.py +1 -0
- agentcore/assets/python/agui/googleadk/base/model/load.py +41 -0
- agentcore/assets/python/agui/googleadk/base/pyproject.toml +25 -0
- agentcore/assets/python/agui/langchain_langgraph/base/README.md +22 -0
- agentcore/assets/python/agui/langchain_langgraph/base/gitignore.template +41 -0
- agentcore/assets/python/agui/langchain_langgraph/base/main.py +130 -0
- agentcore/assets/python/agui/langchain_langgraph/base/model/__init__.py +1 -0
- agentcore/assets/python/agui/langchain_langgraph/base/model/load.py +123 -0
- agentcore/assets/python/agui/langchain_langgraph/base/pyproject.toml +31 -0
- agentcore/assets/python/agui/strands/base/README.md +22 -0
- agentcore/assets/python/agui/strands/base/gitignore.template +41 -0
- agentcore/assets/python/agui/strands/base/main.py +105 -0
- agentcore/assets/python/agui/strands/base/model/__init__.py +1 -0
- agentcore/assets/python/agui/strands/base/model/load.py +123 -0
- agentcore/assets/python/agui/strands/base/pyproject.toml +27 -0
- agentcore/assets/python/agui/strands/capabilities/memory/__init__.py +1 -0
- agentcore/assets/python/agui/strands/capabilities/memory/session.py +46 -0
- agentcore/assets/python/http/autogen/base/README.md +45 -0
- agentcore/assets/python/http/autogen/base/gitignore.template +41 -0
- agentcore/assets/python/http/autogen/base/main.py +145 -0
- agentcore/assets/python/http/autogen/base/mcp_client/__init__.py +1 -0
- agentcore/assets/python/http/autogen/base/mcp_client/client.py +28 -0
- agentcore/assets/python/http/autogen/base/model/__init__.py +1 -0
- agentcore/assets/python/http/autogen/base/model/load.py +136 -0
- agentcore/assets/python/http/autogen/base/pyproject.toml +34 -0
- agentcore/assets/python/http/bma/base/Dockerfile +41 -0
- agentcore/assets/python/http/bma/base/README.md +178 -0
- agentcore/assets/python/http/bma/base/client.py +200 -0
- agentcore/assets/python/http/bma/base/lifecycle/server.py +641 -0
- agentcore/assets/python/http/bma/base/otel/collector.yaml +69 -0
- agentcore/assets/python/http/bma/base/plugins/acr-report/.codex-plugin/plugin.json +6 -0
- agentcore/assets/python/http/bma/base/plugins/acr-report/skills/acr-report/SKILL.md +16 -0
- agentcore/assets/python/http/bma/base/policies/bma-acr-policy.json +11 -0
- agentcore/assets/python/http/bma/base/policies/bma-session-policy.json +35 -0
- agentcore/assets/python/http/bma/base/policies/bma-session-trust.json +20 -0
- agentcore/assets/python/http/bma/base/pyproject.toml +21 -0
- agentcore/assets/python/http/googleadk/base/README.md +45 -0
- agentcore/assets/python/http/googleadk/base/gitignore.template +41 -0
- agentcore/assets/python/http/googleadk/base/main.py +207 -0
- agentcore/assets/python/http/googleadk/base/mcp_client/__init__.py +1 -0
- agentcore/assets/python/http/googleadk/base/mcp_client/client.py +75 -0
- agentcore/assets/python/http/googleadk/base/model/__init__.py +1 -0
- agentcore/assets/python/http/googleadk/base/model/load.py +41 -0
- agentcore/assets/python/http/googleadk/base/pyproject.toml +24 -0
- agentcore/assets/python/http/langchain_langgraph/base/README.md +45 -0
- agentcore/assets/python/http/langchain_langgraph/base/gitignore.template +41 -0
- agentcore/assets/python/http/langchain_langgraph/base/main.py +227 -0
- agentcore/assets/python/http/langchain_langgraph/base/mcp_client/__init__.py +1 -0
- agentcore/assets/python/http/langchain_langgraph/base/mcp_client/client.py +79 -0
- agentcore/assets/python/http/langchain_langgraph/base/model/__init__.py +1 -0
- agentcore/assets/python/http/langchain_langgraph/base/model/load.py +123 -0
- agentcore/assets/python/http/langchain_langgraph/base/pyproject.toml +38 -0
- agentcore/assets/python/http/openaiagents/base/README.md +45 -0
- agentcore/assets/python/http/openaiagents/base/gitignore.template +41 -0
- agentcore/assets/python/http/openaiagents/base/main.py +200 -0
- agentcore/assets/python/http/openaiagents/base/mcp_client/__init__.py +1 -0
- agentcore/assets/python/http/openaiagents/base/mcp_client/client.py +74 -0
- agentcore/assets/python/http/openaiagents/base/model/__init__.py +1 -0
- agentcore/assets/python/http/openaiagents/base/model/load.py +37 -0
- agentcore/assets/python/http/openaiagents/base/pyproject.toml +21 -0
- agentcore/assets/python/http/strands/base/README.md +46 -0
- agentcore/assets/python/http/strands/base/gitignore.template +41 -0
- agentcore/assets/python/http/strands/base/main.py +714 -0
- agentcore/assets/python/http/strands/base/mcp_client/__init__.py +1 -0
- agentcore/assets/python/http/strands/base/mcp_client/client.py +116 -0
- agentcore/assets/python/http/strands/base/model/__init__.py +1 -0
- agentcore/assets/python/http/strands/base/model/load.py +239 -0
- agentcore/assets/python/http/strands/base/model/mantle_compat.py +21 -0
- agentcore/assets/python/http/strands/base/pyproject.toml +31 -0
- agentcore/assets/python/http/strands/base/skills/fetcher.py +279 -0
- agentcore/assets/python/http/strands/capabilities/execution-limits/hooks/execution_limits.py +54 -0
- agentcore/assets/python/http/strands/capabilities/memory/__init__.py +1 -0
- agentcore/assets/python/http/strands/capabilities/memory/session.py +47 -0
- agentcore/assets/python/http/strands/capabilities/payments/__init__.py +4 -0
- agentcore/assets/python/http/strands/capabilities/payments/payments.py +142 -0
- agentcore/assets/python/mcp/standalone/base/README.md +36 -0
- agentcore/assets/python/mcp/standalone/base/gitignore.template +41 -0
- agentcore/assets/python/mcp/standalone/base/main.py +83 -0
- agentcore/assets/python/mcp/standalone/base/pyproject.toml +16 -0
- agentcore/assets/typescript/.gitkeep +0 -0
- agentcore/assets/typescript/http/strands/base/README.md +42 -0
- agentcore/assets/typescript/http/strands/base/gitignore.template +22 -0
- agentcore/assets/typescript/http/strands/base/main.ts +149 -0
- agentcore/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
- agentcore/assets/typescript/http/strands/base/model/load.ts +102 -0
- agentcore/assets/typescript/http/strands/base/package.json +38 -0
- agentcore/assets/typescript/http/strands/base/tsconfig.json +19 -0
- agentcore/assets/typescript/http/strands/capabilities/memory/memory.ts +52 -0
- agentcore/assets/typescript/http/vercelai/base/README.md +42 -0
- agentcore/assets/typescript/http/vercelai/base/gitignore.template +22 -0
- agentcore/assets/typescript/http/vercelai/base/main.ts +70 -0
- agentcore/assets/typescript/http/vercelai/base/model/load.ts +121 -0
- agentcore/assets/typescript/http/vercelai/base/package.json +35 -0
- agentcore/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
- agentcore/aws/__init__.py +263 -0
- agentcore/aws/_aws_errors.py +72 -0
- agentcore/aws/_http.py +176 -0
- agentcore/aws/_util.py +37 -0
- agentcore/aws/account.py +165 -0
- agentcore/aws/agentcore.py +971 -0
- agentcore/aws/agentcore_ab_tests.py +230 -0
- agentcore/aws/agentcore_batch_evaluation.py +227 -0
- agentcore/aws/agentcore_config_bundles.py +220 -0
- agentcore/aws/agentcore_control.py +994 -0
- agentcore/aws/agentcore_datasets.py +222 -0
- agentcore/aws/agentcore_harness.py +330 -0
- agentcore/aws/agentcore_payments.py +430 -0
- agentcore/aws/agentcore_recommendation.py +140 -0
- agentcore/aws/agui_parser.py +131 -0
- agentcore/aws/agui_types.py +342 -0
- agentcore/aws/api_client.py +87 -0
- agentcore/aws/arn.py +18 -0
- agentcore/aws/aws_context.py +23 -0
- agentcore/aws/bedrock.py +44 -0
- agentcore/aws/bedrock_agent.py +129 -0
- agentcore/aws/bedrock_import.py +252 -0
- agentcore/aws/bedrock_import_types.py +111 -0
- agentcore/aws/cloudwatch.py +136 -0
- agentcore/aws/connect_shell.py +266 -0
- agentcore/aws/iam.py +41 -0
- agentcore/aws/partition.py +58 -0
- agentcore/aws/policy_generation.py +116 -0
- agentcore/aws/region.py +54 -0
- agentcore/aws/retry.py +27 -0
- agentcore/aws/shell_framer.py +136 -0
- agentcore/aws/stage_endpoint.py +39 -0
- agentcore/aws/target_region.py +54 -0
- agentcore/aws/transaction_search.py +97 -0
- agentcore/cdk/__init__.py +10 -0
- agentcore/cdk/constants.py +13 -0
- agentcore/cdk/local_cdk_project.py +48 -0
- agentcore/cdk/toolkit.py +706 -0
- agentcore/cli/__init__.py +0 -0
- agentcore/cli/commands/__init__.py +0 -0
- agentcore/cli/commands/_jobs_common.py +39 -0
- agentcore/cli/commands/_run_wizards.py +639 -0
- agentcore/cli/commands/add/__init__.py +37 -0
- agentcore/cli/commands/add/_commander.py +52 -0
- agentcore/cli/commands/add/_common.py +47 -0
- agentcore/cli/commands/add/agent_wizard.py +528 -0
- agentcore/cli/commands/add/auth_options.py +154 -0
- agentcore/cli/commands/add/skill_action.py +105 -0
- agentcore/cli/commands/add/skill_command.py +87 -0
- agentcore/cli/commands/add/tool_action.py +160 -0
- agentcore/cli/commands/add/tool_command.py +117 -0
- agentcore/cli/commands/add/validate.py +333 -0
- agentcore/cli/commands/capacity_provider/__init__.py +86 -0
- agentcore/cli/commands/capacity_provider/action.py +114 -0
- agentcore/cli/commands/capacity_provider/constants.py +22 -0
- agentcore/cli/commands/config.py +91 -0
- agentcore/cli/commands/config_bundle.py +251 -0
- agentcore/cli/commands/create/__init__.py +643 -0
- agentcore/cli/commands/create/action.py +406 -0
- agentcore/cli/commands/create/dependencies.py +91 -0
- agentcore/cli/commands/create/harness_validate.py +82 -0
- agentcore/cli/commands/create/validate.py +195 -0
- agentcore/cli/commands/create/wizard.py +127 -0
- agentcore/cli/commands/dataset.py +119 -0
- agentcore/cli/commands/deploy/__init__.py +31 -0
- agentcore/cli/commands/deploy/_guards.py +25 -0
- agentcore/cli/commands/deploy/actions.py +840 -0
- agentcore/cli/commands/deploy/command.py +349 -0
- agentcore/cli/commands/deploy/progress.py +115 -0
- agentcore/cli/commands/deploy/types.py +68 -0
- agentcore/cli/commands/deploy/utils.py +43 -0
- agentcore/cli/commands/deploy/validate.py +21 -0
- agentcore/cli/commands/dev/__init__.py +5 -0
- agentcore/cli/commands/dev/_deps.py +50 -0
- agentcore/cli/commands/dev/browser_mode.py +270 -0
- agentcore/cli/commands/dev/command.py +450 -0
- agentcore/cli/commands/dev/terminal_mode.py +379 -0
- agentcore/cli/commands/exec/__init__.py +29 -0
- agentcore/cli/commands/exec/action.py +442 -0
- agentcore/cli/commands/exec/command.py +206 -0
- agentcore/cli/commands/exec/types.py +35 -0
- agentcore/cli/commands/export/__init__.py +114 -0
- agentcore/cli/commands/export/constants.py +21 -0
- agentcore/cli/commands/export/fetch_harness_spec.py +234 -0
- agentcore/cli/commands/export/harness_action.py +385 -0
- agentcore/cli/commands/export/harness_mapper.py +868 -0
- agentcore/cli/commands/export/harness_resolver.py +95 -0
- agentcore/cli/commands/export/types.py +90 -0
- agentcore/cli/commands/export/wizard.py +97 -0
- agentcore/cli/commands/feedback/__init__.py +69 -0
- agentcore/cli/commands/feedback/action.py +30 -0
- agentcore/cli/commands/feedback/consent_prompt.py +35 -0
- agentcore/cli/commands/feedback/wizard.py +49 -0
- agentcore/cli/commands/fetch/__init__.py +69 -0
- agentcore/cli/commands/fetch/action.py +62 -0
- agentcore/cli/commands/help.py +65 -0
- agentcore/cli/commands/import_/__init__.py +167 -0
- agentcore/cli/commands/import_/_js.py +72 -0
- agentcore/cli/commands/import_/actions.py +457 -0
- agentcore/cli/commands/import_/constants.py +45 -0
- agentcore/cli/commands/import_/import_evaluator.py +140 -0
- agentcore/cli/commands/import_/import_gateway.py +520 -0
- agentcore/cli/commands/import_/import_memory.py +128 -0
- agentcore/cli/commands/import_/import_online_eval.py +165 -0
- agentcore/cli/commands/import_/import_pipeline.py +145 -0
- agentcore/cli/commands/import_/import_runtime.py +214 -0
- agentcore/cli/commands/import_/import_utils.py +410 -0
- agentcore/cli/commands/import_/phase1_update.py +110 -0
- agentcore/cli/commands/import_/phase2_import.py +206 -0
- agentcore/cli/commands/import_/resource_import.py +228 -0
- agentcore/cli/commands/import_/template_utils.py +148 -0
- agentcore/cli/commands/import_/types.py +150 -0
- agentcore/cli/commands/import_/yaml_parser.py +265 -0
- agentcore/cli/commands/init.py +196 -0
- agentcore/cli/commands/invoke/__init__.py +32 -0
- agentcore/cli/commands/invoke/_deps.py +73 -0
- agentcore/cli/commands/invoke/action.py +840 -0
- agentcore/cli/commands/invoke/command.py +490 -0
- agentcore/cli/commands/invoke/constants.py +40 -0
- agentcore/cli/commands/invoke/guards.py +23 -0
- agentcore/cli/commands/invoke/interactive.py +604 -0
- agentcore/cli/commands/invoke/resolve.py +149 -0
- agentcore/cli/commands/invoke/resolve_prompt.py +60 -0
- agentcore/cli/commands/invoke/types.py +61 -0
- agentcore/cli/commands/invoke/validate.py +33 -0
- agentcore/cli/commands/job_actions.py +239 -0
- agentcore/cli/commands/job_history.py +380 -0
- agentcore/cli/commands/logs/__init__.py +53 -0
- agentcore/cli/commands/logs/action.py +159 -0
- agentcore/cli/commands/logs/filter_pattern.py +17 -0
- agentcore/cli/commands/logs/guards.py +51 -0
- agentcore/cli/commands/logs_evals.py +42 -0
- agentcore/cli/commands/package.py +118 -0
- agentcore/cli/commands/remove/__init__.py +172 -0
- agentcore/cli/commands/remove/skill_command.py +131 -0
- agentcore/cli/commands/remove/tool_command.py +59 -0
- agentcore/cli/commands/run.py +808 -0
- agentcore/cli/commands/run_ingest.py +97 -0
- agentcore/cli/commands/shared/__init__.py +0 -0
- agentcore/cli/commands/shared/arn_utils.py +9 -0
- agentcore/cli/commands/shared/filesystem_utils.py +421 -0
- agentcore/cli/commands/shared/header_utils.py +87 -0
- agentcore/cli/commands/shared/indexed_key_parser.py +76 -0
- agentcore/cli/commands/shared/lifecycle_utils.py +72 -0
- agentcore/cli/commands/shared/region_utils.py +20 -0
- agentcore/cli/commands/shared/vpc_utils.py +99 -0
- agentcore/cli/commands/status/__init__.py +30 -0
- agentcore/cli/commands/status/_guards.py +25 -0
- agentcore/cli/commands/status/action.py +741 -0
- agentcore/cli/commands/status/command.py +321 -0
- agentcore/cli/commands/status/constants.py +36 -0
- agentcore/cli/commands/status/format_knowledge_base.py +111 -0
- agentcore/cli/commands/telemetry.py +79 -0
- agentcore/cli/commands/traces/__init__.py +155 -0
- agentcore/cli/commands/traces/action.py +123 -0
- agentcore/cli/commands/update/__init__.py +63 -0
- agentcore/cli/commands/update/action.py +164 -0
- agentcore/cli/commands/validate.py +165 -0
- agentcore/cli/constants.py +96 -0
- agentcore/cli/errors.py +118 -0
- agentcore/cli/external_requirements/__init__.py +67 -0
- agentcore/cli/external_requirements/checks.py +280 -0
- agentcore/cli/external_requirements/detect.py +55 -0
- agentcore/cli/external_requirements/versions.py +57 -0
- agentcore/cli/groups.py +23 -0
- agentcore/cli/interactive.py +85 -0
- agentcore/cli/main.py +137 -0
- agentcore/cli/naming.py +11 -0
- agentcore/cli/notices.py +42 -0
- agentcore/cli/project.py +34 -0
- agentcore/cli/run_command.py +27 -0
- agentcore/cli/tree.py +135 -0
- agentcore/cli/update_notifier.py +123 -0
- agentcore/cli/variadic.py +50 -0
- agentcore/cloudformation/__init__.py +84 -0
- agentcore/cloudformation/bootstrap.py +64 -0
- agentcore/cloudformation/logical_ids.py +37 -0
- agentcore/cloudformation/outputs.py +566 -0
- agentcore/cloudformation/stack_discovery.py +75 -0
- agentcore/cloudformation/stack_events.py +107 -0
- agentcore/cloudformation/stack_status.py +98 -0
- agentcore/cloudformation/types.py +44 -0
- agentcore/lib/__init__.py +68 -0
- agentcore/lib/constants.py +77 -0
- agentcore/lib/dependency_management/__init__.py +23 -0
- agentcore/lib/dependency_management/messages.py +92 -0
- agentcore/lib/dependency_management/plan.py +98 -0
- agentcore/lib/dependency_management/semver.py +137 -0
- agentcore/lib/dependency_management/sync.py +139 -0
- agentcore/lib/dependency_management/types.py +56 -0
- agentcore/lib/errors/__init__.py +5 -0
- agentcore/lib/errors/types.py +352 -0
- agentcore/lib/errors/validation.py +121 -0
- agentcore/lib/packaging/__init__.py +81 -0
- agentcore/lib/packaging/build_args.py +23 -0
- agentcore/lib/packaging/build_context.py +26 -0
- agentcore/lib/packaging/build_context_dockerignore.py +45 -0
- agentcore/lib/packaging/container.py +95 -0
- agentcore/lib/packaging/helpers.py +289 -0
- agentcore/lib/packaging/node.py +153 -0
- agentcore/lib/packaging/python.py +135 -0
- agentcore/lib/packaging/types.py +69 -0
- agentcore/lib/packaging/uv.py +45 -0
- agentcore/lib/result.py +104 -0
- agentcore/lib/schemas/__init__.py +1 -0
- agentcore/lib/schemas/io/__init__.py +27 -0
- agentcore/lib/schemas/io/config_io.py +458 -0
- agentcore/lib/schemas/io/global_config.py +239 -0
- agentcore/lib/schemas/io/path_resolver.py +132 -0
- agentcore/lib/secrets/__init__.py +18 -0
- agentcore/lib/secrets/cipher.py +70 -0
- agentcore/lib/secrets/key_provider.py +163 -0
- agentcore/lib/secrets/sensitive_keys.py +55 -0
- agentcore/lib/time_constants.py +4 -0
- agentcore/lib/utils/__init__.py +47 -0
- agentcore/lib/utils/aws_account.py +15 -0
- agentcore/lib/utils/credentials.py +68 -0
- agentcore/lib/utils/dotenv.py +32 -0
- agentcore/lib/utils/env.py +105 -0
- agentcore/lib/utils/json_format.py +29 -0
- agentcore/lib/utils/json_rpc.py +22 -0
- agentcore/lib/utils/platform.py +33 -0
- agentcore/lib/utils/polling.py +86 -0
- agentcore/lib/utils/subprocess.py +135 -0
- agentcore/lib/utils/time_parser.py +48 -0
- agentcore/lib/utils/validation.py +106 -0
- agentcore/logging/__init__.py +10 -0
- agentcore/logging/_common.py +77 -0
- agentcore/logging/cdk_io_host.py +36 -0
- agentcore/logging/create_logger.py +107 -0
- agentcore/logging/dev_logger.py +63 -0
- agentcore/logging/exec_logger.py +159 -0
- agentcore/logging/invoke_logger.py +154 -0
- agentcore/logging/remove_logger.py +95 -0
- agentcore/operations/__init__.py +0 -0
- agentcore/operations/agent/__init__.py +0 -0
- agentcore/operations/agent/config_bundle_defaults.py +31 -0
- agentcore/operations/agent/generate/__init__.py +28 -0
- agentcore/operations/agent/generate/schema_mapper.py +319 -0
- agentcore/operations/agent/generate/types.py +172 -0
- agentcore/operations/agent/generate/write_agent_to_project.py +67 -0
- agentcore/operations/agent/import_/__init__.py +31 -0
- agentcore/operations/agent/import_/base_translator.py +449 -0
- agentcore/operations/agent/import_/constants.py +23 -0
- agentcore/operations/agent/import_/execute.py +127 -0
- agentcore/operations/agent/import_/langgraph_translator.py +294 -0
- agentcore/operations/agent/import_/pyproject_generator.py +73 -0
- agentcore/operations/agent/import_/strands_translator.py +289 -0
- agentcore/operations/config_bundle/__init__.py +1 -0
- agentcore/operations/config_bundle/bundle_name_variants.py +9 -0
- agentcore/operations/config_bundle/diff_versions.py +52 -0
- agentcore/operations/config_bundle/resolve_bundle.py +65 -0
- agentcore/operations/connectors/__init__.py +3 -0
- agentcore/operations/connectors/translators.py +63 -0
- agentcore/operations/dataset/__init__.py +21 -0
- agentcore/operations/dataset/delete.py +7 -0
- agentcore/operations/dataset/publish.py +16 -0
- agentcore/operations/dataset/pull.py +21 -0
- agentcore/operations/dataset/push.py +201 -0
- agentcore/operations/dataset/resolve_dataset.py +65 -0
- agentcore/operations/dataset/status.py +18 -0
- agentcore/operations/dataset/wait.py +25 -0
- agentcore/operations/deploy/__init__.py +152 -0
- agentcore/operations/deploy/backfill_vpc_id.py +90 -0
- agentcore/operations/deploy/change_detection.py +84 -0
- agentcore/operations/deploy/constants.py +58 -0
- agentcore/operations/deploy/dependency_sync.py +105 -0
- agentcore/operations/deploy/ensure_target.py +30 -0
- agentcore/operations/deploy/gateway_status.py +44 -0
- agentcore/operations/deploy/managed_memory_notice.py +36 -0
- agentcore/operations/deploy/payment_connector_authorization.py +106 -0
- agentcore/operations/deploy/post_deploy_datasets.py +96 -0
- agentcore/operations/deploy/post_deploy_knowledge_bases.py +104 -0
- agentcore/operations/deploy/post_deploy_observability.py +28 -0
- agentcore/operations/deploy/post_deploy_online_evals.py +60 -0
- agentcore/operations/deploy/pre_deploy_identity.py +505 -0
- agentcore/operations/deploy/preflight.py +385 -0
- agentcore/operations/deploy/region_override.py +45 -0
- agentcore/operations/deploy/teardown.py +153 -0
- agentcore/operations/dev/__init__.py +61 -0
- agentcore/operations/dev/_http.py +79 -0
- agentcore/operations/dev/_server.py +165 -0
- agentcore/operations/dev/codezip_dev_server.py +151 -0
- agentcore/operations/dev/config.py +128 -0
- agentcore/operations/dev/constants.py +9 -0
- agentcore/operations/dev/container_dev_server.py +237 -0
- agentcore/operations/dev/container_runtime.py +37 -0
- agentcore/operations/dev/dev_server.py +244 -0
- agentcore/operations/dev/gateway_env.py +25 -0
- agentcore/operations/dev/invoke.py +214 -0
- agentcore/operations/dev/invoke_a2a.py +204 -0
- agentcore/operations/dev/invoke_agui.py +88 -0
- agentcore/operations/dev/invoke_mcp.py +145 -0
- agentcore/operations/dev/invoke_types.py +30 -0
- agentcore/operations/dev/load_dev_env.py +26 -0
- agentcore/operations/dev/memory_env.py +19 -0
- agentcore/operations/dev/otel/__init__.py +5 -0
- agentcore/operations/dev/otel/collector.py +234 -0
- agentcore/operations/dev/otel/transforms.py +331 -0
- agentcore/operations/dev/payment_env.py +50 -0
- agentcore/operations/dev/server.py +28 -0
- agentcore/operations/dev/sse_transform.py +30 -0
- agentcore/operations/dev/utils.py +152 -0
- agentcore/operations/dev/web_ui/__init__.py +31 -0
- agentcore/operations/dev/web_ui/constants.py +25 -0
- agentcore/operations/dev/web_ui/handlers/__init__.py +36 -0
- agentcore/operations/dev/web_ui/handlers/_common.py +36 -0
- agentcore/operations/dev/web_ui/handlers/_deployed.py +37 -0
- agentcore/operations/dev/web_ui/handlers/a2a_proxy.py +37 -0
- agentcore/operations/dev/web_ui/handlers/cloudwatch_traces.py +71 -0
- agentcore/operations/dev/web_ui/handlers/harness_invocation.py +89 -0
- agentcore/operations/dev/web_ui/handlers/harness_utils.py +95 -0
- agentcore/operations/dev/web_ui/handlers/invocations.py +327 -0
- agentcore/operations/dev/web_ui/handlers/mcp_proxy.py +119 -0
- agentcore/operations/dev/web_ui/handlers/memory.py +84 -0
- agentcore/operations/dev/web_ui/handlers/resources.py +351 -0
- agentcore/operations/dev/web_ui/handlers/start.py +182 -0
- agentcore/operations/dev/web_ui/handlers/status.py +25 -0
- agentcore/operations/dev/web_ui/handlers/traces.py +50 -0
- agentcore/operations/dev/web_ui/run_web_ui.py +60 -0
- agentcore/operations/dev/web_ui/web_server.py +297 -0
- agentcore/operations/eval/__init__.py +8 -0
- agentcore/operations/eval/list_eval_runs.py +18 -0
- agentcore/operations/eval/logs_eval.py +119 -0
- agentcore/operations/eval/pause_resume.py +90 -0
- agentcore/operations/eval/run_eval.py +354 -0
- agentcore/operations/eval/shared/__init__.py +0 -0
- agentcore/operations/eval/shared/dataset_loader.py +68 -0
- agentcore/operations/eval/shared/dataset_session_provider.py +122 -0
- agentcore/operations/eval/shared/evaluator_runner.py +89 -0
- agentcore/operations/eval/shared/scenario_executor.py +71 -0
- agentcore/operations/eval/shared/span_collector.py +255 -0
- agentcore/operations/eval/storage.py +67 -0
- agentcore/operations/feedback/__init__.py +21 -0
- agentcore/operations/feedback/aperture_client.py +98 -0
- agentcore/operations/feedback/build_payload.py +97 -0
- agentcore/operations/feedback/constants.py +26 -0
- agentcore/operations/feedback/submit_feedback.py +150 -0
- agentcore/operations/fetch_access/__init__.py +36 -0
- agentcore/operations/fetch_access/_target.py +17 -0
- agentcore/operations/fetch_access/fetch_gateway_token.py +75 -0
- agentcore/operations/fetch_access/fetch_harness_token.py +72 -0
- agentcore/operations/fetch_access/fetch_runtime_token.py +76 -0
- agentcore/operations/fetch_access/list_agents.py +18 -0
- agentcore/operations/fetch_access/list_gateways.py +26 -0
- agentcore/operations/fetch_access/list_harnesses.py +23 -0
- agentcore/operations/fetch_access/oauth_token.py +162 -0
- agentcore/operations/fetch_access/types.py +34 -0
- agentcore/operations/harness/__init__.py +1 -0
- agentcore/operations/harness/orphan.py +84 -0
- agentcore/operations/harness/skill_utils.py +56 -0
- agentcore/operations/identity/__init__.py +33 -0
- agentcore/operations/identity/api_key_credential_provider.py +68 -0
- agentcore/operations/identity/oauth2_credential_provider.py +95 -0
- agentcore/operations/ingest/__init__.py +184 -0
- agentcore/operations/init/__init__.py +3 -0
- agentcore/operations/init/files.py +59 -0
- agentcore/operations/insights/__init__.py +21 -0
- agentcore/operations/insights/insights_storage.py +67 -0
- agentcore/operations/insights/run_insights.py +148 -0
- agentcore/operations/invoke/__init__.py +5 -0
- agentcore/operations/invoke/resolve_agent_context.py +85 -0
- agentcore/operations/jobs/__init__.py +38 -0
- agentcore/operations/jobs/ab_test/__init__.py +0 -0
- agentcore/operations/jobs/ab_test/build_options.py +126 -0
- agentcore/operations/jobs/ab_test/format.py +121 -0
- agentcore/operations/jobs/ab_test/handler.py +412 -0
- agentcore/operations/jobs/ab_test/promote.py +142 -0
- agentcore/operations/jobs/ab_test/resolve.py +221 -0
- agentcore/operations/jobs/batch_evaluation/__init__.py +0 -0
- agentcore/operations/jobs/batch_evaluation/build_source.py +68 -0
- agentcore/operations/jobs/batch_evaluation/dataset_phase1.py +95 -0
- agentcore/operations/jobs/batch_evaluation/format.py +58 -0
- agentcore/operations/jobs/batch_evaluation/handler.py +203 -0
- agentcore/operations/jobs/insights/__init__.py +0 -0
- agentcore/operations/jobs/insights/format.py +65 -0
- agentcore/operations/jobs/insights/handler.py +178 -0
- agentcore/operations/jobs/recommendation/__init__.py +0 -0
- agentcore/operations/jobs/recommendation/apply_to_bundle.py +76 -0
- agentcore/operations/jobs/recommendation/build_config.py +271 -0
- agentcore/operations/jobs/recommendation/fetch_session_spans.py +93 -0
- agentcore/operations/jobs/recommendation/format.py +77 -0
- agentcore/operations/jobs/recommendation/handler.py +331 -0
- agentcore/operations/jobs/shared/__init__.py +0 -0
- agentcore/operations/jobs/shared/constants.py +85 -0
- agentcore/operations/jobs/shared/engine.py +187 -0
- agentcore/operations/jobs/shared/format.py +104 -0
- agentcore/operations/jobs/shared/region.py +34 -0
- agentcore/operations/jobs/shared/resolve_agent_state.py +30 -0
- agentcore/operations/jobs/shared/storage.py +117 -0
- agentcore/operations/jobs/shared/wait.py +30 -0
- agentcore/operations/knowledge_base/__init__.py +33 -0
- agentcore/operations/knowledge_base/connector_config.py +105 -0
- agentcore/operations/knowledge_base/hydrate_data_sources.py +59 -0
- agentcore/operations/mcp/__init__.py +4 -0
- agentcore/operations/memory/__init__.py +13 -0
- agentcore/operations/memory/_records.py +72 -0
- agentcore/operations/memory/list_memory_records.py +45 -0
- agentcore/operations/memory/retrieve_memory_records.py +52 -0
- agentcore/operations/node/__init__.py +15 -0
- agentcore/operations/node/setup.py +36 -0
- agentcore/operations/python/__init__.py +17 -0
- agentcore/operations/python/setup.py +47 -0
- agentcore/operations/resolve_agent.py +159 -0
- agentcore/operations/session/__init__.py +86 -0
- agentcore/operations/traces/__init__.py +29 -0
- agentcore/operations/traces/get_trace.py +202 -0
- agentcore/operations/traces/insights_query.py +74 -0
- agentcore/operations/traces/list_traces.py +46 -0
- agentcore/operations/traces/trace_url.py +25 -0
- agentcore/operations/traces/types.py +55 -0
- agentcore/primitives/__init__.py +0 -0
- agentcore/primitives/_gateway_target_wizard.py +293 -0
- agentcore/primitives/_gateway_validation.py +442 -0
- agentcore/primitives/_harness_cli.py +557 -0
- agentcore/primitives/_harness_validation.py +163 -0
- agentcore/primitives/_harness_wizard.py +726 -0
- agentcore/primitives/_knowledge_base_wizard.py +259 -0
- agentcore/primitives/_payment_wizard.py +331 -0
- agentcore/primitives/_policy_form.py +160 -0
- agentcore/primitives/agent.py +817 -0
- agentcore/primitives/auth_utils.py +77 -0
- agentcore/primitives/base.py +178 -0
- agentcore/primitives/capacity_provider.py +501 -0
- agentcore/primitives/config_bundle.py +329 -0
- agentcore/primitives/credential.py +387 -0
- agentcore/primitives/credential_utils.py +45 -0
- agentcore/primitives/dataset.py +211 -0
- agentcore/primitives/deployed_gateways.py +34 -0
- agentcore/primitives/evaluator.py +909 -0
- agentcore/primitives/gateway.py +496 -0
- agentcore/primitives/gateway_target.py +988 -0
- agentcore/primitives/harness.py +706 -0
- agentcore/primitives/knowledge_base.py +477 -0
- agentcore/primitives/memory.py +387 -0
- agentcore/primitives/online_eval_config.py +365 -0
- agentcore/primitives/online_insights.py +275 -0
- agentcore/primitives/payment_connector.py +427 -0
- agentcore/primitives/payment_eligible.py +20 -0
- agentcore/primitives/payment_manager.py +605 -0
- agentcore/primitives/payment_validation.py +68 -0
- agentcore/primitives/policy.py +622 -0
- agentcore/primitives/policy_engine.py +358 -0
- agentcore/primitives/registry.py +56 -0
- agentcore/primitives/runtime_endpoint.py +361 -0
- agentcore/primitives/secret_flag_warning.py +17 -0
- agentcore/schema/__init__.py +14 -0
- agentcore/schema/_zod.py +395 -0
- agentcore/schema/constants.py +306 -0
- agentcore/schema/schemas/__init__.py +40 -0
- agentcore/schema/schemas/agent_env.py +545 -0
- agentcore/schema/schemas/agentcore_project.py +530 -0
- agentcore/schema/schemas/auth.py +286 -0
- agentcore/schema/schemas/aws_targets.py +72 -0
- agentcore/schema/schemas/connections.py +187 -0
- agentcore/schema/schemas/deployed_state.py +322 -0
- agentcore/schema/schemas/mcp.py +650 -0
- agentcore/schema/schemas/mcp_defs.py +54 -0
- agentcore/schema/schemas/primitives/__init__.py +52 -0
- agentcore/schema/schemas/primitives/ab_test.py +162 -0
- agentcore/schema/schemas/primitives/capacity_provider.py +214 -0
- agentcore/schema/schemas/primitives/config_bundle.py +48 -0
- agentcore/schema/schemas/primitives/dataset.py +55 -0
- agentcore/schema/schemas/primitives/evaluator.py +171 -0
- agentcore/schema/schemas/primitives/harness.py +710 -0
- agentcore/schema/schemas/primitives/knowledge_base.py +90 -0
- agentcore/schema/schemas/primitives/memory.py +113 -0
- agentcore/schema/schemas/primitives/online_eval_config.py +77 -0
- agentcore/schema/schemas/primitives/payment.py +114 -0
- agentcore/schema/schemas/primitives/policy.py +83 -0
- agentcore/schema/schemas/primitives/tags.py +50 -0
- agentcore/schema/schemas/zod_util.py +5 -0
- agentcore/schema/types/__init__.py +3 -0
- agentcore/schema/types/path.py +16 -0
- agentcore/templates/__init__.py +115 -0
- agentcore/templates/_handlebars.py +782 -0
- agentcore/templates/_js.py +164 -0
- agentcore/templates/base_renderer.py +107 -0
- agentcore/templates/cdk_renderer.py +129 -0
- agentcore/templates/evaluator_renderer.py +39 -0
- agentcore/templates/gateway_target_renderer.py +69 -0
- agentcore/templates/llm_context/README.md +16 -0
- agentcore/templates/llm_context/agentcore.ts +685 -0
- agentcore/templates/llm_context/aws-targets.ts +51 -0
- agentcore/templates/profiles.py +151 -0
- agentcore/templates/render.py +92 -0
- agentcore/templates/renderers.py +83 -0
- agentcore/templates/schema_assets.py +23 -0
- agentcore/templates/template_root.py +28 -0
- agentcore/templates/types.py +192 -0
- agentcore_cli-0.31.1.dist-info/METADATA +84 -0
- agentcore_cli-0.31.1.dist-info/RECORD +655 -0
- agentcore_cli-0.31.1.dist-info/WHEEL +4 -0
- agentcore_cli-0.31.1.dist-info/entry_points.txt +2 -0
- agentcore_cli-0.31.1.dist-info/licenses/LICENSE +175 -0
- agentcore_cli-0.31.1.dist-info/licenses/NOTICE +88 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
"""Port of commands/import/types.ts.
|
|
2
|
+
|
|
3
|
+
Project specs, targets and AWS details are handled as camelCase JSON dicts, exactly as upstream
|
|
4
|
+
treats them as plain objects.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from collections.abc import Callable
|
|
10
|
+
from dataclasses import dataclass, field
|
|
11
|
+
from typing import TYPE_CHECKING, Any, Generic, Literal, TypeVar
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from agentcore.cli.commands.import_.import_utils import ImportedResource, ProjectContext
|
|
15
|
+
from agentcore.logging.exec_logger import ExecLogger
|
|
16
|
+
|
|
17
|
+
ImportableResourceType = Literal["runtime", "memory", "evaluator", "online-eval", "gateway"]
|
|
18
|
+
IMPORTABLE_RESOURCES: tuple[ImportableResourceType, ...] = ("runtime", "memory", "evaluator", "online-eval", "gateway")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class ParsedStarterToolkitAgent:
|
|
23
|
+
name: str
|
|
24
|
+
entrypoint: str
|
|
25
|
+
build: Literal["CodeZip", "Container"]
|
|
26
|
+
language: str
|
|
27
|
+
network_mode: Literal["PUBLIC", "VPC"]
|
|
28
|
+
protocol: str
|
|
29
|
+
enable_otel: bool
|
|
30
|
+
runtime_version: str | None = None
|
|
31
|
+
source_path: str | None = None
|
|
32
|
+
network_config: dict[str, Any] | None = None
|
|
33
|
+
physical_agent_id: str | None = None
|
|
34
|
+
physical_agent_arn: str | None = None
|
|
35
|
+
authorizer_type: str | None = None
|
|
36
|
+
authorizer_configuration: dict[str, Any] | None = None
|
|
37
|
+
execution_role_arn: str | None = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass
|
|
41
|
+
class ParsedStarterToolkitMemory:
|
|
42
|
+
name: str
|
|
43
|
+
mode: str
|
|
44
|
+
event_expiry_days: Any
|
|
45
|
+
physical_memory_id: str | None = None
|
|
46
|
+
physical_memory_arn: str | None = None
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass
|
|
50
|
+
class ParsedStarterToolkitCredential:
|
|
51
|
+
name: str
|
|
52
|
+
provider_type: Literal["oauth", "api_key"]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class ParsedStarterToolkitConfig:
|
|
57
|
+
agents: list[ParsedStarterToolkitAgent] = field(default_factory=list)
|
|
58
|
+
memories: list[ParsedStarterToolkitMemory] = field(default_factory=list)
|
|
59
|
+
credentials: list[ParsedStarterToolkitCredential] = field(default_factory=list)
|
|
60
|
+
aws_target: dict[str, str] = field(default_factory=dict)
|
|
61
|
+
default_agent: str | None = None
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class ResourceToImport:
|
|
66
|
+
resource_type: str
|
|
67
|
+
logical_resource_id: str
|
|
68
|
+
resource_identifier: dict[str, str]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class ImportResult:
|
|
73
|
+
"""Result of the starter-toolkit import (``agentcore import --source``)."""
|
|
74
|
+
|
|
75
|
+
success: bool
|
|
76
|
+
error: BaseException | None = None
|
|
77
|
+
project_spec: dict[str, Any] | None = None
|
|
78
|
+
imported_agents: list[str] | None = None
|
|
79
|
+
imported_memories: list[str] | None = None
|
|
80
|
+
stack_name: str | None = None
|
|
81
|
+
log_path: str | None = None
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass
|
|
85
|
+
class ImportResourceResult:
|
|
86
|
+
"""Result for single-resource import (runtime, memory, evaluator, ...)."""
|
|
87
|
+
|
|
88
|
+
success: bool
|
|
89
|
+
resource_type: ImportableResourceType
|
|
90
|
+
resource_name: str
|
|
91
|
+
resource_id: str | None = None
|
|
92
|
+
error: BaseException | None = None
|
|
93
|
+
log_path: str | None = None
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@dataclass
|
|
97
|
+
class ImportResourceOptions:
|
|
98
|
+
arn: str | None = None
|
|
99
|
+
target: str | None = None
|
|
100
|
+
name: str | None = None
|
|
101
|
+
yes: bool | None = None
|
|
102
|
+
on_progress: Callable[[str], None] | None = None
|
|
103
|
+
# Runtime-only (RuntimeImportOptions)
|
|
104
|
+
code: str | None = None
|
|
105
|
+
entrypoint: str | None = None
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
RuntimeImportOptions = ImportResourceOptions
|
|
109
|
+
|
|
110
|
+
TDetail = TypeVar("TDetail")
|
|
111
|
+
TSummary = TypeVar("TSummary")
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@dataclass
|
|
115
|
+
class BeforeWriteContext(Generic[TDetail]):
|
|
116
|
+
detail: TDetail
|
|
117
|
+
local_name: str
|
|
118
|
+
project_spec: dict[str, Any]
|
|
119
|
+
ctx: ProjectContext
|
|
120
|
+
target: Any
|
|
121
|
+
options: ImportResourceOptions
|
|
122
|
+
on_progress: Callable[[str], None]
|
|
123
|
+
logger: ExecLogger
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
@dataclass
|
|
127
|
+
class ResourceImportDescriptor(Generic[TDetail, TSummary]):
|
|
128
|
+
"""Resource-type-specific behaviour for the generic import orchestrator."""
|
|
129
|
+
|
|
130
|
+
resource_type: ImportableResourceType
|
|
131
|
+
display_name: str
|
|
132
|
+
log_command: str
|
|
133
|
+
list_resources: Callable[[str], list[TSummary]]
|
|
134
|
+
get_detail: Callable[[str, str], TDetail]
|
|
135
|
+
parse_resource_id: Callable[[str, Any], str]
|
|
136
|
+
extract_summary_id: Callable[[TSummary], str]
|
|
137
|
+
format_list_item: Callable[[TSummary, int], str]
|
|
138
|
+
format_auto_select_message: Callable[[TSummary], str]
|
|
139
|
+
extract_detail_name: Callable[[TDetail], str]
|
|
140
|
+
extract_detail_arn: Callable[[TDetail], str]
|
|
141
|
+
ready_status: str
|
|
142
|
+
extract_detail_status: Callable[[TDetail], str]
|
|
143
|
+
get_existing_names: Callable[[dict[str, Any]], list[str]]
|
|
144
|
+
add_to_project_spec: Callable[[TDetail, str, dict[str, Any]], ImportResourceResult]
|
|
145
|
+
cfn_resource_type: str
|
|
146
|
+
cfn_name_property: str
|
|
147
|
+
cfn_identifier_key: str
|
|
148
|
+
build_deployed_state_entry: Callable[[str, str, TDetail], ImportedResource]
|
|
149
|
+
before_config_write: Callable[[BeforeWriteContext[TDetail]], ImportResourceResult | None] | None = None
|
|
150
|
+
rollback_extra: Callable[[], None] | None = None
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"""Starter toolkit ``.bedrock_agentcore.yaml`` parser (port of commands/import/yaml-parser.ts).
|
|
2
|
+
|
|
3
|
+
Deliberately keeps upstream's minimal line-based YAML parser (with its quirks, e.g. a bare
|
|
4
|
+
``key:`` becomes ``{}``) instead of a full YAML library, so imports behave identically.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
import os
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from agentcore.cli.commands.import_._js import js_number, js_string, truthy
|
|
14
|
+
from agentcore.cli.commands.import_.constants import RUNTIME_TYPE_MAP
|
|
15
|
+
from agentcore.cli.commands.import_.types import (
|
|
16
|
+
ParsedStarterToolkitAgent,
|
|
17
|
+
ParsedStarterToolkitConfig,
|
|
18
|
+
ParsedStarterToolkitCredential,
|
|
19
|
+
ParsedStarterToolkitMemory,
|
|
20
|
+
)
|
|
21
|
+
from agentcore.schema.constants import PROTOCOL_MODES
|
|
22
|
+
|
|
23
|
+
_Frame = dict[str, Any]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _find_parent(stack: list[_Frame], indent: int) -> _Frame:
|
|
27
|
+
while len(stack) > 1 and stack[-1]["indent"] >= indent:
|
|
28
|
+
stack.pop()
|
|
29
|
+
return stack[-1]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _parse_yaml_value(value: str) -> Any:
|
|
33
|
+
if value in ("null", "~", ""):
|
|
34
|
+
return None
|
|
35
|
+
if value == "true":
|
|
36
|
+
return True
|
|
37
|
+
if value == "false":
|
|
38
|
+
return False
|
|
39
|
+
if len(value) >= 2 and (
|
|
40
|
+
(value.startswith('"') and value.endswith('"')) or (value.startswith("'") and value.endswith("'"))
|
|
41
|
+
):
|
|
42
|
+
return value[1:-1]
|
|
43
|
+
if value in ('"', "'"):
|
|
44
|
+
# JS: startsWith and endsWith on a 1-char quote are both true; slice(1, -1) is ''.
|
|
45
|
+
return ""
|
|
46
|
+
num = js_number(value)
|
|
47
|
+
if num is not None and value.strip() != "":
|
|
48
|
+
return num
|
|
49
|
+
return value
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def _first_non_space(line: str) -> int:
|
|
53
|
+
for i, ch in enumerate(line):
|
|
54
|
+
if not ch.isspace():
|
|
55
|
+
return i
|
|
56
|
+
return -1
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def parse_simple_yaml(content: str) -> dict[str, Any]:
|
|
60
|
+
try:
|
|
61
|
+
parsed = json.loads(content)
|
|
62
|
+
return parsed if isinstance(parsed, dict) else {}
|
|
63
|
+
except ValueError:
|
|
64
|
+
pass
|
|
65
|
+
|
|
66
|
+
result: dict[str, Any] = {}
|
|
67
|
+
stack: list[_Frame] = [{"indent": -1, "obj": result}]
|
|
68
|
+
|
|
69
|
+
for raw_line in content.split("\n"):
|
|
70
|
+
trimmed = raw_line.strip()
|
|
71
|
+
if not trimmed or trimmed.startswith("#"):
|
|
72
|
+
continue
|
|
73
|
+
indent = _first_non_space(raw_line)
|
|
74
|
+
|
|
75
|
+
if trimmed.startswith("- "):
|
|
76
|
+
parent_entry = _find_parent(stack, indent)
|
|
77
|
+
parent_obj: dict[str, Any] = parent_entry["obj"]
|
|
78
|
+
keys = list(parent_obj.keys())
|
|
79
|
+
last_key = keys[-1] if keys else None
|
|
80
|
+
|
|
81
|
+
# "key:" followed by "- item": the empty object created for "key:" becomes an array.
|
|
82
|
+
if not last_key and len(parent_obj) == 0 and len(stack) > 1:
|
|
83
|
+
stack.pop()
|
|
84
|
+
parent_entry = stack[-1]
|
|
85
|
+
parent_obj = parent_entry["obj"]
|
|
86
|
+
keys = list(parent_obj.keys())
|
|
87
|
+
last_key = keys[-1] if keys else None
|
|
88
|
+
|
|
89
|
+
if last_key:
|
|
90
|
+
if not isinstance(parent_obj[last_key], list):
|
|
91
|
+
parent_obj[last_key] = []
|
|
92
|
+
item_content = trimmed[2:].strip()
|
|
93
|
+
colon = item_content.find(":")
|
|
94
|
+
if colon > 0 and not item_content.startswith("http"):
|
|
95
|
+
item_obj: dict[str, Any] = {}
|
|
96
|
+
item_key = item_content[:colon].strip()
|
|
97
|
+
item_val = item_content[colon + 1 :].strip()
|
|
98
|
+
item_obj[item_key] = {} if item_val == "" else _parse_yaml_value(item_val)
|
|
99
|
+
parent_obj[last_key].append(item_obj)
|
|
100
|
+
stack.append({"indent": indent, "obj": item_obj})
|
|
101
|
+
else:
|
|
102
|
+
parent_obj[last_key].append(_parse_yaml_value(item_content))
|
|
103
|
+
continue
|
|
104
|
+
|
|
105
|
+
colon = trimmed.find(":")
|
|
106
|
+
if colon == -1:
|
|
107
|
+
continue
|
|
108
|
+
key = trimmed[:colon].strip()
|
|
109
|
+
value_str = trimmed[colon + 1 :].strip()
|
|
110
|
+
parent = _find_parent(stack, indent)
|
|
111
|
+
if value_str in ("", "|"):
|
|
112
|
+
child: dict[str, Any] = {}
|
|
113
|
+
parent["obj"][key] = child
|
|
114
|
+
stack.append({"indent": indent, "obj": child})
|
|
115
|
+
else:
|
|
116
|
+
parent["obj"][key] = _parse_yaml_value(value_str)
|
|
117
|
+
|
|
118
|
+
return result
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def _as_dict(value: Any) -> dict[str, Any] | None:
|
|
122
|
+
return value if isinstance(value, dict) else None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def _extract_authorizer_config(raw: Any) -> dict[str, Any]:
|
|
126
|
+
"""Starter toolkit uses ``customJWTAuthorizer`` (capital JWT); the CLI schema ``customJwtAuthorizer``."""
|
|
127
|
+
if raw is None or raw == "null" or not isinstance(raw, (dict, list)):
|
|
128
|
+
return {}
|
|
129
|
+
if not isinstance(raw, dict):
|
|
130
|
+
return {}
|
|
131
|
+
jwt_raw = raw.get("customJWTAuthorizer")
|
|
132
|
+
if not jwt_raw or not isinstance(jwt_raw, (dict, list)) or not isinstance(jwt_raw, dict):
|
|
133
|
+
return {}
|
|
134
|
+
discovery_url = jwt_raw.get("discoveryUrl")
|
|
135
|
+
if not truthy(discovery_url):
|
|
136
|
+
return {}
|
|
137
|
+
jwt: dict[str, Any] = {"discoveryUrl": discovery_url}
|
|
138
|
+
for key in ("allowedAudience", "allowedClients", "allowedScopes", "customClaims"):
|
|
139
|
+
if isinstance(jwt_raw.get(key), list):
|
|
140
|
+
jwt[key] = jwt_raw[key]
|
|
141
|
+
return {"authorizer_type": "CUSTOM_JWT", "authorizer_configuration": {"customJwtAuthorizer": jwt}}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
def _nn(value: Any, default: Any) -> Any:
|
|
145
|
+
"""JS ``value ?? default``."""
|
|
146
|
+
return default if value is None else value
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def parse_starter_toolkit_yaml(file_path: str) -> ParsedStarterToolkitConfig:
|
|
150
|
+
with open(file_path, encoding="utf-8") as fh:
|
|
151
|
+
content = fh.read()
|
|
152
|
+
raw = parse_simple_yaml(content)
|
|
153
|
+
yaml_dir = os.path.dirname(os.path.abspath(file_path))
|
|
154
|
+
|
|
155
|
+
agents: list[ParsedStarterToolkitAgent] = []
|
|
156
|
+
memories: list[ParsedStarterToolkitMemory] = []
|
|
157
|
+
credentials: list[ParsedStarterToolkitCredential] = []
|
|
158
|
+
aws_target: dict[str, str] = {}
|
|
159
|
+
|
|
160
|
+
default_agent = raw.get("default_agent")
|
|
161
|
+
agents_map = raw.get("agents")
|
|
162
|
+
|
|
163
|
+
if truthy(agents_map) and isinstance(agents_map, dict):
|
|
164
|
+
for agent_key, agent_config in agents_map.items():
|
|
165
|
+
agent_config = agent_config if isinstance(agent_config, dict) else {}
|
|
166
|
+
aws_config = _as_dict(agent_config.get("aws"))
|
|
167
|
+
bedrock_config = _as_dict(agent_config.get("bedrock_agentcore"))
|
|
168
|
+
memory_config = _as_dict(agent_config.get("memory"))
|
|
169
|
+
network_config = _as_dict(aws_config.get("network_configuration")) if aws_config else None
|
|
170
|
+
protocol_config = _as_dict(aws_config.get("protocol_configuration")) if aws_config else None
|
|
171
|
+
obs_config = _as_dict(aws_config.get("observability")) if aws_config else None
|
|
172
|
+
|
|
173
|
+
if aws_config is not None and (not aws_target.get("account") or not aws_target.get("region")):
|
|
174
|
+
aws_target = {
|
|
175
|
+
"account": js_string(_nn(aws_config.get("account"), "")),
|
|
176
|
+
"region": js_string(_nn(aws_config.get("region"), "")),
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
deployment_type = js_string(_nn(agent_config.get("deployment_type"), "container"))
|
|
180
|
+
build = "CodeZip" if deployment_type == "direct_code_deploy" else "Container"
|
|
181
|
+
|
|
182
|
+
raw_runtime_type = js_string(_nn(agent_config.get("runtime_type"), "PYTHON_3_12"))
|
|
183
|
+
runtime_version = RUNTIME_TYPE_MAP.get(raw_runtime_type, "PYTHON_3_12")
|
|
184
|
+
|
|
185
|
+
network_mode = js_string(_nn(network_config.get("network_mode") if network_config else None, "PUBLIC"))
|
|
186
|
+
mode_config = _as_dict(network_config.get("network_mode_config")) if network_config else None
|
|
187
|
+
|
|
188
|
+
protocol_raw = js_string(_nn(protocol_config.get("server_protocol") if protocol_config else None, "HTTP"))
|
|
189
|
+
protocol = protocol_raw if protocol_raw in PROTOCOL_MODES else "HTTP"
|
|
190
|
+
|
|
191
|
+
parsed_network: dict[str, Any] | None = None
|
|
192
|
+
if network_mode == "VPC" and mode_config is not None:
|
|
193
|
+
parsed_network = {
|
|
194
|
+
"subnets": mode_config["subnets"] if isinstance(mode_config.get("subnets"), list) else [],
|
|
195
|
+
"securityGroups": mode_config["security_groups"]
|
|
196
|
+
if isinstance(mode_config.get("security_groups"), list)
|
|
197
|
+
else [],
|
|
198
|
+
}
|
|
199
|
+
vpc_id = mode_config.get("vpc_id")
|
|
200
|
+
if isinstance(vpc_id, str) and vpc_id:
|
|
201
|
+
parsed_network["vpcId"] = vpc_id
|
|
202
|
+
|
|
203
|
+
name = js_string(_nn(agent_config.get("name"), agent_key))
|
|
204
|
+
source_path = agent_config.get("source_path")
|
|
205
|
+
auth = _extract_authorizer_config(agent_config.get("authorizer_configuration"))
|
|
206
|
+
execution_role = aws_config.get("execution_role") if aws_config else None
|
|
207
|
+
enabled = obs_config.get("enabled") if obs_config else None
|
|
208
|
+
|
|
209
|
+
agents.append(
|
|
210
|
+
ParsedStarterToolkitAgent(
|
|
211
|
+
name=name,
|
|
212
|
+
entrypoint=js_string(_nn(agent_config.get("entrypoint"), "main.py")),
|
|
213
|
+
build=build, # type: ignore[arg-type]
|
|
214
|
+
runtime_version=runtime_version,
|
|
215
|
+
language=_nn(agent_config.get("language"), "python"),
|
|
216
|
+
source_path=os.path.abspath(os.path.join(yaml_dir, js_string(source_path)))
|
|
217
|
+
if truthy(source_path)
|
|
218
|
+
else None,
|
|
219
|
+
network_mode=network_mode, # type: ignore[arg-type]
|
|
220
|
+
network_config=parsed_network,
|
|
221
|
+
protocol=protocol,
|
|
222
|
+
enable_otel=_nn(enabled, True),
|
|
223
|
+
physical_agent_id=bedrock_config.get("agent_id") if bedrock_config else None,
|
|
224
|
+
physical_agent_arn=bedrock_config.get("agent_arn") if bedrock_config else None,
|
|
225
|
+
authorizer_type=auth.get("authorizer_type"),
|
|
226
|
+
authorizer_configuration=auth.get("authorizer_configuration"),
|
|
227
|
+
execution_role_arn=execution_role if truthy(execution_role) else None,
|
|
228
|
+
)
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
# Memory per agent; a bare "mode:" parses as {} and is ignored.
|
|
232
|
+
mode = memory_config.get("mode") if memory_config else None
|
|
233
|
+
if memory_config is not None and isinstance(mode, str) and mode != "NO_MEMORY" and mode:
|
|
234
|
+
mem_name = _nn(memory_config.get("memory_name"), f"{name}_memory")
|
|
235
|
+
if not any(m.name == mem_name for m in memories):
|
|
236
|
+
memories.append(
|
|
237
|
+
ParsedStarterToolkitMemory(
|
|
238
|
+
name=mem_name,
|
|
239
|
+
mode=mode,
|
|
240
|
+
event_expiry_days=_nn(memory_config.get("event_expiry_days"), 30),
|
|
241
|
+
physical_memory_id=memory_config.get("memory_id"),
|
|
242
|
+
physical_memory_arn=memory_config.get("memory_arn"),
|
|
243
|
+
)
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
identity_config = _as_dict(agent_config.get("identity"))
|
|
247
|
+
if identity_config is not None:
|
|
248
|
+
providers = identity_config.get("credential_providers")
|
|
249
|
+
if isinstance(providers, list):
|
|
250
|
+
for provider in providers:
|
|
251
|
+
provider_name = provider.get("name") if isinstance(provider, dict) else None
|
|
252
|
+
if truthy(provider_name) and not any(c.name == provider_name for c in credentials):
|
|
253
|
+
credentials.append(ParsedStarterToolkitCredential(provider_name, "oauth"))
|
|
254
|
+
|
|
255
|
+
api_key_cred_name = agent_config.get("api_key_credential_provider_name")
|
|
256
|
+
if truthy(api_key_cred_name) and not any(c.name == api_key_cred_name for c in credentials):
|
|
257
|
+
credentials.append(ParsedStarterToolkitCredential(api_key_cred_name, "api_key"))
|
|
258
|
+
|
|
259
|
+
return ParsedStarterToolkitConfig(
|
|
260
|
+
default_agent=default_agent,
|
|
261
|
+
agents=agents,
|
|
262
|
+
memories=memories,
|
|
263
|
+
credentials=credentials,
|
|
264
|
+
aws_target=aws_target,
|
|
265
|
+
)
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
"""`agentcore init NAME --framework strands|langgraph|custom` (Python-port addition).
|
|
2
|
+
|
|
3
|
+
A short form of `agentcore create` for the quick-start flow::
|
|
4
|
+
|
|
5
|
+
agentcore init my-agent --framework strands
|
|
6
|
+
cd my-agent && agentcore dev
|
|
7
|
+
|
|
8
|
+
NAME becomes the folder. The project and agent names are derived from it, because project
|
|
9
|
+
names allow only letters and digits and agent names letters, digits and underscores
|
|
10
|
+
(`my-agent` -> project `MyAgent`, agent `my_agent`). `invoke --agent-name my-agent` accepts
|
|
11
|
+
the hyphenated form.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
import json
|
|
15
|
+
import os
|
|
16
|
+
import re
|
|
17
|
+
import textwrap
|
|
18
|
+
|
|
19
|
+
import typer
|
|
20
|
+
|
|
21
|
+
from agentcore.cli.commands.create import handle_create_cli, print_create_summary
|
|
22
|
+
from agentcore.cli.run_command import run_cli_command
|
|
23
|
+
from agentcore.lib.errors.types import ValidationError
|
|
24
|
+
|
|
25
|
+
DESCRIPTION = "Initialize a new agent project (framework: strands, langgraph, or custom)."
|
|
26
|
+
|
|
27
|
+
# Short names accepted by --framework; upstream names are accepted too (case-insensitive).
|
|
28
|
+
FRAMEWORK_ALIASES = {
|
|
29
|
+
"strands": "Strands",
|
|
30
|
+
"langgraph": "LangChain_LangGraph",
|
|
31
|
+
"langchain": "LangChain_LangGraph",
|
|
32
|
+
"langchain_langgraph": "LangChain_LangGraph",
|
|
33
|
+
"googleadk": "GoogleADK",
|
|
34
|
+
"google-adk": "GoogleADK",
|
|
35
|
+
"openai": "OpenAIAgents",
|
|
36
|
+
"openaiagents": "OpenAIAgents",
|
|
37
|
+
"openai-agents": "OpenAIAgents",
|
|
38
|
+
"vercelai": "VercelAI",
|
|
39
|
+
"vercel-ai": "VercelAI",
|
|
40
|
+
}
|
|
41
|
+
TYPESCRIPT_ONLY = {"VercelAI"}
|
|
42
|
+
NEXT_STEPS = ["agentcore dev", "agentcore deploy --region us-east-1"]
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def derive_names(folder: str) -> tuple[str, str]:
|
|
46
|
+
"""(project name, agent name) for a folder name, or ValidationError if none can be derived."""
|
|
47
|
+
words = [w for w in re.split(r"[^A-Za-z0-9]+", folder) if w]
|
|
48
|
+
if not words or not words[0][0].isalpha():
|
|
49
|
+
raise ValidationError(f'"{folder}" must start with a letter (e.g. my-agent).')
|
|
50
|
+
project = "".join(w[0].upper() + w[1:] for w in words)[:23]
|
|
51
|
+
agent = "_".join(words)[:48]
|
|
52
|
+
return project, agent
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def resolve_framework(value: str) -> str:
|
|
56
|
+
"""Upstream framework name for --framework, or "custom"."""
|
|
57
|
+
key = value.strip().lower()
|
|
58
|
+
if key == "custom":
|
|
59
|
+
return "custom"
|
|
60
|
+
if key in FRAMEWORK_ALIASES:
|
|
61
|
+
return FRAMEWORK_ALIASES[key]
|
|
62
|
+
for upstream in set(FRAMEWORK_ALIASES.values()):
|
|
63
|
+
if key == upstream.lower():
|
|
64
|
+
return upstream
|
|
65
|
+
raise ValidationError(f'Unknown framework "{value}". Use strands, langgraph, or custom.')
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
_CUSTOM_MAIN = textwrap.dedent(
|
|
69
|
+
"""\
|
|
70
|
+
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
71
|
+
|
|
72
|
+
app = BedrockAgentCoreApp()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@app.entrypoint
|
|
76
|
+
async def invoke(payload, context):
|
|
77
|
+
prompt = payload.get("prompt", "")
|
|
78
|
+
# Replace this with your agent: call a model, run tools, return the answer.
|
|
79
|
+
return {"result": f"You said: {prompt}"}
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
if __name__ == "__main__":
|
|
83
|
+
app.run()
|
|
84
|
+
"""
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
_CUSTOM_PYPROJECT = textwrap.dedent(
|
|
88
|
+
"""\
|
|
89
|
+
[build-system]
|
|
90
|
+
requires = ["hatchling"]
|
|
91
|
+
build-backend = "hatchling.build"
|
|
92
|
+
|
|
93
|
+
[project]
|
|
94
|
+
name = "{name}"
|
|
95
|
+
version = "0.1.0"
|
|
96
|
+
description = "AgentCore Runtime Application (custom code)"
|
|
97
|
+
requires-python = ">=3.10"
|
|
98
|
+
dependencies = [
|
|
99
|
+
"aws-opentelemetry-distro ~= 0.18.0",
|
|
100
|
+
"bedrock-agentcore >= 1.18.1",
|
|
101
|
+
"botocore[crt] >= 1.35.0",
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
[tool.hatch.build.targets.wheel]
|
|
105
|
+
packages = ["."]
|
|
106
|
+
"""
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _init_custom(folder: str, project: str, agent: str, cwd: str, o: dict) -> None:
|
|
111
|
+
"""Project plus a bring-your-own-code agent with a minimal entrypoint to start from."""
|
|
112
|
+
from agentcore.cli.commands.create.action import create_project
|
|
113
|
+
from agentcore.primitives.agent import PRIMITIVE as agent_primitive
|
|
114
|
+
from agentcore.primitives.agent import AddAgentOptions
|
|
115
|
+
|
|
116
|
+
if os.path.exists(os.path.join(cwd, folder)):
|
|
117
|
+
raise ValidationError(f"A folder named '{folder}' already exists in this directory")
|
|
118
|
+
created = create_project(
|
|
119
|
+
project, cwd, skip_git=bool(o.get("skipGit")), skip_install=bool(o.get("skipInstall")), directory=folder
|
|
120
|
+
)
|
|
121
|
+
if not created.success:
|
|
122
|
+
raise created.error
|
|
123
|
+
|
|
124
|
+
project_root = created.value["projectPath"]
|
|
125
|
+
code_dir = os.path.join(project_root, "app", agent)
|
|
126
|
+
os.makedirs(code_dir, exist_ok=True)
|
|
127
|
+
with open(os.path.join(code_dir, "main.py"), "w", encoding="utf-8") as fh:
|
|
128
|
+
fh.write(_CUSTOM_MAIN)
|
|
129
|
+
with open(os.path.join(code_dir, "pyproject.toml"), "w", encoding="utf-8") as fh:
|
|
130
|
+
fh.write(_CUSTOM_PYPROJECT.format(name=agent))
|
|
131
|
+
|
|
132
|
+
added = agent_primitive.add(
|
|
133
|
+
AddAgentOptions(
|
|
134
|
+
name=agent,
|
|
135
|
+
type="byo",
|
|
136
|
+
language="Python",
|
|
137
|
+
build_type=o.get("build") or "CodeZip",
|
|
138
|
+
code_location=f"app/{agent}/",
|
|
139
|
+
entrypoint="main.py",
|
|
140
|
+
protocol=o.get("protocol") or "HTTP",
|
|
141
|
+
model_provider=o.get("modelProvider") or "Bedrock",
|
|
142
|
+
),
|
|
143
|
+
config_base_dir=os.path.join(project_root, "agentcore"),
|
|
144
|
+
)
|
|
145
|
+
if not added.success:
|
|
146
|
+
raise added.error
|
|
147
|
+
|
|
148
|
+
if o.get("json"):
|
|
149
|
+
typer.echo(
|
|
150
|
+
json.dumps({"success": True, "projectPath": project_root, "agentName": agent}, separators=(",", ":"))
|
|
151
|
+
)
|
|
152
|
+
else:
|
|
153
|
+
print_create_summary(project, agent, "Python", "custom", directory=folder, next_steps=NEXT_STEPS)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
def register(app: typer.Typer) -> None:
|
|
157
|
+
@app.command("init", help=DESCRIPTION)
|
|
158
|
+
def init(
|
|
159
|
+
name: str = typer.Argument(..., help="Project folder name (e.g. my-agent)"),
|
|
160
|
+
framework: str = typer.Option("strands", "--framework", help="strands, langgraph, or custom"),
|
|
161
|
+
model_provider: str = typer.Option("Bedrock", "--model-provider", help="Bedrock, Anthropic, OpenAI, or Gemini"),
|
|
162
|
+
api_key: str | None = typer.Option(None, "--api-key", help="API key for non-Bedrock providers"),
|
|
163
|
+
protocol: str = typer.Option("HTTP", "--protocol", help="HTTP, MCP, A2A, or AGUI"),
|
|
164
|
+
language: str | None = typer.Option(None, "--language", help="Python or TypeScript (default: Python)"),
|
|
165
|
+
build: str = typer.Option("CodeZip", "--build", help="CodeZip or Container"),
|
|
166
|
+
memory: str = typer.Option("none", "--memory", help="none, shortTerm, or longAndShortTerm"),
|
|
167
|
+
output_dir: str | None = typer.Option(None, "--output-dir", help="Where to create the folder"),
|
|
168
|
+
skip_git: bool = typer.Option(False, "--skip-git", help="Skip git init"),
|
|
169
|
+
skip_install: bool = typer.Option(False, "--skip-install", help="Skip dependency installation"),
|
|
170
|
+
as_json: bool = typer.Option(False, "--json", help="Output as JSON"),
|
|
171
|
+
) -> None:
|
|
172
|
+
o: dict = {
|
|
173
|
+
"directory": name,
|
|
174
|
+
"modelProvider": model_provider,
|
|
175
|
+
"apiKey": api_key,
|
|
176
|
+
"protocol": protocol,
|
|
177
|
+
"build": build,
|
|
178
|
+
"memory": memory,
|
|
179
|
+
"outputDir": output_dir,
|
|
180
|
+
"skipGit": skip_git,
|
|
181
|
+
"skipInstall": skip_install,
|
|
182
|
+
"json": as_json,
|
|
183
|
+
"nextSteps": NEXT_STEPS,
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
def run() -> None:
|
|
187
|
+
project, agent = derive_names(name)
|
|
188
|
+
resolved = resolve_framework(framework)
|
|
189
|
+
o.update(projectName=project, name=agent, framework=resolved)
|
|
190
|
+
o["language"] = language or ("TypeScript" if resolved in TYPESCRIPT_ONLY else "Python")
|
|
191
|
+
if resolved == "custom":
|
|
192
|
+
_init_custom(name, project, agent, output_dir or os.getcwd(), o)
|
|
193
|
+
else:
|
|
194
|
+
handle_create_cli(o) # validates, prints and exits like `agentcore create`
|
|
195
|
+
|
|
196
|
+
run_cli_command(as_json, run)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""`agentcore invoke` (port of src/cli/commands/invoke)."""
|
|
2
|
+
|
|
3
|
+
import typer
|
|
4
|
+
|
|
5
|
+
from agentcore.cli.commands.invoke.action import (
|
|
6
|
+
InvokeContext,
|
|
7
|
+
build_harness_base_opts,
|
|
8
|
+
handle_harness_invoke_by_arn,
|
|
9
|
+
handle_invoke,
|
|
10
|
+
load_invoke_config,
|
|
11
|
+
)
|
|
12
|
+
from agentcore.cli.commands.invoke.resolve import ResolveInvokeResult, resolve_invoke_target
|
|
13
|
+
from agentcore.cli.commands.invoke.types import InvokeOptions, InvokeResult
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
"InvokeContext",
|
|
17
|
+
"InvokeOptions",
|
|
18
|
+
"InvokeResult",
|
|
19
|
+
"ResolveInvokeResult",
|
|
20
|
+
"build_harness_base_opts",
|
|
21
|
+
"handle_harness_invoke_by_arn",
|
|
22
|
+
"handle_invoke",
|
|
23
|
+
"load_invoke_config",
|
|
24
|
+
"register",
|
|
25
|
+
"resolve_invoke_target",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def register(app: typer.Typer) -> None:
|
|
30
|
+
from agentcore.cli.commands.invoke.command import register_invoke
|
|
31
|
+
|
|
32
|
+
register_invoke(app)
|