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,741 @@
|
|
|
1
|
+
"""`agentcore status` logic (port of ``commands/status/action.ts``).
|
|
2
|
+
|
|
3
|
+
Resource entries are plain dicts keyed like upstream's ``ResourceStatusEntry`` (camelCase). Keys
|
|
4
|
+
are inserted in upstream's object order, and ``None`` stands for ``undefined`` (dropped on output),
|
|
5
|
+
so ``--json`` matches upstream key for key.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from collections.abc import Callable, Iterable, Mapping
|
|
11
|
+
from dataclasses import dataclass, field
|
|
12
|
+
from datetime import UTC, datetime
|
|
13
|
+
from typing import Any
|
|
14
|
+
|
|
15
|
+
from agentcore.aws import agentcore_control, agentcore_payments, bedrock_agent
|
|
16
|
+
from agentcore.aws._aws_errors import get_error_message
|
|
17
|
+
from agentcore.cli.commands.status.constants import build_runtime_invocation_url
|
|
18
|
+
from agentcore.cli.commands.status.format_knowledge_base import (
|
|
19
|
+
KbDataSourceDetail,
|
|
20
|
+
KbIngestionDetail,
|
|
21
|
+
KbStatusDetail,
|
|
22
|
+
format_knowledge_base_detail,
|
|
23
|
+
format_knowledge_base_summary_line,
|
|
24
|
+
)
|
|
25
|
+
from agentcore.lib.errors.types import BaseError, ResourceNotFoundError
|
|
26
|
+
from agentcore.lib.schemas.io.config_io import ConfigIO, to_jsonable
|
|
27
|
+
from agentcore.logging.exec_logger import ExecLogger
|
|
28
|
+
|
|
29
|
+
ResourceStatusEntry = dict[str, Any]
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass
|
|
33
|
+
class StatusContext:
|
|
34
|
+
project: Any
|
|
35
|
+
deployed_state: Any
|
|
36
|
+
aws_targets: list[Any]
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def load_status_config(config_io: ConfigIO | None = None) -> StatusContext:
|
|
40
|
+
"""Project, targets and deployed state (missing deployed-state means no targets)."""
|
|
41
|
+
io = config_io or ConfigIO()
|
|
42
|
+
project = io.read_project_spec()
|
|
43
|
+
aws_targets = io.read_aws_deployment_targets()
|
|
44
|
+
deployed_state = io.read_deployed_state() if io.config_exists("state") else {"targets": {}}
|
|
45
|
+
return StatusContext(project=project, deployed_state=to_jsonable(deployed_state), aws_targets=aws_targets)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def _entry(resource_type: str, name: str, state: str, identifier: Any, detail: Any, parent: Any) -> ResourceStatusEntry:
|
|
49
|
+
return {
|
|
50
|
+
"resourceType": resource_type,
|
|
51
|
+
"name": name,
|
|
52
|
+
"deploymentState": state,
|
|
53
|
+
"identifier": identifier,
|
|
54
|
+
"detail": detail,
|
|
55
|
+
"parentName": parent,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _diff_resource_set(
|
|
60
|
+
resource_type: str,
|
|
61
|
+
local_items: Iterable[Any],
|
|
62
|
+
deployed_record: Mapping[str, Mapping[str, Any]],
|
|
63
|
+
get_identifier: Callable[[Mapping[str, Any]], Any],
|
|
64
|
+
get_local_detail: Callable[[Any], Any] | None = None,
|
|
65
|
+
get_deployed_key: Callable[[Any], str] | None = None,
|
|
66
|
+
get_parent_name: Callable[[Any], Any] | None = None,
|
|
67
|
+
) -> list[ResourceStatusEntry]:
|
|
68
|
+
items = list(local_items)
|
|
69
|
+
|
|
70
|
+
def name_of(item: Any) -> str:
|
|
71
|
+
return item["name"] if isinstance(item, Mapping) else item.name
|
|
72
|
+
|
|
73
|
+
def key_of(item: Any) -> str:
|
|
74
|
+
return get_deployed_key(item) if get_deployed_key else name_of(item)
|
|
75
|
+
|
|
76
|
+
local_keys = {key_of(i) for i in items}
|
|
77
|
+
entries = []
|
|
78
|
+
for item in items:
|
|
79
|
+
deployed = deployed_record.get(key_of(item))
|
|
80
|
+
entries.append(
|
|
81
|
+
_entry(
|
|
82
|
+
resource_type,
|
|
83
|
+
name_of(item),
|
|
84
|
+
"deployed" if deployed else "local-only",
|
|
85
|
+
get_identifier(deployed) if deployed else None,
|
|
86
|
+
get_local_detail(item) if get_local_detail else None,
|
|
87
|
+
get_parent_name(item) if get_parent_name else None,
|
|
88
|
+
)
|
|
89
|
+
)
|
|
90
|
+
for name, deployed in deployed_record.items():
|
|
91
|
+
if name not in local_keys:
|
|
92
|
+
slash = name.find("/")
|
|
93
|
+
parent = name[:slash] if get_parent_name and slash > 0 else None
|
|
94
|
+
entries.append(_entry(resource_type, name, "pending-removal", get_identifier(deployed), None, parent))
|
|
95
|
+
return entries
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _plural(count: int, singular: str, plural: str | None = None) -> str:
|
|
99
|
+
return singular if count == 1 else (plural or f"{singular}s")
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _kb_wiring(project: Any) -> dict[str, list[str]]:
|
|
103
|
+
"""KB reference -> gateways whose connector targets reference it (Retrieve + AgenticRetrieveStream)."""
|
|
104
|
+
wiring: dict[str, list[str]] = {}
|
|
105
|
+
|
|
106
|
+
def record(ref: str, gateway: str) -> None:
|
|
107
|
+
names = wiring.setdefault(ref, [])
|
|
108
|
+
if gateway not in names:
|
|
109
|
+
names.append(gateway)
|
|
110
|
+
|
|
111
|
+
for gw in project.agent_core_gateways or []:
|
|
112
|
+
for t in gw.targets or []:
|
|
113
|
+
if t.target_type != "connector":
|
|
114
|
+
continue
|
|
115
|
+
for cfg in t.configurations or []:
|
|
116
|
+
pv = cfg.parameter_values or {}
|
|
117
|
+
if cfg.name == "Retrieve" and pv.get("knowledgeBaseId"):
|
|
118
|
+
record(pv["knowledgeBaseId"], gw.name)
|
|
119
|
+
if cfg.name == "AgenticRetrieveStream":
|
|
120
|
+
for r in pv.get("retrievers") or []:
|
|
121
|
+
ref = (((r or {}).get("configuration") or {}).get("knowledgeBase") or {}).get("knowledgeBaseId")
|
|
122
|
+
if ref:
|
|
123
|
+
record(ref, gw.name)
|
|
124
|
+
return wiring
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _gateway_detail(item: Any) -> str | None:
|
|
128
|
+
targets = item.targets or []
|
|
129
|
+
if not targets:
|
|
130
|
+
return None
|
|
131
|
+
retrieve = sum(1 for t in targets if t.target_type == "connector" and t.connector_id == "bedrock-knowledge-bases")
|
|
132
|
+
web_search = sum(1 for t in targets if t.target_type == "connector" and t.connector_id == "web-search")
|
|
133
|
+
base = f"{len(targets)} target{'s' if len(targets) != 1 else ''}"
|
|
134
|
+
parts = []
|
|
135
|
+
if retrieve:
|
|
136
|
+
parts.append(f"{retrieve} retrieve")
|
|
137
|
+
fan_out = 0
|
|
138
|
+
for t in targets:
|
|
139
|
+
if t.target_type != "connector" or t.connector_id != "bedrock-knowledge-bases":
|
|
140
|
+
continue
|
|
141
|
+
agentic = next((c for c in t.configurations or [] if c.name == "AgenticRetrieveStream"), None)
|
|
142
|
+
if agentic:
|
|
143
|
+
fan_out += len((agentic.parameter_values or {}).get("retrievers") or [])
|
|
144
|
+
if fan_out:
|
|
145
|
+
parts.append(f"agentic ×{fan_out}")
|
|
146
|
+
if web_search:
|
|
147
|
+
parts.append(f"{web_search} web-search")
|
|
148
|
+
return f"{base} ({', '.join(parts)})" if parts else base
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _strip_suffix(value: str | None, suffix: str) -> str | None:
|
|
152
|
+
return value.replace(suffix, "", 1) if value else value
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def compute_resource_statuses(project: Any, resources: Mapping[str, Any] | None) -> list[ResourceStatusEntry]:
|
|
156
|
+
"""Diff local resources against the deployed-state resources (camelCase JSON) for one target."""
|
|
157
|
+
res = resources or {}
|
|
158
|
+
|
|
159
|
+
agents = _diff_resource_set("agent", project.runtimes or [], res.get("runtimes") or {}, lambda d: d["runtimeArn"])
|
|
160
|
+
credentials = _diff_resource_set(
|
|
161
|
+
"credential",
|
|
162
|
+
project.credentials or [],
|
|
163
|
+
res.get("credentials") or {},
|
|
164
|
+
lambda d: d["credentialProviderArn"],
|
|
165
|
+
lambda item: _strip_suffix(item.authorizer_type, "CredentialProvider"),
|
|
166
|
+
)
|
|
167
|
+
memories = _diff_resource_set(
|
|
168
|
+
"memory",
|
|
169
|
+
project.memories or [],
|
|
170
|
+
res.get("memories") or {},
|
|
171
|
+
lambda d: d["memoryArn"],
|
|
172
|
+
lambda item: ", ".join(s.type for s in item.strategies) if item.strategies else None,
|
|
173
|
+
)
|
|
174
|
+
gateways = _diff_resource_set(
|
|
175
|
+
"gateway",
|
|
176
|
+
project.agent_core_gateways or [],
|
|
177
|
+
{**((res.get("mcp") or {}).get("gateways") or {}), **(res.get("gateways") or {})},
|
|
178
|
+
lambda d: d["gatewayId"],
|
|
179
|
+
_gateway_detail,
|
|
180
|
+
)
|
|
181
|
+
evaluators = _diff_resource_set(
|
|
182
|
+
"evaluator",
|
|
183
|
+
project.evaluators or [],
|
|
184
|
+
res.get("evaluators") or {},
|
|
185
|
+
lambda d: d["evaluatorArn"],
|
|
186
|
+
lambda item: f"{item.level} — {'Code-based' if item.config.code_based else 'LLM-as-a-Judge'}",
|
|
187
|
+
)
|
|
188
|
+
online_evals = _diff_resource_set(
|
|
189
|
+
"online-eval",
|
|
190
|
+
project.online_eval_configs or [],
|
|
191
|
+
res.get("onlineEvalConfigs") or {},
|
|
192
|
+
lambda d: d["onlineEvaluationConfigArn"],
|
|
193
|
+
lambda item: (
|
|
194
|
+
f"{len(item.evaluators or [])} evaluator{'s' if len(item.evaluators or []) != 1 else ''}, "
|
|
195
|
+
f"{_js_number(item.sampling_rate)}% sampling"
|
|
196
|
+
),
|
|
197
|
+
)
|
|
198
|
+
policy_engines = _diff_resource_set(
|
|
199
|
+
"policy-engine",
|
|
200
|
+
project.policy_engines or [],
|
|
201
|
+
res.get("policyEngines") or {},
|
|
202
|
+
lambda d: d["policyEngineArn"],
|
|
203
|
+
lambda item: (
|
|
204
|
+
f"{len(item.policies)} polic{'ies' if len(item.policies) != 1 else 'y'}" if item.policies else None
|
|
205
|
+
),
|
|
206
|
+
)
|
|
207
|
+
local_policies = [
|
|
208
|
+
{"name": p.name, "engineName": engine.name} for engine in project.policy_engines or [] for p in engine.policies
|
|
209
|
+
]
|
|
210
|
+
policies = _diff_resource_set(
|
|
211
|
+
"policy",
|
|
212
|
+
local_policies,
|
|
213
|
+
res.get("policies") or {},
|
|
214
|
+
lambda d: d["policyArn"],
|
|
215
|
+
lambda item: item["engineName"],
|
|
216
|
+
lambda item: f"{item['engineName']}/{item['name']}",
|
|
217
|
+
)
|
|
218
|
+
config_bundles = _diff_resource_set(
|
|
219
|
+
"config-bundle",
|
|
220
|
+
project.config_bundles or [],
|
|
221
|
+
res.get("configBundles") or {},
|
|
222
|
+
lambda d: d["bundleArn"],
|
|
223
|
+
lambda item: item.description,
|
|
224
|
+
)
|
|
225
|
+
datasets = _diff_resource_set(
|
|
226
|
+
"dataset", project.datasets or [], res.get("datasets") or {}, lambda d: d["datasetArn"], lambda i: i.schema_type
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
wiring = _kb_wiring(project)
|
|
230
|
+
|
|
231
|
+
def kb_detail(item: Any) -> str:
|
|
232
|
+
count = len(item.data_sources)
|
|
233
|
+
ds_part = f"{count} data source{'' if count == 1 else 's'}"
|
|
234
|
+
wired = list(wiring.get(item.name, []))
|
|
235
|
+
if item.gateway and item.gateway not in wired:
|
|
236
|
+
wired.append(item.gateway)
|
|
237
|
+
return f"{ds_part} → gw:{','.join(wired)}" if wired else ds_part
|
|
238
|
+
|
|
239
|
+
knowledge_bases = _diff_resource_set(
|
|
240
|
+
"knowledge-base",
|
|
241
|
+
project.knowledge_bases or [],
|
|
242
|
+
res.get("knowledgeBases") or {},
|
|
243
|
+
lambda d: d["knowledgeBaseArn"],
|
|
244
|
+
kb_detail,
|
|
245
|
+
)
|
|
246
|
+
|
|
247
|
+
local_endpoints = [
|
|
248
|
+
{"name": ep_name, "agentName": r.name, "version": ep.version, "description": ep.description}
|
|
249
|
+
for r in project.runtimes or []
|
|
250
|
+
for ep_name, ep in (r.endpoints or {}).items()
|
|
251
|
+
]
|
|
252
|
+
runtime_endpoints = _diff_resource_set(
|
|
253
|
+
"runtime-endpoint",
|
|
254
|
+
local_endpoints,
|
|
255
|
+
res.get("runtimeEndpoints") or {},
|
|
256
|
+
lambda d: d["endpointArn"],
|
|
257
|
+
lambda item: f"v{item['version']}{' — ' + item['description'] if item['description'] else ''}",
|
|
258
|
+
lambda item: f"{item['agentName']}/{item['name']}",
|
|
259
|
+
lambda item: item["agentName"],
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
harness_records = res.get("harnesses") or {}
|
|
263
|
+
harnesses = _diff_resource_set(
|
|
264
|
+
"harness", project.harnesses or [], harness_records, lambda d: d["harnessArn"], lambda _item: None
|
|
265
|
+
)
|
|
266
|
+
for entry in harnesses:
|
|
267
|
+
version = (harness_records.get(entry["name"]) or {}).get("harnessVersion")
|
|
268
|
+
if version is not None:
|
|
269
|
+
entry["detail"] = f"{entry['detail']} v{version}" if entry["detail"] else f"v{version}"
|
|
270
|
+
|
|
271
|
+
payments = _diff_resource_set(
|
|
272
|
+
"payment",
|
|
273
|
+
project.payments or [],
|
|
274
|
+
res.get("payments") or {},
|
|
275
|
+
lambda d: d["managerArn"],
|
|
276
|
+
lambda item: (
|
|
277
|
+
f"{item.authorizer_type} — auto-pay {'on' if item.auto_payment else 'off'} "
|
|
278
|
+
f"({len(item.connectors)} connector(s))"
|
|
279
|
+
),
|
|
280
|
+
)
|
|
281
|
+
capacity_providers = _diff_resource_set(
|
|
282
|
+
"capacity-provider",
|
|
283
|
+
project.capacity_providers or [],
|
|
284
|
+
res.get("capacityProviders") or {},
|
|
285
|
+
lambda d: d["capacityProviderArn"],
|
|
286
|
+
lambda item: (
|
|
287
|
+
item.compute_configuration.ec2_configuration.launch_template_source.launch_parameters.operating_system
|
|
288
|
+
),
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
return [
|
|
292
|
+
*agents,
|
|
293
|
+
*runtime_endpoints,
|
|
294
|
+
*credentials,
|
|
295
|
+
*memories,
|
|
296
|
+
*gateways,
|
|
297
|
+
*evaluators,
|
|
298
|
+
*online_evals,
|
|
299
|
+
*policy_engines,
|
|
300
|
+
*policies,
|
|
301
|
+
*datasets,
|
|
302
|
+
*knowledge_bases,
|
|
303
|
+
*config_bundles,
|
|
304
|
+
*harnesses,
|
|
305
|
+
*payments,
|
|
306
|
+
*capacity_providers,
|
|
307
|
+
]
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
def _js_number(value: Any) -> str:
|
|
311
|
+
"""JS number-to-string (``10.0`` -> ``"10"``)."""
|
|
312
|
+
if isinstance(value, float) and value.is_integer():
|
|
313
|
+
return str(int(value))
|
|
314
|
+
return str(value)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
def _iso(value: Any) -> str | None:
|
|
318
|
+
if not isinstance(value, datetime):
|
|
319
|
+
return None
|
|
320
|
+
dt = value if value.tzinfo else value.replace(tzinfo=UTC)
|
|
321
|
+
dt = dt.astimezone(UTC)
|
|
322
|
+
return dt.strftime("%Y-%m-%dT%H:%M:%S.") + f"{dt.microsecond // 1000:03d}Z"
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
@dataclass
|
|
326
|
+
class ProjectStatusResult:
|
|
327
|
+
success: bool
|
|
328
|
+
error: BaseException | None = None
|
|
329
|
+
project_name: str | None = None
|
|
330
|
+
target_name: str | None = None
|
|
331
|
+
target_region: str | None = None
|
|
332
|
+
resources: list[ResourceStatusEntry] = field(default_factory=list)
|
|
333
|
+
deployed_state: Any = None
|
|
334
|
+
log_path: str | None = None
|
|
335
|
+
|
|
336
|
+
def to_json(self, resources: list[ResourceStatusEntry] | None = None) -> dict[str, Any]:
|
|
337
|
+
entries = [_drop_none(e) for e in (self.resources if resources is None else resources)]
|
|
338
|
+
if self.success:
|
|
339
|
+
data = {
|
|
340
|
+
"success": True,
|
|
341
|
+
"projectName": self.project_name,
|
|
342
|
+
"targetName": self.target_name,
|
|
343
|
+
"targetRegion": self.target_region,
|
|
344
|
+
"resources": entries,
|
|
345
|
+
"deployedState": self.deployed_state,
|
|
346
|
+
"logPath": self.log_path,
|
|
347
|
+
}
|
|
348
|
+
else:
|
|
349
|
+
data = {
|
|
350
|
+
"success": False,
|
|
351
|
+
"projectName": self.project_name,
|
|
352
|
+
"targetName": self.target_name,
|
|
353
|
+
"resources": entries,
|
|
354
|
+
"logPath": self.log_path,
|
|
355
|
+
"error": str(self.error),
|
|
356
|
+
}
|
|
357
|
+
data.update(_error_extras(self.error))
|
|
358
|
+
return _drop_none(data)
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
@dataclass
|
|
362
|
+
class RuntimeLookupResult:
|
|
363
|
+
success: bool
|
|
364
|
+
error: BaseException | None = None
|
|
365
|
+
target_name: str | None = None
|
|
366
|
+
runtime_id: str | None = None
|
|
367
|
+
runtime_status: str | None = None
|
|
368
|
+
log_path: str | None = None
|
|
369
|
+
|
|
370
|
+
def to_json(self) -> dict[str, Any]:
|
|
371
|
+
if self.success:
|
|
372
|
+
data = {
|
|
373
|
+
"success": True,
|
|
374
|
+
"targetName": self.target_name,
|
|
375
|
+
"runtimeId": self.runtime_id,
|
|
376
|
+
"runtimeStatus": self.runtime_status,
|
|
377
|
+
"logPath": self.log_path,
|
|
378
|
+
}
|
|
379
|
+
else:
|
|
380
|
+
data = {"success": False, "logPath": self.log_path, "error": str(self.error), **_error_extras(self.error)}
|
|
381
|
+
return _drop_none(data)
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
def _error_extras(error: BaseException | None) -> dict[str, Any]:
|
|
385
|
+
if isinstance(error, BaseError):
|
|
386
|
+
return {"errorName": error.name, "errorSource": error.error_source}
|
|
387
|
+
return {}
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def _drop_none(data: Mapping[str, Any]) -> dict[str, Any]:
|
|
391
|
+
return {k: v for k, v in data.items() if v is not None}
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
def handle_project_status(
|
|
395
|
+
context: StatusContext, *, target_name: str | None = None, knowledge_base_name: str | None = None
|
|
396
|
+
) -> ProjectStatusResult:
|
|
397
|
+
logger = ExecLogger(command="status")
|
|
398
|
+
project, aws_targets = context.project, context.aws_targets
|
|
399
|
+
deployed_state = to_jsonable(context.deployed_state)
|
|
400
|
+
state_targets: dict[str, Any] = deployed_state.get("targets") or {}
|
|
401
|
+
|
|
402
|
+
logger.start_step("Resolve target")
|
|
403
|
+
deployed_names = list(state_targets.keys())
|
|
404
|
+
target_names = deployed_names if deployed_names else [t.name for t in aws_targets]
|
|
405
|
+
selected = target_name or (target_names[0] if target_names else None)
|
|
406
|
+
|
|
407
|
+
logger.log(f"Project: {project.name}")
|
|
408
|
+
logger.log(f"Available targets: {', '.join(target_names) if target_names else '(none)'}")
|
|
409
|
+
logger.log(f"Selected target: {selected or '(none)'}")
|
|
410
|
+
|
|
411
|
+
if target_name and target_name not in target_names:
|
|
412
|
+
error = (
|
|
413
|
+
f"Target '{target_name}' not found. Available: {', '.join(target_names)}"
|
|
414
|
+
if target_names
|
|
415
|
+
else f"Target '{target_name}' not found. No targets configured."
|
|
416
|
+
)
|
|
417
|
+
logger.end_step("error", error)
|
|
418
|
+
logger.finalize(False)
|
|
419
|
+
return ProjectStatusResult(
|
|
420
|
+
success=False,
|
|
421
|
+
error=Exception(error),
|
|
422
|
+
project_name=project.name,
|
|
423
|
+
target_name=target_name,
|
|
424
|
+
resources=[],
|
|
425
|
+
log_path=logger.get_relative_log_path(),
|
|
426
|
+
)
|
|
427
|
+
logger.end_step("success")
|
|
428
|
+
|
|
429
|
+
logger.start_step("Compute resource statuses")
|
|
430
|
+
target_config = next((t for t in aws_targets if t.name == selected), None) if selected else None
|
|
431
|
+
target_resources = ((state_targets.get(selected) or {}).get("resources") or {}) if selected else {}
|
|
432
|
+
resources = compute_resource_statuses(project, target_resources)
|
|
433
|
+
|
|
434
|
+
def count(state: str) -> int:
|
|
435
|
+
return sum(1 for r in resources if r["deploymentState"] == state)
|
|
436
|
+
|
|
437
|
+
logger.log(
|
|
438
|
+
f"Resources: {len(resources)} total ({count('deployed')} deployed, {count('local-only')} local-only, "
|
|
439
|
+
f"{count('pending-removal')} pending-removal)"
|
|
440
|
+
)
|
|
441
|
+
for entry in resources:
|
|
442
|
+
ident = f" [{entry['identifier']}]" if entry["identifier"] else ""
|
|
443
|
+
logger.log(f" {entry['resourceType']}/{entry['name']}: {entry['deploymentState']}{ident}")
|
|
444
|
+
logger.end_step("success")
|
|
445
|
+
|
|
446
|
+
if target_config is not None:
|
|
447
|
+
region = target_config.region
|
|
448
|
+
|
|
449
|
+
def deployed_of(kind: str, states: Mapping[str, Any]) -> list[tuple[int, ResourceStatusEntry, Any]]:
|
|
450
|
+
return [
|
|
451
|
+
(i, e, states[e["name"]])
|
|
452
|
+
for i, e in enumerate(resources)
|
|
453
|
+
if e["resourceType"] == kind and e["deploymentState"] == "deployed" and states.get(e["name"])
|
|
454
|
+
]
|
|
455
|
+
|
|
456
|
+
# Runtimes
|
|
457
|
+
agent_targets = deployed_of("agent", target_resources.get("runtimes") or {})
|
|
458
|
+
if agent_targets:
|
|
459
|
+
n = len(agent_targets)
|
|
460
|
+
logger.start_step(f"Fetch runtime status ({n} agent{'s' if n != 1 else ''})")
|
|
461
|
+
for i, entry, state in agent_targets:
|
|
462
|
+
url = build_runtime_invocation_url(region, entry["identifier"]) if entry["identifier"] else None
|
|
463
|
+
try:
|
|
464
|
+
status = agentcore_control.get_agent_runtime_status(region=region, runtime_id=state["runtimeId"])
|
|
465
|
+
resources[i] = {**entry, "detail": status["status"], "invocationUrl": url}
|
|
466
|
+
logger.log(f" {entry['name']}: {status['status']} ({state['runtimeId']})")
|
|
467
|
+
except Exception as exc: # noqa: BLE001
|
|
468
|
+
msg = get_error_message(exc)
|
|
469
|
+
resources[i] = {**entry, "error": msg, "invocationUrl": url}
|
|
470
|
+
logger.log(f" {entry['name']}: ERROR - {msg}", "error")
|
|
471
|
+
logger.end_step("error" if any(r.get("error") for r in resources) else "success")
|
|
472
|
+
|
|
473
|
+
# Evaluators
|
|
474
|
+
eval_targets = deployed_of("evaluator", target_resources.get("evaluators") or {})
|
|
475
|
+
if eval_targets:
|
|
476
|
+
n = len(eval_targets)
|
|
477
|
+
logger.start_step(f"Fetch evaluator status ({n} evaluator{'s' if n != 1 else ''})")
|
|
478
|
+
for i, entry, state in eval_targets:
|
|
479
|
+
try:
|
|
480
|
+
ev = agentcore_control.get_evaluator(region=region, evaluator_id=state["evaluatorId"])
|
|
481
|
+
resources[i] = {**entry, "detail": f"{_js_str(entry['detail'])} — {ev['status']}"}
|
|
482
|
+
logger.log(f" {entry['name']}: {ev['status']} ({state['evaluatorId']})")
|
|
483
|
+
except Exception as exc: # noqa: BLE001
|
|
484
|
+
msg = get_error_message(exc)
|
|
485
|
+
resources[i] = {**entry, "error": msg}
|
|
486
|
+
logger.log(f" {entry['name']}: ERROR - {msg}", "error")
|
|
487
|
+
logger.end_step(
|
|
488
|
+
"error" if any(r["resourceType"] == "evaluator" and r.get("error") for r in resources) else "success"
|
|
489
|
+
)
|
|
490
|
+
|
|
491
|
+
# Online eval configs
|
|
492
|
+
oe_targets = deployed_of("online-eval", target_resources.get("onlineEvalConfigs") or {})
|
|
493
|
+
if oe_targets:
|
|
494
|
+
n = len(oe_targets)
|
|
495
|
+
logger.start_step(f"Fetch online eval status ({n} config{'s' if n != 1 else ''})")
|
|
496
|
+
for i, entry, state in oe_targets:
|
|
497
|
+
try:
|
|
498
|
+
cfg = agentcore_control.get_online_evaluation_config(
|
|
499
|
+
region=region, config_id=state["onlineEvaluationConfigId"]
|
|
500
|
+
)
|
|
501
|
+
label = f"{cfg['status']} ({cfg['executionStatus']})"
|
|
502
|
+
resources[i] = {**entry, "detail": f"{entry['detail']} — {label}" if entry["detail"] else label}
|
|
503
|
+
logger.log(f" {entry['name']}: {label} ({state['onlineEvaluationConfigId']})")
|
|
504
|
+
except Exception as exc: # noqa: BLE001
|
|
505
|
+
msg = get_error_message(exc)
|
|
506
|
+
resources[i] = {**entry, "error": msg}
|
|
507
|
+
logger.log(f" {entry['name']}: ERROR - {msg}", "error")
|
|
508
|
+
logger.end_step(
|
|
509
|
+
"error" if any(r["resourceType"] == "online-eval" and r.get("error") for r in resources) else "success"
|
|
510
|
+
)
|
|
511
|
+
|
|
512
|
+
# Knowledge bases
|
|
513
|
+
kb_targets = deployed_of("knowledge-base", target_resources.get("knowledgeBases") or {})
|
|
514
|
+
if kb_targets:
|
|
515
|
+
n = len(kb_targets)
|
|
516
|
+
logger.start_step(f"Fetch knowledge base status ({n} KB{'s' if n != 1 else ''})")
|
|
517
|
+
wiring = _kb_wiring(project)
|
|
518
|
+
for i, entry, state in kb_targets:
|
|
519
|
+
try:
|
|
520
|
+
live = bedrock_agent.get_knowledge_base(region=region, knowledge_base_id=state["knowledgeBaseId"])
|
|
521
|
+
if not live:
|
|
522
|
+
out_of_sync = "out of sync (KB deleted out of band)"
|
|
523
|
+
detail = f"{entry['detail']} — {out_of_sync}" if entry["detail"] else out_of_sync
|
|
524
|
+
resources[i] = {**entry, "detail": detail}
|
|
525
|
+
logger.log(f" {entry['name']}: KB {state['knowledgeBaseId']} not found", "error")
|
|
526
|
+
continue
|
|
527
|
+
data_sources = []
|
|
528
|
+
for ds in state.get("dataSources") or []:
|
|
529
|
+
job = bedrock_agent.get_latest_ingestion_job(
|
|
530
|
+
region=region, knowledge_base_id=state["knowledgeBaseId"], data_source_id=ds["dataSourceId"]
|
|
531
|
+
)
|
|
532
|
+
if not job:
|
|
533
|
+
data_sources.append(KbDataSourceDetail(ds["uri"], ds["dataSourceId"]))
|
|
534
|
+
continue
|
|
535
|
+
stats = job.get("statistics") or {}
|
|
536
|
+
succeeded = job.get("status") == "COMPLETE"
|
|
537
|
+
data_sources.append(
|
|
538
|
+
KbDataSourceDetail(
|
|
539
|
+
ds["uri"],
|
|
540
|
+
ds["dataSourceId"],
|
|
541
|
+
KbIngestionDetail(
|
|
542
|
+
status=job.get("status"),
|
|
543
|
+
started_at=_iso(job.get("startedAt")),
|
|
544
|
+
updated_at=_iso(job.get("updatedAt")),
|
|
545
|
+
completed_at=_iso(job.get("updatedAt")) if succeeded else None,
|
|
546
|
+
scanned=stats.get("numberOfDocumentsScanned"),
|
|
547
|
+
indexed=stats.get("numberOfNewDocumentsIndexed"),
|
|
548
|
+
modified=stats.get("numberOfModifiedDocumentsIndexed"),
|
|
549
|
+
failed=stats.get("numberOfDocumentsFailed"),
|
|
550
|
+
deleted=stats.get("numberOfDocumentsDeleted"),
|
|
551
|
+
),
|
|
552
|
+
)
|
|
553
|
+
)
|
|
554
|
+
kb = KbStatusDetail(
|
|
555
|
+
name=entry["name"],
|
|
556
|
+
knowledge_base_id=state["knowledgeBaseId"],
|
|
557
|
+
status=live.get("status"),
|
|
558
|
+
gateway_names=list(wiring.get(entry["name"], [])),
|
|
559
|
+
data_sources=data_sources,
|
|
560
|
+
)
|
|
561
|
+
if knowledge_base_name:
|
|
562
|
+
if entry["name"] == knowledge_base_name:
|
|
563
|
+
for line in format_knowledge_base_detail(kb):
|
|
564
|
+
logger.log(line)
|
|
565
|
+
else:
|
|
566
|
+
logger.log(format_knowledge_base_summary_line(kb))
|
|
567
|
+
first = next((d for d in data_sources if d.ingestion), None)
|
|
568
|
+
summary = (
|
|
569
|
+
f"Ingestion: {first.ingestion.status}"
|
|
570
|
+
if first and first.ingestion and first.ingestion.status
|
|
571
|
+
else "Ingestion: never run"
|
|
572
|
+
)
|
|
573
|
+
enriched = f"Status: {live.get('status') or 'UNKNOWN'} — {summary}"
|
|
574
|
+
resources[i] = {
|
|
575
|
+
**entry,
|
|
576
|
+
"detail": f"{entry['detail']} — {enriched}" if entry["detail"] else enriched,
|
|
577
|
+
}
|
|
578
|
+
except Exception as exc: # noqa: BLE001
|
|
579
|
+
msg = get_error_message(exc)
|
|
580
|
+
resources[i] = {**entry, "error": msg}
|
|
581
|
+
logger.log(f" {entry['name']}: ERROR - {msg}", "error")
|
|
582
|
+
logger.end_step(
|
|
583
|
+
"error"
|
|
584
|
+
if any(r["resourceType"] == "knowledge-base" and r.get("error") for r in resources)
|
|
585
|
+
else "success"
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
# Payments
|
|
589
|
+
pay_targets = deployed_of("payment", target_resources.get("payments") or {})
|
|
590
|
+
if pay_targets:
|
|
591
|
+
n = len(pay_targets)
|
|
592
|
+
logger.start_step(f"Fetch payment status ({n} manager{'s' if n != 1 else ''})")
|
|
593
|
+
for i, entry, state in pay_targets:
|
|
594
|
+
connectors = state.get("connectors") or {}
|
|
595
|
+
connector_count = len(connectors)
|
|
596
|
+
try:
|
|
597
|
+
manager = agentcore_payments.get_payment_manager(
|
|
598
|
+
region=region, payment_manager_id=state["managerId"]
|
|
599
|
+
)
|
|
600
|
+
status = (manager or {}).get("status") or "unknown"
|
|
601
|
+
resources[i] = {**entry, "detail": f"{status} — {connector_count} connector(s)"}
|
|
602
|
+
logger.log(f" {entry['name']}: {status} ({state['managerId']})")
|
|
603
|
+
except Exception as exc: # noqa: BLE001
|
|
604
|
+
msg = get_error_message(exc)
|
|
605
|
+
resources[i] = {**entry, "detail": f"unknown — {connector_count} connector(s)", "error": msg}
|
|
606
|
+
logger.log(f" {entry['name']}: unknown (fetch failed) - {msg}", "error")
|
|
607
|
+
|
|
608
|
+
statuses = []
|
|
609
|
+
for connector_name, connector_state in connectors.items():
|
|
610
|
+
connector_id = connector_state["connectorId"]
|
|
611
|
+
try:
|
|
612
|
+
detail = agentcore_payments.get_payment_connector(
|
|
613
|
+
region=region, payment_manager_id=state["managerId"], payment_connector_id=connector_id
|
|
614
|
+
)
|
|
615
|
+
if not detail:
|
|
616
|
+
statuses.append(
|
|
617
|
+
{
|
|
618
|
+
"name": connector_name,
|
|
619
|
+
"connectorId": connector_id,
|
|
620
|
+
"status": "NOT_FOUND",
|
|
621
|
+
"error": "Connector was not found by the Payments service",
|
|
622
|
+
}
|
|
623
|
+
)
|
|
624
|
+
continue
|
|
625
|
+
arn = next(
|
|
626
|
+
(
|
|
627
|
+
(c.get("coinbaseCDP") or {}).get("credentialProviderArn")
|
|
628
|
+
or (c.get("stripePrivy") or {}).get("credentialProviderArn")
|
|
629
|
+
for c in detail.get("credentialProviderConfigurations") or []
|
|
630
|
+
if (c.get("coinbaseCDP") or {}).get("credentialProviderArn")
|
|
631
|
+
or (c.get("stripePrivy") or {}).get("credentialProviderArn")
|
|
632
|
+
),
|
|
633
|
+
None,
|
|
634
|
+
)
|
|
635
|
+
record: dict[str, Any] = {
|
|
636
|
+
"name": connector_name,
|
|
637
|
+
"connectorId": connector_id,
|
|
638
|
+
"status": detail.get("status"),
|
|
639
|
+
}
|
|
640
|
+
if detail.get("status") == "PENDING_AUTHENTICATION" and detail.get("authorizationUrl"):
|
|
641
|
+
record["authorizationUrl"] = detail["authorizationUrl"]
|
|
642
|
+
if arn:
|
|
643
|
+
record["credentialProviderArn"] = arn
|
|
644
|
+
statuses.append(record)
|
|
645
|
+
except Exception as exc: # noqa: BLE001
|
|
646
|
+
statuses.append(
|
|
647
|
+
{
|
|
648
|
+
"name": connector_name,
|
|
649
|
+
"connectorId": connector_id,
|
|
650
|
+
"status": "UNKNOWN",
|
|
651
|
+
"error": get_error_message(exc),
|
|
652
|
+
}
|
|
653
|
+
)
|
|
654
|
+
resources[i] = {**resources[i], "paymentConnectors": statuses}
|
|
655
|
+
for c in statuses:
|
|
656
|
+
suffix = f" - {c['error']}" if c.get("error") else ""
|
|
657
|
+
logger.log(
|
|
658
|
+
f" {c['name']}: {c['status']} ({c['connectorId']}){suffix}",
|
|
659
|
+
"error" if c.get("error") else None,
|
|
660
|
+
)
|
|
661
|
+
logger.end_step(
|
|
662
|
+
"error" if any(r["resourceType"] == "payment" and r.get("error") for r in resources) else "success"
|
|
663
|
+
)
|
|
664
|
+
|
|
665
|
+
logger.finalize(True)
|
|
666
|
+
return ProjectStatusResult(
|
|
667
|
+
success=True,
|
|
668
|
+
project_name=project.name,
|
|
669
|
+
target_name=selected or "",
|
|
670
|
+
target_region=target_config.region if target_config is not None else None,
|
|
671
|
+
resources=resources,
|
|
672
|
+
deployed_state=deployed_state,
|
|
673
|
+
log_path=logger.get_relative_log_path(),
|
|
674
|
+
)
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
def _js_str(value: Any) -> str:
|
|
678
|
+
"""Template-literal stringification (``undefined`` -> ``"undefined"``)."""
|
|
679
|
+
return "undefined" if value is None else str(value)
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
def handle_runtime_lookup(
|
|
683
|
+
context: StatusContext, *, agent_runtime_id: str, target_name: str | None = None
|
|
684
|
+
) -> RuntimeLookupResult:
|
|
685
|
+
logger = ExecLogger(command="status")
|
|
686
|
+
aws_targets = context.aws_targets
|
|
687
|
+
|
|
688
|
+
logger.start_step("Resolve target")
|
|
689
|
+
names = [t.name for t in aws_targets]
|
|
690
|
+
if not names:
|
|
691
|
+
error = "No deployment targets found. Run `agentcore create` first."
|
|
692
|
+
logger.end_step("error", error)
|
|
693
|
+
logger.finalize(False)
|
|
694
|
+
return RuntimeLookupResult(False, ResourceNotFoundError(error), log_path=logger.get_relative_log_path())
|
|
695
|
+
|
|
696
|
+
selected = target_name or names[0]
|
|
697
|
+
if target_name and target_name not in names:
|
|
698
|
+
error = f"Target '{target_name}' not found. Available: {', '.join(names)}"
|
|
699
|
+
logger.end_step("error", error)
|
|
700
|
+
logger.finalize(False)
|
|
701
|
+
return RuntimeLookupResult(False, ResourceNotFoundError(error), log_path=logger.get_relative_log_path())
|
|
702
|
+
|
|
703
|
+
target_config = next((t for t in aws_targets if t.name == selected), None)
|
|
704
|
+
if target_config is None: # pragma: no cover - unreachable given the checks above
|
|
705
|
+
error = f"Target config '{selected}' not found in aws-targets"
|
|
706
|
+
logger.end_step("error", error)
|
|
707
|
+
logger.finalize(False)
|
|
708
|
+
return RuntimeLookupResult(False, ResourceNotFoundError(error), log_path=logger.get_relative_log_path())
|
|
709
|
+
|
|
710
|
+
logger.log(f"Target: {selected} ({target_config.region})")
|
|
711
|
+
logger.end_step("success")
|
|
712
|
+
|
|
713
|
+
logger.start_step(f"Lookup runtime {agent_runtime_id}")
|
|
714
|
+
try:
|
|
715
|
+
status = agentcore_control.get_agent_runtime_status(region=target_config.region, runtime_id=agent_runtime_id)
|
|
716
|
+
logger.log(f"Runtime: {status['runtimeId']} — {status['status']}")
|
|
717
|
+
logger.end_step("success")
|
|
718
|
+
logger.finalize(True)
|
|
719
|
+
return RuntimeLookupResult(
|
|
720
|
+
True,
|
|
721
|
+
target_name=selected,
|
|
722
|
+
runtime_id=status["runtimeId"],
|
|
723
|
+
runtime_status=status["status"],
|
|
724
|
+
log_path=logger.get_relative_log_path(),
|
|
725
|
+
)
|
|
726
|
+
except Exception as exc: # noqa: BLE001
|
|
727
|
+
logger.end_step("error", get_error_message(exc))
|
|
728
|
+
logger.finalize(False)
|
|
729
|
+
return RuntimeLookupResult(False, exc, log_path=logger.get_relative_log_path())
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
__all__ = [
|
|
733
|
+
"ProjectStatusResult",
|
|
734
|
+
"ResourceStatusEntry",
|
|
735
|
+
"RuntimeLookupResult",
|
|
736
|
+
"StatusContext",
|
|
737
|
+
"compute_resource_statuses",
|
|
738
|
+
"handle_project_status",
|
|
739
|
+
"handle_runtime_lookup",
|
|
740
|
+
"load_status_config",
|
|
741
|
+
]
|