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,71 @@
|
|
|
1
|
+
"""Execute dataset scenarios against a deployed agent (port of operations/eval/shared/scenario-executor.ts).
|
|
2
|
+
|
|
3
|
+
Turns run sequentially in one session; up to 5 scenarios run concurrently; a turn failure halts
|
|
4
|
+
(and fails) that scenario.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import threading
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from agentcore.aws import agentcore as agentcore_api
|
|
13
|
+
from agentcore.operations.session import generate_session_id
|
|
14
|
+
|
|
15
|
+
MAX_CONCURRENT = 5
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _execute_single(scenario: dict[str, Any], ctx: Any) -> dict[str, Any]:
|
|
19
|
+
session_id = generate_session_id()
|
|
20
|
+
try:
|
|
21
|
+
for turn in scenario["turns"]:
|
|
22
|
+
agentcore_api.invoke_agent_runtime(
|
|
23
|
+
agentcore_api.InvokeAgentRuntimeOptions(
|
|
24
|
+
region=ctx.region,
|
|
25
|
+
runtime_arn=ctx.runtime_arn,
|
|
26
|
+
payload=turn["input"],
|
|
27
|
+
session_id=session_id,
|
|
28
|
+
bearer_token=ctx.bearer_token,
|
|
29
|
+
baggage=ctx.baggage,
|
|
30
|
+
endpoint=ctx.endpoint,
|
|
31
|
+
)
|
|
32
|
+
)
|
|
33
|
+
return {
|
|
34
|
+
"scenarioId": scenario["scenario_id"],
|
|
35
|
+
"sessionId": session_id,
|
|
36
|
+
"turnCount": len(scenario["turns"]),
|
|
37
|
+
"status": "success",
|
|
38
|
+
}
|
|
39
|
+
except Exception as exc: # noqa: BLE001
|
|
40
|
+
return {
|
|
41
|
+
"scenarioId": scenario["scenario_id"],
|
|
42
|
+
"sessionId": session_id,
|
|
43
|
+
"turnCount": len(scenario["turns"]),
|
|
44
|
+
"status": "failed",
|
|
45
|
+
"error": str(exc),
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def execute_scenarios(
|
|
50
|
+
*,
|
|
51
|
+
scenarios: list[dict[str, Any]],
|
|
52
|
+
agent_context: Any,
|
|
53
|
+
on_progress: Callable[[int, int, dict[str, Any]], None] | None = None,
|
|
54
|
+
) -> list[dict[str, Any]]:
|
|
55
|
+
results: list[dict[str, Any] | None] = [None] * len(scenarios)
|
|
56
|
+
lock = threading.Lock()
|
|
57
|
+
completed = 0
|
|
58
|
+
|
|
59
|
+
def run(i: int) -> None:
|
|
60
|
+
nonlocal completed
|
|
61
|
+
result = _execute_single(scenarios[i], agent_context)
|
|
62
|
+
with lock:
|
|
63
|
+
results[i] = result
|
|
64
|
+
completed += 1
|
|
65
|
+
if on_progress:
|
|
66
|
+
on_progress(completed, len(scenarios), result)
|
|
67
|
+
|
|
68
|
+
if scenarios:
|
|
69
|
+
with ThreadPoolExecutor(max_workers=min(MAX_CONCURRENT, len(scenarios))) as pool:
|
|
70
|
+
list(pool.map(run, range(len(scenarios))))
|
|
71
|
+
return [r for r in results if r is not None]
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"""Collect spans from CloudWatch (port of operations/eval/shared/span-collector.ts)."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import time
|
|
5
|
+
from collections.abc import Callable
|
|
6
|
+
from concurrent.futures import ThreadPoolExecutor
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from agentcore.aws._aws_errors import aws_error_name
|
|
10
|
+
from agentcore.aws.account import create_aws_client
|
|
11
|
+
|
|
12
|
+
# Default delay before first span query (CloudWatch ingestion buffer). Matches the SDK's 180s.
|
|
13
|
+
SPAN_INGESTION_DELAY_MS = 180_000
|
|
14
|
+
SPAN_POLL_TIMEOUT_MS = 60_000
|
|
15
|
+
SPAN_POLL_INTERVAL_MS = 5_000
|
|
16
|
+
|
|
17
|
+
SPANS_LOG_GROUP = "aws/spans"
|
|
18
|
+
|
|
19
|
+
SUPPORTED_SCOPES = frozenset(
|
|
20
|
+
{
|
|
21
|
+
"strands.telemetry.tracer",
|
|
22
|
+
"opentelemetry.instrumentation.langchain",
|
|
23
|
+
"openinference.instrumentation.langchain",
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
ResultRow = list[dict[str, str]]
|
|
28
|
+
|
|
29
|
+
# Injectable for tests.
|
|
30
|
+
sleep: Callable[[float], None] = time.sleep
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _is_permanent_error(err: BaseException) -> bool:
|
|
34
|
+
msg = str(err)
|
|
35
|
+
return "AccessDenied" in msg or "InvalidParameter" in msg
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _poll_one_session(
|
|
39
|
+
session_id: str, query_spans: Callable[[str, str, str], list[Any]], region: str, log_group: str, timeout_ms: int
|
|
40
|
+
) -> list[Any] | None:
|
|
41
|
+
deadline = time.time() * 1000 + timeout_ms
|
|
42
|
+
while time.time() * 1000 < deadline:
|
|
43
|
+
try:
|
|
44
|
+
spans = query_spans(region, log_group, session_id)
|
|
45
|
+
if spans:
|
|
46
|
+
return spans
|
|
47
|
+
except Exception as exc:
|
|
48
|
+
if _is_permanent_error(exc):
|
|
49
|
+
raise Exception(f"CloudWatch query failed: {exc}") from exc
|
|
50
|
+
sleep(SPAN_POLL_INTERVAL_MS / 1000)
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def collect_spans(
|
|
55
|
+
*,
|
|
56
|
+
session_ids: list[str],
|
|
57
|
+
region: str,
|
|
58
|
+
log_group: str,
|
|
59
|
+
query_spans: Callable[[str, str, str], list[Any]],
|
|
60
|
+
on_progress: Callable[..., None] | None = None,
|
|
61
|
+
) -> dict[str, Any]:
|
|
62
|
+
"""{"spans": {sessionId: [...]}, "timedOut": [...]} after the ingestion delay."""
|
|
63
|
+
progress = on_progress or (lambda *_a: None)
|
|
64
|
+
progress(0, len(session_ids), f"Waiting for span ingestion ({SPAN_INGESTION_DELAY_MS // 1000}s)...")
|
|
65
|
+
sleep(SPAN_INGESTION_DELAY_MS / 1000)
|
|
66
|
+
|
|
67
|
+
collected_count = 0
|
|
68
|
+
|
|
69
|
+
def poll(session_id: str) -> tuple[str, list[Any] | None]:
|
|
70
|
+
nonlocal collected_count
|
|
71
|
+
spans = _poll_one_session(session_id, query_spans, region, log_group, SPAN_POLL_TIMEOUT_MS)
|
|
72
|
+
if spans:
|
|
73
|
+
collected_count += 1
|
|
74
|
+
progress(collected_count, len(session_ids))
|
|
75
|
+
return session_id, spans
|
|
76
|
+
|
|
77
|
+
collected: dict[str, list[Any]] = {}
|
|
78
|
+
timed_out: list[str] = []
|
|
79
|
+
if not session_ids:
|
|
80
|
+
return {"spans": collected, "timedOut": timed_out}
|
|
81
|
+
with ThreadPoolExecutor(max_workers=min(8, len(session_ids))) as pool:
|
|
82
|
+
futures = [pool.submit(poll, s) for s in session_ids]
|
|
83
|
+
for future in futures:
|
|
84
|
+
try:
|
|
85
|
+
sid, spans = future.result()
|
|
86
|
+
except Exception: # noqa: BLE001 - rejected sessions are treated as timed out
|
|
87
|
+
timed_out.append("unknown")
|
|
88
|
+
continue
|
|
89
|
+
if spans:
|
|
90
|
+
collected[sid] = spans
|
|
91
|
+
else:
|
|
92
|
+
timed_out.append(sid)
|
|
93
|
+
return {"spans": collected, "timedOut": timed_out}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def extract_trace_ids(spans: list[Any]) -> list[str]:
|
|
97
|
+
"""Unique traceIds in appearance order."""
|
|
98
|
+
seen: dict[str, None] = {}
|
|
99
|
+
for span in spans:
|
|
100
|
+
trace_id = span.get("traceId") if isinstance(span, dict) else None
|
|
101
|
+
if trace_id and trace_id not in seen:
|
|
102
|
+
seen[trace_id] = None
|
|
103
|
+
return list(seen)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def extract_tool_call_span_ids(spans: list[Any]) -> list[str]:
|
|
107
|
+
out = []
|
|
108
|
+
for span in spans:
|
|
109
|
+
if not isinstance(span, dict) or not span.get("spanId"):
|
|
110
|
+
continue
|
|
111
|
+
attrs = span.get("attributes") or {}
|
|
112
|
+
tool = attrs.get("gen_ai.tool.name")
|
|
113
|
+
if tool is None:
|
|
114
|
+
tool = attrs.get("tool.name")
|
|
115
|
+
if tool:
|
|
116
|
+
out.append(span["spanId"])
|
|
117
|
+
return out
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def sanitize_query_value(value: str) -> str:
|
|
121
|
+
return value.replace("'", "")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def execute_query(client: Any, log_group_name: str, query_string: str, start_sec: int, end_sec: int) -> list[ResultRow]:
|
|
125
|
+
"""Run a Logs Insights query and wait (max 60s) for the results."""
|
|
126
|
+
start = client.start_query(
|
|
127
|
+
logGroupName=log_group_name, startTime=start_sec, endTime=end_sec, queryString=query_string
|
|
128
|
+
)
|
|
129
|
+
query_id = start.get("queryId")
|
|
130
|
+
if not query_id:
|
|
131
|
+
raise Exception("Failed to start CloudWatch Logs Insights query")
|
|
132
|
+
for _ in range(60):
|
|
133
|
+
sleep(1)
|
|
134
|
+
results = client.get_query_results(queryId=query_id)
|
|
135
|
+
status = results.get("status") or "Unknown"
|
|
136
|
+
if status in ("Failed", "Cancelled"):
|
|
137
|
+
raise Exception(f"CloudWatch query {status.lower()}")
|
|
138
|
+
if status == "Complete":
|
|
139
|
+
return results.get("results") or []
|
|
140
|
+
raise Exception("CloudWatch query timed out after 60 seconds")
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def execute_query_graceful(client: Any, log_group_name: str, query: str, start_sec: int, end_sec: int) -> list:
|
|
144
|
+
"""``execute_query`` returning [] when the log group does not exist."""
|
|
145
|
+
try:
|
|
146
|
+
return execute_query(client, log_group_name, query, start_sec, end_sec)
|
|
147
|
+
except Exception as exc:
|
|
148
|
+
if aws_error_name(exc) == "ResourceNotFoundException" or "does not exist" in str(exc):
|
|
149
|
+
return []
|
|
150
|
+
raise
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def _field(row: ResultRow, name: str) -> str | None:
|
|
154
|
+
return next((f.get("value") for f in row if f.get("field") == name), None)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _extract_messages(rows: list[ResultRow]) -> list[dict[str, Any]]:
|
|
158
|
+
docs = []
|
|
159
|
+
for row in rows:
|
|
160
|
+
value = _field(row, "@message")
|
|
161
|
+
if value:
|
|
162
|
+
try:
|
|
163
|
+
doc = json.loads(value)
|
|
164
|
+
except ValueError:
|
|
165
|
+
continue
|
|
166
|
+
if isinstance(doc, dict):
|
|
167
|
+
docs.append(doc)
|
|
168
|
+
return docs
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def _is_relevant_for_eval(doc: dict[str, Any]) -> bool:
|
|
172
|
+
scope = doc.get("scope")
|
|
173
|
+
if isinstance(scope, dict) and scope.get("name") in SUPPORTED_SCOPES:
|
|
174
|
+
return True
|
|
175
|
+
body = doc.get("body")
|
|
176
|
+
return isinstance(body, dict) and ("input" in body or "output" in body)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def fetch_session_spans(
|
|
180
|
+
*,
|
|
181
|
+
runtime_id: str,
|
|
182
|
+
runtime_log_group: str,
|
|
183
|
+
region: str,
|
|
184
|
+
lookback_days: float,
|
|
185
|
+
session_id: str | None = None,
|
|
186
|
+
trace_id: str | None = None,
|
|
187
|
+
) -> list[dict[str, Any]]:
|
|
188
|
+
"""OTel spans from ``aws/spans`` + runtime logs, grouped by session: [{sessionId, spans}]."""
|
|
189
|
+
end_ms = int(time.time() * 1000)
|
|
190
|
+
start_ms = end_ms - int(lookback_days * 24 * 60 * 60 * 1000)
|
|
191
|
+
start_sec, end_sec = start_ms // 1000, end_ms // 1000
|
|
192
|
+
client = create_aws_client("logs", region)
|
|
193
|
+
|
|
194
|
+
span_query = f"""fields @message, attributes.session.id as sessionId, traceId
|
|
195
|
+
| parse resource.attributes.cloud.resource_id "runtime/*/" as parsedAgentId
|
|
196
|
+
| filter parsedAgentId = '{sanitize_query_value(runtime_id)}'
|
|
197
|
+
| filter ispresent(scope.name) and ispresent(kind)"""
|
|
198
|
+
if session_id:
|
|
199
|
+
span_query += f"\n | filter attributes.session.id = '{sanitize_query_value(session_id)}'"
|
|
200
|
+
if trace_id:
|
|
201
|
+
span_query += f"\n | filter traceId = '{sanitize_query_value(trace_id)}'"
|
|
202
|
+
span_query += "\n | sort startTimeUnixNano asc\n | limit 10000"
|
|
203
|
+
|
|
204
|
+
with ThreadPoolExecutor(max_workers=2) as pool:
|
|
205
|
+
shared_f = pool.submit(execute_query_graceful, client, SPANS_LOG_GROUP, span_query, start_sec, end_sec)
|
|
206
|
+
runtime_f = pool.submit(execute_query_graceful, client, runtime_log_group, span_query, start_sec, end_sec)
|
|
207
|
+
all_rows = shared_f.result() + runtime_f.result()
|
|
208
|
+
|
|
209
|
+
session_map: dict[str, list[Any]] = {}
|
|
210
|
+
trace_ids: dict[str, None] = {}
|
|
211
|
+
for row in all_rows:
|
|
212
|
+
message = _field(row, "@message")
|
|
213
|
+
if not message:
|
|
214
|
+
continue
|
|
215
|
+
try:
|
|
216
|
+
doc = json.loads(message)
|
|
217
|
+
except ValueError:
|
|
218
|
+
continue
|
|
219
|
+
sid = _field(row, "sessionId") or "unknown"
|
|
220
|
+
session_map.setdefault(sid, []).append(doc)
|
|
221
|
+
tid = _field(row, "traceId")
|
|
222
|
+
if tid:
|
|
223
|
+
trace_ids[tid] = None
|
|
224
|
+
|
|
225
|
+
if not session_map:
|
|
226
|
+
return []
|
|
227
|
+
|
|
228
|
+
if trace_ids:
|
|
229
|
+
trace_filter = ", ".join(f"'{sanitize_query_value(t)}'" for t in trace_ids)
|
|
230
|
+
try:
|
|
231
|
+
log_rows = execute_query(
|
|
232
|
+
client,
|
|
233
|
+
runtime_log_group,
|
|
234
|
+
f"""fields @message, traceId
|
|
235
|
+
| filter traceId in [{trace_filter}]
|
|
236
|
+
| sort @timestamp asc
|
|
237
|
+
| limit 10000""",
|
|
238
|
+
start_sec,
|
|
239
|
+
end_sec,
|
|
240
|
+
)
|
|
241
|
+
except Exception: # noqa: BLE001 - runtime log group may not exist yet
|
|
242
|
+
log_rows = []
|
|
243
|
+
trace_to_session: dict[str, str] = {}
|
|
244
|
+
for row in all_rows:
|
|
245
|
+
tid, sid = _field(row, "traceId"), _field(row, "sessionId")
|
|
246
|
+
if tid and sid:
|
|
247
|
+
trace_to_session[tid] = sid
|
|
248
|
+
for log_doc in _extract_messages(log_rows):
|
|
249
|
+
if not _is_relevant_for_eval(log_doc):
|
|
250
|
+
continue
|
|
251
|
+
tid = log_doc.get("traceId")
|
|
252
|
+
sid = trace_to_session.get(tid, "unknown") if tid else "unknown"
|
|
253
|
+
session_map.setdefault(sid, []).append(log_doc)
|
|
254
|
+
|
|
255
|
+
return [{"sessionId": sid, "spans": docs} for sid, docs in session_map.items() if docs]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"""Local eval-run history (port of operations/eval/storage.ts): ``<configRoot>/.cli/eval-results/eval_*.json``."""
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
import os
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from agentcore.lib import find_config_root
|
|
8
|
+
from agentcore.lib.utils.json_format import to_json_string
|
|
9
|
+
from agentcore.operations.jobs.shared.format import parse_js_date
|
|
10
|
+
|
|
11
|
+
EVAL_RESULTS_DIR = "eval-results"
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _results_dir() -> str:
|
|
15
|
+
config_root = find_config_root()
|
|
16
|
+
if not config_root:
|
|
17
|
+
raise Exception("No agentcore project found. Run `agentcore create` first.")
|
|
18
|
+
return os.path.join(config_root, ".cli", EVAL_RESULTS_DIR)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def generate_filename(timestamp: str) -> str:
|
|
22
|
+
d = parse_js_date(timestamp)
|
|
23
|
+
if d is None:
|
|
24
|
+
return "eval_NaN-NaN-NaN_NaN-NaN-NaN"
|
|
25
|
+
from datetime import UTC
|
|
26
|
+
|
|
27
|
+
d = d.astimezone(UTC)
|
|
28
|
+
return f"eval_{d.year}-{d.month:02d}-{d.day:02d}_{d.hour:02d}-{d.minute:02d}-{d.second:02d}"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def run_json(run: dict[str, Any]) -> str:
|
|
32
|
+
return to_json_string(run, 2)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def save_eval_run(run: dict[str, Any]) -> str:
|
|
36
|
+
directory = _results_dir()
|
|
37
|
+
os.makedirs(directory, exist_ok=True)
|
|
38
|
+
file_path = os.path.join(directory, f"{generate_filename(run['timestamp'])}.json")
|
|
39
|
+
with open(file_path, "w", encoding="utf-8", newline="") as fh:
|
|
40
|
+
fh.write(run_json(run))
|
|
41
|
+
return file_path
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def load_eval_run(filename: str) -> dict[str, Any]:
|
|
45
|
+
directory = _results_dir()
|
|
46
|
+
name = filename if filename.endswith(".json") else f"{filename}.json"
|
|
47
|
+
file_path = os.path.join(directory, name)
|
|
48
|
+
if not os.path.exists(file_path):
|
|
49
|
+
raise Exception(f'Eval run "{filename}" not found at {file_path}')
|
|
50
|
+
with open(file_path, encoding="utf-8") as fh:
|
|
51
|
+
return json.load(fh)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def list_eval_runs() -> list[dict[str, Any]]:
|
|
55
|
+
directory = _results_dir()
|
|
56
|
+
if not os.path.isdir(directory):
|
|
57
|
+
return []
|
|
58
|
+
files = sorted((f for f in os.listdir(directory) if f.startswith("eval_") and f.endswith(".json")), reverse=True)
|
|
59
|
+
runs = []
|
|
60
|
+
for f in files:
|
|
61
|
+
with open(os.path.join(directory, f), encoding="utf-8") as fh:
|
|
62
|
+
runs.append(json.load(fh))
|
|
63
|
+
return runs
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def get_results_path() -> str:
|
|
67
|
+
return _results_dir()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Feedback submission to AWS's public feedback service (port of src/cli/operations/feedback)."""
|
|
2
|
+
|
|
3
|
+
from agentcore.operations.feedback.aperture_client import ApertureError
|
|
4
|
+
from agentcore.operations.feedback.constants import CONSENT_TEXT
|
|
5
|
+
from agentcore.operations.feedback.submit_feedback import (
|
|
6
|
+
FEEDBACK_MESSAGE_MAX_LENGTH,
|
|
7
|
+
FeedbackValidationError,
|
|
8
|
+
submit_feedback,
|
|
9
|
+
validate_feedback_message,
|
|
10
|
+
validate_screenshot_path,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"CONSENT_TEXT",
|
|
15
|
+
"FEEDBACK_MESSAGE_MAX_LENGTH",
|
|
16
|
+
"ApertureError",
|
|
17
|
+
"FeedbackValidationError",
|
|
18
|
+
"submit_feedback",
|
|
19
|
+
"validate_feedback_message",
|
|
20
|
+
"validate_screenshot_path",
|
|
21
|
+
]
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"""HTTP client for AWS's public feedback service (port of aperture-client.ts).
|
|
2
|
+
|
|
3
|
+
``_send`` is the single network seam (tests replace it); it never raises on HTTP error statuses.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
import urllib.error
|
|
10
|
+
import urllib.request
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from agentcore.operations.feedback.constants import APERTURE_INGESTION_URL, APERTURE_PRESIGNED_URL_ENDPOINT
|
|
14
|
+
|
|
15
|
+
_TIMEOUT_SECONDS = 60
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ApertureError(Exception):
|
|
19
|
+
def __init__(self, message: str, status: int | None = None, body: str | None = None):
|
|
20
|
+
super().__init__(message)
|
|
21
|
+
self.name = "ApertureError"
|
|
22
|
+
self.status = status
|
|
23
|
+
self.body = body
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _send(method: str, url: str, headers: dict[str, str], body: bytes) -> tuple[int, bytes]:
|
|
27
|
+
request = urllib.request.Request(url, data=body, method=method, headers=headers)
|
|
28
|
+
try:
|
|
29
|
+
with urllib.request.urlopen(request, timeout=_TIMEOUT_SECONDS) as response: # noqa: S310 - fixed https URLs
|
|
30
|
+
return response.status, response.read()
|
|
31
|
+
except urllib.error.HTTPError as exc:
|
|
32
|
+
try:
|
|
33
|
+
data = exc.read()
|
|
34
|
+
except Exception: # noqa: BLE001
|
|
35
|
+
data = b""
|
|
36
|
+
return exc.code, data
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _text(body: bytes) -> str:
|
|
40
|
+
return body.decode("utf-8", errors="replace")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def fetch_presigned_url(request: dict[str, Any], user_agent: str) -> str:
|
|
44
|
+
"""The S3 presigned URL for a screenshot upload (returned as a plain-text body)."""
|
|
45
|
+
status, body = _send(
|
|
46
|
+
"POST",
|
|
47
|
+
APERTURE_PRESIGNED_URL_ENDPOINT,
|
|
48
|
+
{"content-type": "application/json", "user-agent": user_agent},
|
|
49
|
+
json.dumps(request, separators=(",", ":")).encode(),
|
|
50
|
+
)
|
|
51
|
+
if not 200 <= status < 300:
|
|
52
|
+
raise ApertureError(f"Failed to fetch screenshot upload URL (HTTP {status}).", status, _text(body))
|
|
53
|
+
return _text(body).strip()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def upload_file_to_s3(presigned_url: str, data: bytes, content_type: str, sha256_base64: str, user_agent: str) -> None:
|
|
57
|
+
status, body = _send(
|
|
58
|
+
"PUT",
|
|
59
|
+
presigned_url,
|
|
60
|
+
{
|
|
61
|
+
"content-type": content_type,
|
|
62
|
+
"x-amz-checksum-algorithm": "SHA256",
|
|
63
|
+
"x-amz-checksum-sha256": sha256_base64,
|
|
64
|
+
"x-amz-tagging": "scanstatus=NOT_SCANNED",
|
|
65
|
+
"user-agent": user_agent,
|
|
66
|
+
},
|
|
67
|
+
data,
|
|
68
|
+
)
|
|
69
|
+
if not 200 <= status < 300:
|
|
70
|
+
raise ApertureError(f"Failed to upload screenshot (HTTP {status}).", status, _text(body))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def submit_form(payload: dict[str, Any], user_agent: str) -> dict[str, Any]:
|
|
74
|
+
status, body = _send(
|
|
75
|
+
"POST",
|
|
76
|
+
APERTURE_INGESTION_URL,
|
|
77
|
+
{"content-type": "application/json", "user-agent": user_agent},
|
|
78
|
+
json.dumps(payload, separators=(",", ":")).encode(),
|
|
79
|
+
)
|
|
80
|
+
if not 200 <= status < 300:
|
|
81
|
+
text = _text(body)
|
|
82
|
+
raise ApertureError(_map_status_to_message(status, text), status, text)
|
|
83
|
+
return json.loads(body)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
def _map_status_to_message(status: int, body: str) -> str:
|
|
87
|
+
if status == 400:
|
|
88
|
+
return f"Feedback service rejected the submission (HTTP 400). {body or 'Form payload may be malformed.'}"
|
|
89
|
+
if status == 412:
|
|
90
|
+
return "Feedback service is missing required headers (HTTP 412)."
|
|
91
|
+
if status == 417:
|
|
92
|
+
return "Feedback service rejected the request content type (HTTP 417)."
|
|
93
|
+
if status == 500:
|
|
94
|
+
return "Feedback service returned an internal error (HTTP 500). Please try again later."
|
|
95
|
+
return f"Feedback service returned HTTP {status}."
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
__all__ = ["ApertureError", "fetch_presigned_url", "submit_form", "upload_file_to_s3"]
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"""Feedback form payload (port of build-payload.ts).
|
|
2
|
+
|
|
3
|
+
Deliberate deviation: this client identifies itself honestly as the Python port — the CLI version is
|
|
4
|
+
sent as ``<version>-python`` and the runtime as ``python <version>`` instead of Node. The product
|
|
5
|
+
identifiers (``agentcore-cli`` / ``AgentCoreCLI``) are unchanged.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import platform
|
|
11
|
+
import sys
|
|
12
|
+
from typing import Any, Literal
|
|
13
|
+
|
|
14
|
+
from agentcore import __version__
|
|
15
|
+
from agentcore.operations.feedback.constants import (
|
|
16
|
+
APERTURE_FORM_CATEGORY,
|
|
17
|
+
APERTURE_FORM_NAME,
|
|
18
|
+
APERTURE_FORM_VERSION,
|
|
19
|
+
APERTURE_LOCALE,
|
|
20
|
+
FEEDBACK_ATTACHMENT_QUESTION,
|
|
21
|
+
FEEDBACK_MESSAGE_QUESTION,
|
|
22
|
+
FEEDBACK_REFERENCE,
|
|
23
|
+
METADATA_KEY_CLI_VERSION,
|
|
24
|
+
METADATA_KEY_OS,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
FeedbackMode = Literal["cli", "tui"]
|
|
28
|
+
|
|
29
|
+
CLI_VERSION = f"{__version__}-python"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _platform() -> str:
|
|
33
|
+
"""Node's ``process.platform`` naming (darwin / linux / win32)."""
|
|
34
|
+
return sys.platform
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _python_version() -> str:
|
|
38
|
+
return platform.python_version()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def build_os_descriptor() -> str:
|
|
42
|
+
return f"{_platform()} {platform.release()}"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def build_location_descriptor(cli_version: str, mode: FeedbackMode) -> str:
|
|
46
|
+
return f"agentcore-cli@{cli_version} ({_platform()}; python {_python_version()}; {mode})"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def build_user_agent(cli_version: str) -> str:
|
|
50
|
+
return f"AgentCoreCLI/{cli_version} ({_platform()} {platform.release()}; python/{_python_version()})"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def build_feedback_payload(
|
|
54
|
+
message: str,
|
|
55
|
+
screenshot_reference: str | None = None,
|
|
56
|
+
mode: FeedbackMode | None = None,
|
|
57
|
+
cli_version: str | None = None,
|
|
58
|
+
os_descriptor: str | None = None,
|
|
59
|
+
) -> dict[str, Any]:
|
|
60
|
+
version = cli_version or CLI_VERSION
|
|
61
|
+
responses: list[dict[str, Any]] = [
|
|
62
|
+
{
|
|
63
|
+
"question": FEEDBACK_MESSAGE_QUESTION,
|
|
64
|
+
"pii": False,
|
|
65
|
+
"response": {"responseType": "textArea", "responseValue": message},
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
if screenshot_reference:
|
|
69
|
+
responses.append(
|
|
70
|
+
{
|
|
71
|
+
"question": FEEDBACK_ATTACHMENT_QUESTION,
|
|
72
|
+
"pii": True,
|
|
73
|
+
"response": {"responseType": "fileUpload", "responseValue": [screenshot_reference]},
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
return {
|
|
77
|
+
"category": APERTURE_FORM_CATEGORY,
|
|
78
|
+
"name": APERTURE_FORM_NAME,
|
|
79
|
+
"version": APERTURE_FORM_VERSION,
|
|
80
|
+
"locale": APERTURE_LOCALE,
|
|
81
|
+
"reference": FEEDBACK_REFERENCE,
|
|
82
|
+
"location": build_location_descriptor(version, mode or "cli"),
|
|
83
|
+
"customerResponses": responses,
|
|
84
|
+
"metadataList": [
|
|
85
|
+
{"key": METADATA_KEY_CLI_VERSION, "value": version},
|
|
86
|
+
{"key": METADATA_KEY_OS, "value": os_descriptor or build_os_descriptor()},
|
|
87
|
+
],
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
__all__ = [
|
|
92
|
+
"CLI_VERSION",
|
|
93
|
+
"build_feedback_payload",
|
|
94
|
+
"build_location_descriptor",
|
|
95
|
+
"build_os_descriptor",
|
|
96
|
+
"build_user_agent",
|
|
97
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"""Port of src/cli/operations/feedback/constants.ts."""
|
|
2
|
+
|
|
3
|
+
APERTURE_FORM_CATEGORY = "AgentCore"
|
|
4
|
+
APERTURE_FORM_NAME = "CLI"
|
|
5
|
+
APERTURE_FORM_VERSION = "0.1.0"
|
|
6
|
+
APERTURE_LOCALE = "en_US"
|
|
7
|
+
|
|
8
|
+
APERTURE_INGESTION_URL = "https://ingestion.aperture-public-api.feedback.console.aws.dev/form"
|
|
9
|
+
APERTURE_PRESIGNED_URL_ENDPOINT = "https://presignedurl.aperture-public-api.feedback.console.aws.dev/presignedurl"
|
|
10
|
+
|
|
11
|
+
MAX_SCREENSHOT_BYTES = 100 * 1024 * 1024
|
|
12
|
+
ALLOWED_SCREENSHOT_EXTENSIONS = (".png", ".jpg", ".jpeg")
|
|
13
|
+
|
|
14
|
+
FEEDBACK_MESSAGE_QUESTION = "What feedback do you have for the AgentCore CLI"
|
|
15
|
+
FEEDBACK_ATTACHMENT_QUESTION = "Attachments"
|
|
16
|
+
METADATA_KEY_CLI_VERSION = "cli-version"
|
|
17
|
+
METADATA_KEY_OS = "os"
|
|
18
|
+
|
|
19
|
+
FEEDBACK_REFERENCE = "agentcore-cli"
|
|
20
|
+
|
|
21
|
+
CONSENT_TEXT = (
|
|
22
|
+
"All feedback submissions, including any uploaded text and images, are subject "
|
|
23
|
+
"to the AWS Customer Agreement (https://aws.amazon.com/agreement/). By submitting "
|
|
24
|
+
'feedback, you agree that your submissions constitute "Suggestions" as defined '
|
|
25
|
+
"in the AWS Customer Agreement."
|
|
26
|
+
)
|