@aws/agentcore 1.0.0-preview.9 → 1.0.0-rc.1
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.
- package/README.md +978 -145
- package/dist/assets/agent-inspector/index.css.asset +1 -0
- package/dist/assets/agent-inspector/index.js.asset +289 -0
- package/dist/assets/cdk/README.md +3 -0
- package/dist/assets/cdk/bin/cdk.ts +109 -59
- package/dist/assets/cdk/lib/cdk-stack.ts +30 -19
- package/dist/assets/cdk/package.json +9 -9
- package/dist/assets/cdk/test/cdk.test.ts +94 -2
- package/dist/assets/evaluators/autoevals-lambda/README.md +23 -0
- package/dist/assets/evaluators/autoevals-lambda/execution-role-policy.json +15 -0
- package/dist/assets/evaluators/autoevals-lambda/lambda_function.py +37 -0
- package/dist/assets/evaluators/autoevals-lambda/pyproject.toml +23 -0
- package/dist/assets/evaluators/deepeval-lambda/README.md +23 -0
- package/dist/assets/evaluators/deepeval-lambda/execution-role-policy.json +15 -0
- package/dist/assets/evaluators/deepeval-lambda/lambda_function.py +29 -0
- package/dist/assets/evaluators/deepeval-lambda/pyproject.toml +22 -0
- package/dist/assets/evaluators/python-lambda/README.md +28 -0
- package/dist/assets/evaluators/python-lambda/pyproject.toml +1 -1
- package/dist/assets/templates/a2a-python-strands/README.md +31 -0
- package/dist/assets/templates/a2a-python-strands/main.py +100 -0
- package/dist/assets/templates/a2a-python-strands/memory/session.py +35 -0
- package/dist/assets/templates/a2a-python-strands/model/load.py +6 -0
- package/dist/assets/templates/a2a-python-strands/pyproject.toml +20 -0
- package/dist/assets/templates/agent-python-langchain/README.md +55 -0
- package/dist/assets/{python/a2a/googleadk/base → templates/agent-python-langchain}/gitignore.template +1 -1
- package/dist/assets/templates/agent-python-langchain/main.py +54 -0
- package/dist/assets/templates/agent-python-langchain/model/load.py +9 -0
- package/dist/assets/templates/agent-python-langchain/pyproject.toml +21 -0
- package/dist/assets/templates/agent-python-minimal/README.md +31 -0
- package/dist/assets/templates/agent-python-minimal/main.py +13 -0
- package/dist/assets/templates/agent-python-minimal/pyproject.toml +18 -0
- package/dist/assets/{container/python/Dockerfile → templates/agent-python-strands/Dockerfile.template} +3 -1
- package/dist/assets/templates/agent-python-strands/README.md +46 -0
- package/dist/assets/{python/a2a/langchain_langgraph/base → templates/agent-python-strands}/gitignore.template +1 -1
- package/dist/assets/templates/agent-python-strands/main.py +106 -0
- package/dist/assets/templates/agent-python-strands/memory/__init__.py +0 -0
- package/dist/assets/templates/agent-python-strands/memory/session.py +35 -0
- package/dist/assets/{python/http/strands/base → templates/agent-python-strands}/model/load.py +46 -0
- package/dist/assets/templates/agent-python-strands/pyproject.toml +24 -0
- package/dist/assets/templates/agent-typescript-strands/README.md +29 -0
- package/dist/assets/templates/agent-typescript-strands/gitignore.template +22 -0
- package/dist/assets/templates/agent-typescript-strands/main.ts +86 -0
- package/dist/assets/templates/agent-typescript-strands/mcp_client/client.ts +11 -0
- package/dist/assets/templates/agent-typescript-strands/memory/memory.ts +44 -0
- package/dist/assets/templates/agent-typescript-strands/model/load.ts +5 -0
- package/dist/assets/templates/agent-typescript-strands/package.json.template +29 -0
- package/dist/assets/templates/agent-typescript-strands/tsconfig.json +19 -0
- package/dist/assets/templates/agent-typescript-vercel/README.md +22 -0
- package/dist/assets/templates/agent-typescript-vercel/gitignore.template +22 -0
- package/dist/assets/templates/agent-typescript-vercel/main.ts +35 -0
- package/dist/assets/templates/agent-typescript-vercel/package.json.template +24 -0
- package/dist/assets/templates/agent-typescript-vercel/tsconfig.json +19 -0
- package/dist/assets/templates/agui-python-strands/README.md +39 -0
- package/dist/assets/{python/a2a/strands/base → templates/agui-python-strands}/gitignore.template +1 -1
- package/dist/assets/{python/agui/strands/base → templates/agui-python-strands}/main.py +11 -14
- package/dist/assets/templates/agui-python-strands/memory/__init__.py +0 -0
- package/dist/assets/templates/agui-python-strands/memory/session.py +35 -0
- package/dist/assets/templates/agui-python-strands/model/load.py +6 -0
- package/dist/assets/templates/agui-python-strands/pyproject.toml +22 -0
- package/dist/assets/{python/http/strands/base → templates/export-harness-python}/README.md +15 -8
- package/dist/assets/templates/export-harness-python/gitignore.template +41 -0
- package/dist/assets/templates/export-harness-python/main.py +584 -0
- package/dist/assets/templates/export-harness-python/mcp_client/client.py +63 -0
- package/dist/assets/templates/export-harness-python/memory/__init__.py +0 -0
- package/dist/assets/templates/export-harness-python/memory/session.py +47 -0
- package/dist/assets/templates/export-harness-python/model/load.py +249 -0
- package/dist/assets/templates/export-harness-python/model/mantle_compat.py +21 -0
- package/dist/assets/templates/export-harness-python/pyproject.toml +22 -0
- package/dist/assets/templates/export-harness-python/skills/fetcher.py +279 -0
- package/dist/assets/templates/mcp-python-fastmcp/README.md +32 -0
- package/dist/assets/templates/mcp-python-fastmcp/gitignore.template +41 -0
- package/dist/assets/templates/mcp-python-fastmcp/main.py +83 -0
- package/dist/assets/{python/mcp/standalone/base → templates/mcp-python-fastmcp}/pyproject.toml +3 -2
- package/dist/assets/templates/shared/env.local.template +11 -0
- package/dist/assets/templates/shared/gitignore.template +19 -0
- package/dist/index.js +4 -27
- package/dist/main.js +1190 -0
- package/package.json +75 -149
- package/LICENSE +0 -175
- package/dist/agent-inspector/index.css +0 -1
- package/dist/agent-inspector/index.js +0 -279
- package/dist/assets/README.md +0 -104
- package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +0 -5673
- package/dist/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap +0 -77
- package/dist/assets/__tests__/assets.snapshot.test.ts +0 -125
- package/dist/assets/__tests__/dockerfile-render.test.ts +0 -24
- package/dist/assets/agents/AGENTS.md +0 -141
- package/dist/assets/harness/invoke.py.template +0 -74
- package/dist/assets/mcp/python/README.md +0 -27
- package/dist/assets/mcp/python/pyproject.toml +0 -22
- package/dist/assets/mcp/python/server.py +0 -117
- package/dist/assets/mcp/python-lambda/README.md +0 -22
- package/dist/assets/mcp/python-lambda/handler.py +0 -144
- package/dist/assets/mcp/python-lambda/pyproject.toml +0 -15
- package/dist/assets/python/a2a/googleadk/base/README.md +0 -22
- package/dist/assets/python/a2a/googleadk/base/main.py +0 -110
- package/dist/assets/python/a2a/googleadk/base/model/load.py +0 -41
- package/dist/assets/python/a2a/googleadk/base/pyproject.toml +0 -20
- package/dist/assets/python/a2a/langchain_langgraph/base/README.md +0 -22
- package/dist/assets/python/a2a/langchain_langgraph/base/main.py +0 -130
- package/dist/assets/python/a2a/langchain_langgraph/base/model/load.py +0 -123
- package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +0 -25
- package/dist/assets/python/a2a/strands/base/README.md +0 -22
- package/dist/assets/python/a2a/strands/base/main.py +0 -107
- package/dist/assets/python/a2a/strands/base/model/load.py +0 -123
- package/dist/assets/python/a2a/strands/base/pyproject.toml +0 -23
- package/dist/assets/python/a2a/strands/capabilities/memory/session.py +0 -43
- package/dist/assets/python/agui/googleadk/base/README.md +0 -30
- package/dist/assets/python/agui/googleadk/base/gitignore.template +0 -41
- package/dist/assets/python/agui/googleadk/base/main.py +0 -31
- package/dist/assets/python/agui/googleadk/base/model/load.py +0 -41
- package/dist/assets/python/agui/googleadk/base/pyproject.toml +0 -24
- package/dist/assets/python/agui/langchain_langgraph/base/README.md +0 -22
- package/dist/assets/python/agui/langchain_langgraph/base/gitignore.template +0 -41
- package/dist/assets/python/agui/langchain_langgraph/base/main.py +0 -74
- package/dist/assets/python/agui/langchain_langgraph/base/model/load.py +0 -123
- package/dist/assets/python/agui/langchain_langgraph/base/pyproject.toml +0 -30
- package/dist/assets/python/agui/strands/base/README.md +0 -22
- package/dist/assets/python/agui/strands/base/gitignore.template +0 -41
- package/dist/assets/python/agui/strands/base/model/__init__.py +0 -1
- package/dist/assets/python/agui/strands/base/model/load.py +0 -123
- package/dist/assets/python/agui/strands/base/pyproject.toml +0 -27
- package/dist/assets/python/agui/strands/capabilities/memory/__init__.py +0 -1
- package/dist/assets/python/agui/strands/capabilities/memory/session.py +0 -43
- package/dist/assets/python/http/autogen/base/README.md +0 -39
- package/dist/assets/python/http/autogen/base/gitignore.template +0 -41
- package/dist/assets/python/http/autogen/base/main.py +0 -112
- package/dist/assets/python/http/autogen/base/mcp_client/__init__.py +0 -1
- package/dist/assets/python/http/autogen/base/mcp_client/client.py +0 -28
- package/dist/assets/python/http/autogen/base/model/__init__.py +0 -1
- package/dist/assets/python/http/autogen/base/model/load.py +0 -136
- package/dist/assets/python/http/autogen/base/pyproject.toml +0 -34
- package/dist/assets/python/http/googleadk/base/README.md +0 -39
- package/dist/assets/python/http/googleadk/base/gitignore.template +0 -41
- package/dist/assets/python/http/googleadk/base/main.py +0 -160
- package/dist/assets/python/http/googleadk/base/mcp_client/__init__.py +0 -1
- package/dist/assets/python/http/googleadk/base/mcp_client/client.py +0 -75
- package/dist/assets/python/http/googleadk/base/model/__init__.py +0 -1
- package/dist/assets/python/http/googleadk/base/model/load.py +0 -41
- package/dist/assets/python/http/googleadk/base/pyproject.toml +0 -22
- package/dist/assets/python/http/langchain_langgraph/base/README.md +0 -39
- package/dist/assets/python/http/langchain_langgraph/base/gitignore.template +0 -41
- package/dist/assets/python/http/langchain_langgraph/base/main.py +0 -176
- package/dist/assets/python/http/langchain_langgraph/base/mcp_client/__init__.py +0 -1
- package/dist/assets/python/http/langchain_langgraph/base/mcp_client/client.py +0 -77
- package/dist/assets/python/http/langchain_langgraph/base/model/__init__.py +0 -1
- package/dist/assets/python/http/langchain_langgraph/base/model/load.py +0 -123
- package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +0 -37
- package/dist/assets/python/http/openaiagents/base/README.md +0 -39
- package/dist/assets/python/http/openaiagents/base/gitignore.template +0 -41
- package/dist/assets/python/http/openaiagents/base/main.py +0 -169
- package/dist/assets/python/http/openaiagents/base/mcp_client/__init__.py +0 -1
- package/dist/assets/python/http/openaiagents/base/mcp_client/client.py +0 -74
- package/dist/assets/python/http/openaiagents/base/model/__init__.py +0 -1
- package/dist/assets/python/http/openaiagents/base/model/load.py +0 -37
- package/dist/assets/python/http/openaiagents/base/pyproject.toml +0 -21
- package/dist/assets/python/http/strands/base/main.py +0 -217
- package/dist/assets/python/http/strands/base/mcp_client/__init__.py +0 -1
- package/dist/assets/python/http/strands/base/mcp_client/client.py +0 -73
- package/dist/assets/python/http/strands/base/model/__init__.py +0 -1
- package/dist/assets/python/http/strands/base/pyproject.toml +0 -25
- package/dist/assets/python/http/strands/capabilities/memory/__init__.py +0 -1
- package/dist/assets/python/http/strands/capabilities/memory/session.py +0 -44
- package/dist/assets/python/mcp/standalone/base/README.md +0 -36
- package/dist/assets/python/mcp/standalone/base/gitignore.template +0 -41
- package/dist/assets/python/mcp/standalone/base/main.py +0 -25
- package/dist/cli/index.mjs +0 -1718
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/constants.d.ts +0 -37
- package/dist/lib/constants.d.ts.map +0 -1
- package/dist/lib/constants.js +0 -69
- package/dist/lib/constants.js.map +0 -1
- package/dist/lib/errors/config.d.ts +0 -49
- package/dist/lib/errors/config.d.ts.map +0 -1
- package/dist/lib/errors/config.js +0 -170
- package/dist/lib/errors/config.js.map +0 -1
- package/dist/lib/errors/index.d.ts +0 -2
- package/dist/lib/errors/index.d.ts.map +0 -1
- package/dist/lib/errors/index.js +0 -18
- package/dist/lib/errors/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/index.js +0 -44
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/packaging/build-args.d.ts +0 -6
- package/dist/lib/packaging/build-args.d.ts.map +0 -1
- package/dist/lib/packaging/build-args.js +0 -18
- package/dist/lib/packaging/build-args.js.map +0 -1
- package/dist/lib/packaging/container.d.ts +0 -10
- package/dist/lib/packaging/container.d.ts.map +0 -1
- package/dist/lib/packaging/container.js +0 -78
- package/dist/lib/packaging/container.js.map +0 -1
- package/dist/lib/packaging/errors.d.ts +0 -16
- package/dist/lib/packaging/errors.d.ts.map +0 -1
- package/dist/lib/packaging/errors.js +0 -36
- package/dist/lib/packaging/errors.js.map +0 -1
- package/dist/lib/packaging/helpers.d.ts +0 -54
- package/dist/lib/packaging/helpers.d.ts.map +0 -1
- package/dist/lib/packaging/helpers.js +0 -463
- package/dist/lib/packaging/helpers.js.map +0 -1
- package/dist/lib/packaging/index.d.ts +0 -40
- package/dist/lib/packaging/index.d.ts.map +0 -1
- package/dist/lib/packaging/index.js +0 -98
- package/dist/lib/packaging/index.js.map +0 -1
- package/dist/lib/packaging/node.d.ts +0 -22
- package/dist/lib/packaging/node.d.ts.map +0 -1
- package/dist/lib/packaging/node.js +0 -109
- package/dist/lib/packaging/node.js.map +0 -1
- package/dist/lib/packaging/python.d.ts +0 -23
- package/dist/lib/packaging/python.d.ts.map +0 -1
- package/dist/lib/packaging/python.js +0 -165
- package/dist/lib/packaging/python.js.map +0 -1
- package/dist/lib/packaging/types/index.d.ts +0 -2
- package/dist/lib/packaging/types/index.d.ts.map +0 -1
- package/dist/lib/packaging/types/index.js +0 -3
- package/dist/lib/packaging/types/index.js.map +0 -1
- package/dist/lib/packaging/types/packaging.d.ts +0 -57
- package/dist/lib/packaging/types/packaging.d.ts.map +0 -1
- package/dist/lib/packaging/types/packaging.js +0 -3
- package/dist/lib/packaging/types/packaging.js.map +0 -1
- package/dist/lib/packaging/uv.d.ts +0 -7
- package/dist/lib/packaging/uv.d.ts.map +0 -1
- package/dist/lib/packaging/uv.js +0 -40
- package/dist/lib/packaging/uv.js.map +0 -1
- package/dist/lib/schemas/io/config-io.d.ts +0 -119
- package/dist/lib/schemas/io/config-io.d.ts.map +0 -1
- package/dist/lib/schemas/io/config-io.js +0 -323
- package/dist/lib/schemas/io/config-io.js.map +0 -1
- package/dist/lib/schemas/io/global-config.d.ts +0 -33
- package/dist/lib/schemas/io/global-config.d.ts.map +0 -1
- package/dist/lib/schemas/io/global-config.js +0 -89
- package/dist/lib/schemas/io/global-config.js.map +0 -1
- package/dist/lib/schemas/io/index.d.ts +0 -3
- package/dist/lib/schemas/io/index.d.ts.map +0 -1
- package/dist/lib/schemas/io/index.js +0 -18
- package/dist/lib/schemas/io/index.js.map +0 -1
- package/dist/lib/schemas/io/path-resolver.d.ts +0 -119
- package/dist/lib/schemas/io/path-resolver.d.ts.map +0 -1
- package/dist/lib/schemas/io/path-resolver.js +0 -207
- package/dist/lib/schemas/io/path-resolver.js.map +0 -1
- package/dist/lib/utils/aws-account.d.ts +0 -7
- package/dist/lib/utils/aws-account.d.ts.map +0 -1
- package/dist/lib/utils/aws-account.js +0 -24
- package/dist/lib/utils/aws-account.js.map +0 -1
- package/dist/lib/utils/credentials.d.ts +0 -86
- package/dist/lib/utils/credentials.d.ts.map +0 -1
- package/dist/lib/utils/credentials.js +0 -153
- package/dist/lib/utils/credentials.js.map +0 -1
- package/dist/lib/utils/env.d.ts +0 -22
- package/dist/lib/utils/env.d.ts.map +0 -1
- package/dist/lib/utils/env.js +0 -65
- package/dist/lib/utils/env.js.map +0 -1
- package/dist/lib/utils/index.d.ts +0 -9
- package/dist/lib/utils/index.d.ts.map +0 -1
- package/dist/lib/utils/index.js +0 -27
- package/dist/lib/utils/index.js.map +0 -1
- package/dist/lib/utils/json-rpc.d.ts +0 -3
- package/dist/lib/utils/json-rpc.d.ts.map +0 -1
- package/dist/lib/utils/json-rpc.js +0 -27
- package/dist/lib/utils/json-rpc.js.map +0 -1
- package/dist/lib/utils/platform.d.ts +0 -63
- package/dist/lib/utils/platform.d.ts.map +0 -1
- package/dist/lib/utils/platform.js +0 -88
- package/dist/lib/utils/platform.js.map +0 -1
- package/dist/lib/utils/subprocess.d.ts +0 -29
- package/dist/lib/utils/subprocess.d.ts.map +0 -1
- package/dist/lib/utils/subprocess.js +0 -116
- package/dist/lib/utils/subprocess.js.map +0 -1
- package/dist/lib/utils/time-parser.d.ts +0 -11
- package/dist/lib/utils/time-parser.d.ts.map +0 -1
- package/dist/lib/utils/time-parser.js +0 -47
- package/dist/lib/utils/time-parser.js.map +0 -1
- package/dist/lib/utils/zod.d.ts +0 -14
- package/dist/lib/utils/zod.d.ts.map +0 -1
- package/dist/lib/utils/zod.js +0 -32
- package/dist/lib/utils/zod.js.map +0 -1
- package/dist/schema/constants.d.ts +0 -119
- package/dist/schema/constants.d.ts.map +0 -1
- package/dist/schema/constants.js +0 -170
- package/dist/schema/constants.js.map +0 -1
- package/dist/schema/index.d.ts +0 -4
- package/dist/schema/index.d.ts.map +0 -1
- package/dist/schema/index.js +0 -21
- package/dist/schema/index.js.map +0 -1
- package/dist/schema/schemas/agent-env.d.ts +0 -186
- package/dist/schema/schemas/agent-env.d.ts.map +0 -1
- package/dist/schema/schemas/agent-env.js +0 -240
- package/dist/schema/schemas/agent-env.js.map +0 -1
- package/dist/schema/schemas/agentcore-project.d.ts +0 -838
- package/dist/schema/schemas/agentcore-project.d.ts.map +0 -1
- package/dist/schema/schemas/agentcore-project.js +0 -335
- package/dist/schema/schemas/agentcore-project.js.map +0 -1
- package/dist/schema/schemas/auth.d.ts +0 -140
- package/dist/schema/schemas/auth.d.ts.map +0 -1
- package/dist/schema/schemas/auth.js +0 -114
- package/dist/schema/schemas/auth.js.map +0 -1
- package/dist/schema/schemas/aws-targets.d.ts +0 -71
- package/dist/schema/schemas/aws-targets.d.ts.map +0 -1
- package/dist/schema/schemas/aws-targets.js +0 -57
- package/dist/schema/schemas/aws-targets.js.map +0 -1
- package/dist/schema/schemas/deployed-state.d.ts +0 -725
- package/dist/schema/schemas/deployed-state.d.ts.map +0 -1
- package/dist/schema/schemas/deployed-state.js +0 -218
- package/dist/schema/schemas/deployed-state.js.map +0 -1
- package/dist/schema/schemas/index.d.ts +0 -9
- package/dist/schema/schemas/index.d.ts.map +0 -1
- package/dist/schema/schemas/index.js +0 -26
- package/dist/schema/schemas/index.js.map +0 -1
- package/dist/schema/schemas/mcp-defs.d.ts +0 -52
- package/dist/schema/schemas/mcp-defs.d.ts.map +0 -1
- package/dist/schema/schemas/mcp-defs.js +0 -50
- package/dist/schema/schemas/mcp-defs.js.map +0 -1
- package/dist/schema/schemas/mcp.d.ts +0 -820
- package/dist/schema/schemas/mcp.d.ts.map +0 -1
- package/dist/schema/schemas/mcp.js +0 -564
- package/dist/schema/schemas/mcp.js.map +0 -1
- package/dist/schema/schemas/primitives/ab-test.d.ts +0 -141
- package/dist/schema/schemas/primitives/ab-test.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/ab-test.js +0 -97
- package/dist/schema/schemas/primitives/ab-test.js.map +0 -1
- package/dist/schema/schemas/primitives/config-bundle.d.ts +0 -31
- package/dist/schema/schemas/primitives/config-bundle.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/config-bundle.js +0 -38
- package/dist/schema/schemas/primitives/config-bundle.js.map +0 -1
- package/dist/schema/schemas/primitives/evaluator.d.ts +0 -102
- package/dist/schema/schemas/primitives/evaluator.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/evaluator.js +0 -84
- package/dist/schema/schemas/primitives/evaluator.js.map +0 -1
- package/dist/schema/schemas/primitives/harness.d.ts +0 -363
- package/dist/schema/schemas/primitives/harness.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/harness.js +0 -261
- package/dist/schema/schemas/primitives/harness.js.map +0 -1
- package/dist/schema/schemas/primitives/http-gateway.d.ts +0 -21
- package/dist/schema/schemas/primitives/http-gateway.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/http-gateway.js +0 -34
- package/dist/schema/schemas/primitives/http-gateway.js.map +0 -1
- package/dist/schema/schemas/primitives/index.d.ts +0 -15
- package/dist/schema/schemas/primitives/index.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/index.js +0 -61
- package/dist/schema/schemas/primitives/index.js.map +0 -1
- package/dist/schema/schemas/primitives/memory.d.ts +0 -51
- package/dist/schema/schemas/primitives/memory.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/memory.js +0 -73
- package/dist/schema/schemas/primitives/memory.js.map +0 -1
- package/dist/schema/schemas/primitives/online-eval-config.d.ts +0 -14
- package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/online-eval-config.js +0 -30
- package/dist/schema/schemas/primitives/online-eval-config.js.map +0 -1
- package/dist/schema/schemas/primitives/policy.d.ts +0 -49
- package/dist/schema/schemas/primitives/policy.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/policy.js +0 -62
- package/dist/schema/schemas/primitives/policy.js.map +0 -1
- package/dist/schema/schemas/primitives/tags.d.ts +0 -6
- package/dist/schema/schemas/primitives/tags.d.ts.map +0 -1
- package/dist/schema/schemas/primitives/tags.js +0 -27
- package/dist/schema/schemas/primitives/tags.js.map +0 -1
- package/dist/schema/schemas/zod-util.d.ts +0 -10
- package/dist/schema/schemas/zod-util.d.ts.map +0 -1
- package/dist/schema/schemas/zod-util.js +0 -23
- package/dist/schema/schemas/zod-util.js.map +0 -1
- package/dist/schema/types/index.d.ts +0 -2
- package/dist/schema/types/index.d.ts.map +0 -1
- package/dist/schema/types/index.js +0 -18
- package/dist/schema/types/index.js.map +0 -1
- package/dist/schema/types/path.d.ts +0 -27
- package/dist/schema/types/path.d.ts.map +0 -1
- package/dist/schema/types/path.js +0 -13
- package/dist/schema/types/path.js.map +0 -1
- package/scripts/bump-version.ts +0 -393
- package/scripts/bundle.mjs +0 -219
- package/scripts/check-old-cli.lib.mjs +0 -102
- package/scripts/check-old-cli.mjs +0 -10
- package/scripts/copy-assets.mjs +0 -64
- package/scripts/generate-schema.mjs +0 -40
- package/scripts/run-e2e-local.sh +0 -112
- package/scripts/start-tui-harness.sh +0 -90
- /package/dist/{agent-inspector/favicon.svg → assets/agent-inspector/favicon.svg.asset} +0 -0
- /package/dist/{agent-inspector/index.html → assets/agent-inspector/index.html.asset} +0 -0
- /package/dist/assets/{python/http/strands/base → templates/a2a-python-strands}/gitignore.template +0 -0
- /package/dist/assets/{typescript/.gitkeep → templates/a2a-python-strands/memory/__init__.py} +0 -0
- /package/dist/assets/{python/a2a/googleadk/base → templates/a2a-python-strands}/model/__init__.py +0 -0
- /package/dist/assets/{python/a2a/langchain_langgraph/base → templates/agent-python-langchain}/model/__init__.py +0 -0
- /package/dist/assets/{container/python → templates/agent-python-strands}/dockerignore.template +0 -0
- /package/dist/assets/{python/a2a/strands/base → templates/agent-python-strands}/model/__init__.py +0 -0
- /package/dist/assets/{python/a2a/strands/capabilities/memory → templates/agui-python-strands/model}/__init__.py +0 -0
- /package/dist/assets/{python/agui/googleadk/base/model → templates/export-harness-python/mcp_client}/__init__.py +0 -0
- /package/dist/assets/{python/agui/langchain_langgraph/base → templates/export-harness-python}/model/__init__.py +0 -0
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import logging
|
|
3
|
-
from agents.mcp import MCPServerStreamableHttp
|
|
4
|
-
|
|
5
|
-
logger = logging.getLogger(__name__)
|
|
6
|
-
|
|
7
|
-
{{#if hasGateway}}
|
|
8
|
-
{{#if (includes gatewayAuthTypes "AWS_IAM")}}
|
|
9
|
-
import httpx
|
|
10
|
-
from mcp_proxy_for_aws.sigv4_helper import SigV4HTTPXAuth, create_aws_session
|
|
11
|
-
{{/if}}
|
|
12
|
-
{{#if (includes gatewayAuthTypes "CUSTOM_JWT")}}
|
|
13
|
-
from bedrock_agentcore.identity import requires_access_token
|
|
14
|
-
{{/if}}
|
|
15
|
-
|
|
16
|
-
{{#each gatewayProviders}}
|
|
17
|
-
{{#if (eq authType "CUSTOM_JWT")}}
|
|
18
|
-
@requires_access_token(
|
|
19
|
-
provider_name="{{credentialProviderName}}",
|
|
20
|
-
scopes=[{{#if scopes}}"{{scopes}}"{{/if}}],
|
|
21
|
-
auth_flow="M2M",
|
|
22
|
-
)
|
|
23
|
-
def _get_bearer_token_{{snakeCase name}}(*, access_token: str):
|
|
24
|
-
"""Obtain OAuth access token via AgentCore Identity for {{name}}."""
|
|
25
|
-
return access_token
|
|
26
|
-
|
|
27
|
-
{{/if}}
|
|
28
|
-
{{/each}}
|
|
29
|
-
|
|
30
|
-
def get_all_gateway_mcp_servers() -> list[MCPServerStreamableHttp]:
|
|
31
|
-
"""Returns MCP servers for all configured gateways."""
|
|
32
|
-
servers = []
|
|
33
|
-
{{#each gatewayProviders}}
|
|
34
|
-
url = os.environ.get("{{envVarName}}")
|
|
35
|
-
if url:
|
|
36
|
-
{{#if (eq authType "AWS_IAM")}}
|
|
37
|
-
session = create_aws_session()
|
|
38
|
-
auth = SigV4HTTPXAuth(session.get_credentials(), "bedrock-agentcore", session.region_name)
|
|
39
|
-
servers.append(MCPServerStreamableHttp(
|
|
40
|
-
name="{{name}}",
|
|
41
|
-
params={"url": url, "httpx_client_factory": lambda **kwargs: httpx.AsyncClient(auth=auth, **kwargs)}
|
|
42
|
-
))
|
|
43
|
-
{{else if (eq authType "CUSTOM_JWT")}}
|
|
44
|
-
token = _get_bearer_token_{{snakeCase name}}()
|
|
45
|
-
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
|
46
|
-
servers.append(MCPServerStreamableHttp(name="{{name}}", params={"url": url, "headers": headers}))
|
|
47
|
-
{{else}}
|
|
48
|
-
servers.append(MCPServerStreamableHttp(name="{{name}}", params={"url": url}))
|
|
49
|
-
{{/if}}
|
|
50
|
-
else:
|
|
51
|
-
logger.warning("{{envVarName}} not set — {{name}} gateway tools unavailable")
|
|
52
|
-
{{/each}}
|
|
53
|
-
return servers
|
|
54
|
-
{{else}}
|
|
55
|
-
{{#if isVpc}}
|
|
56
|
-
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
57
|
-
# Add an AgentCore Gateway with `agentcore add gateway`, or configure your own endpoint below.
|
|
58
|
-
|
|
59
|
-
def get_streamable_http_mcp_client() -> MCPServerStreamableHttp | None:
|
|
60
|
-
"""No MCP server configured. Add a gateway with `agentcore add gateway`."""
|
|
61
|
-
return None
|
|
62
|
-
{{else}}
|
|
63
|
-
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
64
|
-
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def get_streamable_http_mcp_client() -> MCPServerStreamableHttp:
|
|
68
|
-
"""Returns an MCP Client compatible with OpenAI Agents SDK."""
|
|
69
|
-
# to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
|
|
70
|
-
return MCPServerStreamableHttp(
|
|
71
|
-
name="AgentCore Gateway MCP", params={"url": EXAMPLE_MCP_ENDPOINT}
|
|
72
|
-
)
|
|
73
|
-
{{/if}}
|
|
74
|
-
{{/if}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Package marker
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
from bedrock_agentcore.identity.auth import requires_api_key
|
|
3
|
-
|
|
4
|
-
IDENTITY_PROVIDER_NAME = "{{identityProviders.[0].name}}"
|
|
5
|
-
IDENTITY_ENV_VAR = "{{identityProviders.[0].envVarName}}"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@requires_api_key(provider_name=IDENTITY_PROVIDER_NAME)
|
|
9
|
-
def _agentcore_identity_api_key_provider(api_key: str) -> str:
|
|
10
|
-
"""Fetch API key from AgentCore Identity."""
|
|
11
|
-
return api_key
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _get_api_key() -> str:
|
|
15
|
-
"""
|
|
16
|
-
Uses AgentCore Identity for API key management in deployed environments.
|
|
17
|
-
For local development, run via 'agentcore dev' which loads agentcore/.env.
|
|
18
|
-
"""
|
|
19
|
-
if os.getenv("LOCAL_DEV") == "1":
|
|
20
|
-
api_key = os.getenv(IDENTITY_ENV_VAR)
|
|
21
|
-
if not api_key:
|
|
22
|
-
raise RuntimeError(
|
|
23
|
-
f"{IDENTITY_ENV_VAR} not found. Add {IDENTITY_ENV_VAR}=your-key to .env.local"
|
|
24
|
-
)
|
|
25
|
-
return api_key
|
|
26
|
-
return _agentcore_identity_api_key_provider()
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def load_model() -> None:
|
|
30
|
-
"""
|
|
31
|
-
Set up OpenAI API key authentication.
|
|
32
|
-
Uses AgentCore Identity for API key management in deployed environments,
|
|
33
|
-
and falls back to .env file for local development.
|
|
34
|
-
Sets the OPENAI_API_KEY environment variable for the OpenAI Agents SDK.
|
|
35
|
-
"""
|
|
36
|
-
api_key = _get_api_key()
|
|
37
|
-
os.environ["OPENAI_API_KEY"] = api_key if api_key else ""
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "{{ name }}"
|
|
7
|
-
version = "0.1.0"
|
|
8
|
-
description = "AgentCore Runtime Application using OpenAI Agents SDK"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
11
|
-
dependencies = [
|
|
12
|
-
"aws-opentelemetry-distro",
|
|
13
|
-
"openai-agents >= 0.4.2",
|
|
14
|
-
"bedrock-agentcore >= 1.0.3",
|
|
15
|
-
"botocore[crt] >= 1.35.0",
|
|
16
|
-
{{#if hasGateway}}{{#if (includes gatewayAuthTypes "AWS_IAM")}}"mcp-proxy-for-aws >= 1.1.0",
|
|
17
|
-
{{/if}}{{/if}}
|
|
18
|
-
]
|
|
19
|
-
|
|
20
|
-
[tool.hatch.build.targets.wheel]
|
|
21
|
-
packages = ["."]
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
from typing import Any
|
|
2
|
-
|
|
3
|
-
from strands import Agent, tool
|
|
4
|
-
{{#if hasConfigBundle}}
|
|
5
|
-
from strands.hooks import HookProvider, HookRegistry, BeforeInvocationEvent, BeforeToolCallEvent
|
|
6
|
-
from bedrock_agentcore.runtime.context import BedrockAgentCoreContext
|
|
7
|
-
{{/if}}
|
|
8
|
-
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
9
|
-
from model.load import load_model
|
|
10
|
-
{{#if hasGateway}}
|
|
11
|
-
from mcp_client.client import get_all_gateway_mcp_clients
|
|
12
|
-
{{else}}
|
|
13
|
-
from mcp_client.client import get_streamable_http_mcp_client
|
|
14
|
-
{{/if}}
|
|
15
|
-
{{#if hasMemory}}
|
|
16
|
-
from memory.session import get_memory_session_manager
|
|
17
|
-
{{/if}}
|
|
18
|
-
{{#if sessionStorageMountPath}}
|
|
19
|
-
import os
|
|
20
|
-
{{/if}}
|
|
21
|
-
|
|
22
|
-
app = BedrockAgentCoreApp()
|
|
23
|
-
log = app.logger
|
|
24
|
-
|
|
25
|
-
# Define a Streamable HTTP MCP Client
|
|
26
|
-
{{#if hasGateway}}
|
|
27
|
-
mcp_clients = get_all_gateway_mcp_clients()
|
|
28
|
-
{{else}}
|
|
29
|
-
mcp_clients = [get_streamable_http_mcp_client()]
|
|
30
|
-
{{/if}}
|
|
31
|
-
|
|
32
|
-
DEFAULT_SYSTEM_PROMPT = """
|
|
33
|
-
You are a helpful assistant. Use tools when appropriate.
|
|
34
|
-
{{#if sessionStorageMountPath}}
|
|
35
|
-
You have persistent storage at {{sessionStorageMountPath}}. Use file tools to read and write files. Data persists across sessions.
|
|
36
|
-
{{/if}}
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
{{#if hasConfigBundle}}
|
|
40
|
-
DEFAULT_TOOL_DESC = "Return the sum of two numbers"
|
|
41
|
-
{{/if}}
|
|
42
|
-
|
|
43
|
-
# Define a collection of tools used by the model
|
|
44
|
-
tools = []
|
|
45
|
-
|
|
46
|
-
# Define a simple function tool
|
|
47
|
-
{{#if hasConfigBundle}}
|
|
48
|
-
@tool(description=DEFAULT_TOOL_DESC)
|
|
49
|
-
{{else}}
|
|
50
|
-
@tool
|
|
51
|
-
{{/if}}
|
|
52
|
-
def add_numbers(a: int, b: int) -> int:
|
|
53
|
-
"""Return the sum of two numbers"""
|
|
54
|
-
return a+b
|
|
55
|
-
tools.append(add_numbers)
|
|
56
|
-
|
|
57
|
-
{{#if sessionStorageMountPath}}
|
|
58
|
-
SESSION_STORAGE_PATH = "{{sessionStorageMountPath}}"
|
|
59
|
-
|
|
60
|
-
def _safe_resolve(path: str) -> str:
|
|
61
|
-
"""Resolve path safely within the storage boundary."""
|
|
62
|
-
resolved = os.path.realpath(os.path.join(SESSION_STORAGE_PATH, path.lstrip("/")))
|
|
63
|
-
if not resolved.startswith(os.path.realpath(SESSION_STORAGE_PATH)):
|
|
64
|
-
raise ValueError(f"Path '{path}' is outside the storage boundary")
|
|
65
|
-
return resolved
|
|
66
|
-
|
|
67
|
-
@tool
|
|
68
|
-
def file_read(path: str) -> str:
|
|
69
|
-
"""Read a file from persistent storage. The path is relative to the storage root."""
|
|
70
|
-
try:
|
|
71
|
-
full_path = _safe_resolve(path)
|
|
72
|
-
with open(full_path) as f:
|
|
73
|
-
return f.read()
|
|
74
|
-
except ValueError as e:
|
|
75
|
-
return str(e)
|
|
76
|
-
except OSError as e:
|
|
77
|
-
return f"Error reading '{path}': {e.strerror}"
|
|
78
|
-
|
|
79
|
-
@tool
|
|
80
|
-
def file_write(path: str, content: str) -> str:
|
|
81
|
-
"""Write content to a file in persistent storage. The path is relative to the storage root."""
|
|
82
|
-
try:
|
|
83
|
-
full_path = _safe_resolve(path)
|
|
84
|
-
parent = os.path.dirname(full_path)
|
|
85
|
-
if parent:
|
|
86
|
-
os.makedirs(parent, exist_ok=True)
|
|
87
|
-
with open(full_path, "w") as f:
|
|
88
|
-
f.write(content)
|
|
89
|
-
return f"Written to {path}"
|
|
90
|
-
except ValueError as e:
|
|
91
|
-
return str(e)
|
|
92
|
-
except OSError as e:
|
|
93
|
-
return f"Error writing '{path}': {e.strerror}"
|
|
94
|
-
|
|
95
|
-
@tool
|
|
96
|
-
def list_files(directory: str = "") -> str:
|
|
97
|
-
"""List files in persistent storage. The directory is relative to the storage root."""
|
|
98
|
-
try:
|
|
99
|
-
target = _safe_resolve(directory)
|
|
100
|
-
entries = os.listdir(target)
|
|
101
|
-
return "\n".join(entries) if entries else "(empty directory)"
|
|
102
|
-
except ValueError as e:
|
|
103
|
-
return str(e)
|
|
104
|
-
except OSError as e:
|
|
105
|
-
return f"Error listing '{directory}': {e.strerror}"
|
|
106
|
-
|
|
107
|
-
tools.extend([file_read, file_write, list_files])
|
|
108
|
-
{{/if}}
|
|
109
|
-
|
|
110
|
-
# Add MCP client to tools if available
|
|
111
|
-
for mcp_client in mcp_clients:
|
|
112
|
-
if mcp_client:
|
|
113
|
-
tools.append(mcp_client)
|
|
114
|
-
|
|
115
|
-
{{#if hasConfigBundle}}
|
|
116
|
-
|
|
117
|
-
class ConfigBundleHook(HookProvider):
|
|
118
|
-
"""Injects config bundle values (system prompt, tool descriptions) before each invocation.
|
|
119
|
-
|
|
120
|
-
BedrockAgentCoreContext.get_config_bundle() fetches the component configuration
|
|
121
|
-
for the current runtime ARN from the config bundle service. The SDK caches the
|
|
122
|
-
result and refreshes on bundle version changes.
|
|
123
|
-
"""
|
|
124
|
-
|
|
125
|
-
def register_hooks(self, registry: HookRegistry, **kwargs: Any) -> None:
|
|
126
|
-
registry.add_callback(BeforeInvocationEvent, self._inject_system_prompt)
|
|
127
|
-
registry.add_callback(BeforeToolCallEvent, self._override_tool_desc)
|
|
128
|
-
|
|
129
|
-
def _inject_system_prompt(self, event: BeforeInvocationEvent) -> None:
|
|
130
|
-
config = BedrockAgentCoreContext.get_config_bundle()
|
|
131
|
-
prompt = config.get("systemPrompt", DEFAULT_SYSTEM_PROMPT)
|
|
132
|
-
|
|
133
|
-
if prompt != event.agent.system_prompt:
|
|
134
|
-
event.agent.system_prompt = prompt
|
|
135
|
-
|
|
136
|
-
def _override_tool_desc(self, event: BeforeToolCallEvent) -> None:
|
|
137
|
-
config = BedrockAgentCoreContext.get_config_bundle()
|
|
138
|
-
tool_descs = config.get("toolDescriptions", {})
|
|
139
|
-
|
|
140
|
-
tool_name = event.tool_use["name"]
|
|
141
|
-
override = tool_descs.get(tool_name)
|
|
142
|
-
if override and event.selected_tool:
|
|
143
|
-
spec = event.selected_tool.tool_spec
|
|
144
|
-
if spec and "description" in spec:
|
|
145
|
-
spec["description"] = override
|
|
146
|
-
|
|
147
|
-
{{/if}}
|
|
148
|
-
|
|
149
|
-
{{#if hasMemory}}
|
|
150
|
-
def agent_factory():
|
|
151
|
-
cache = {}
|
|
152
|
-
def get_or_create_agent(session_id, user_id):
|
|
153
|
-
key = f"{session_id}/{user_id}"
|
|
154
|
-
if key not in cache:
|
|
155
|
-
# Create an agent for the given session_id and user_id
|
|
156
|
-
cache[key] = Agent(
|
|
157
|
-
model=load_model(),
|
|
158
|
-
session_manager=get_memory_session_manager(session_id, user_id),
|
|
159
|
-
system_prompt=DEFAULT_SYSTEM_PROMPT,
|
|
160
|
-
tools=tools{{#if hasConfigBundle}},
|
|
161
|
-
hooks=[ConfigBundleHook()]{{/if}}
|
|
162
|
-
)
|
|
163
|
-
return cache[key]
|
|
164
|
-
return get_or_create_agent
|
|
165
|
-
get_or_create_agent = agent_factory()
|
|
166
|
-
{{else}}
|
|
167
|
-
{{#if hasConfigBundle}}
|
|
168
|
-
def create_agent():
|
|
169
|
-
return Agent(
|
|
170
|
-
model=load_model(),
|
|
171
|
-
system_prompt=DEFAULT_SYSTEM_PROMPT,
|
|
172
|
-
tools=tools,
|
|
173
|
-
hooks=[ConfigBundleHook()],
|
|
174
|
-
)
|
|
175
|
-
{{else}}
|
|
176
|
-
_agent = None
|
|
177
|
-
|
|
178
|
-
def get_or_create_agent():
|
|
179
|
-
global _agent
|
|
180
|
-
if _agent is None:
|
|
181
|
-
_agent = Agent(
|
|
182
|
-
model=load_model(),
|
|
183
|
-
system_prompt=DEFAULT_SYSTEM_PROMPT,
|
|
184
|
-
tools=tools
|
|
185
|
-
)
|
|
186
|
-
return _agent
|
|
187
|
-
{{/if}}
|
|
188
|
-
{{/if}}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
@app.entrypoint
|
|
192
|
-
async def invoke(payload, context):
|
|
193
|
-
log.info("Invoking Agent.....")
|
|
194
|
-
|
|
195
|
-
{{#if hasMemory}}
|
|
196
|
-
session_id = getattr(context, 'session_id', 'default-session')
|
|
197
|
-
user_id = getattr(context, 'user_id', 'default-user')
|
|
198
|
-
agent = get_or_create_agent(session_id, user_id)
|
|
199
|
-
{{else}}
|
|
200
|
-
{{#if hasConfigBundle}}
|
|
201
|
-
agent = create_agent()
|
|
202
|
-
{{else}}
|
|
203
|
-
agent = get_or_create_agent()
|
|
204
|
-
{{/if}}
|
|
205
|
-
{{/if}}
|
|
206
|
-
|
|
207
|
-
# Execute and format response
|
|
208
|
-
stream = agent.stream_async(payload.get("prompt"))
|
|
209
|
-
|
|
210
|
-
async for event in stream:
|
|
211
|
-
# Handle Text parts of the response
|
|
212
|
-
if "data" in event and isinstance(event["data"], str):
|
|
213
|
-
yield event["data"]
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if __name__ == "__main__":
|
|
217
|
-
app.run()
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Package marker
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import logging
|
|
3
|
-
from mcp.client.streamable_http import streamablehttp_client
|
|
4
|
-
from strands.tools.mcp.mcp_client import MCPClient
|
|
5
|
-
|
|
6
|
-
logger = logging.getLogger(__name__)
|
|
7
|
-
|
|
8
|
-
{{#if hasGateway}}
|
|
9
|
-
{{#if (includes gatewayAuthTypes "AWS_IAM")}}
|
|
10
|
-
from mcp_proxy_for_aws.client import aws_iam_streamablehttp_client
|
|
11
|
-
{{/if}}
|
|
12
|
-
{{#if (includes gatewayAuthTypes "CUSTOM_JWT")}}
|
|
13
|
-
from bedrock_agentcore.identity import requires_access_token
|
|
14
|
-
{{/if}}
|
|
15
|
-
|
|
16
|
-
{{#each gatewayProviders}}
|
|
17
|
-
{{#if (eq authType "CUSTOM_JWT")}}
|
|
18
|
-
@requires_access_token(
|
|
19
|
-
provider_name="{{credentialProviderName}}",
|
|
20
|
-
scopes=[{{#if scopes}}"{{scopes}}"{{/if}}],
|
|
21
|
-
auth_flow="M2M",
|
|
22
|
-
)
|
|
23
|
-
def _get_bearer_token_{{snakeCase name}}(*, access_token: str):
|
|
24
|
-
"""Obtain OAuth access token via AgentCore Identity for {{name}}."""
|
|
25
|
-
return access_token
|
|
26
|
-
|
|
27
|
-
{{/if}}
|
|
28
|
-
{{/each}}
|
|
29
|
-
{{#each gatewayProviders}}
|
|
30
|
-
def get_{{snakeCase name}}_mcp_client() -> MCPClient | None:
|
|
31
|
-
"""Returns an MCP Client connected to the {{name}} gateway."""
|
|
32
|
-
url = os.environ.get("{{envVarName}}")
|
|
33
|
-
if not url:
|
|
34
|
-
logger.warning("{{envVarName}} not set — {{name}} gateway tools unavailable")
|
|
35
|
-
return None
|
|
36
|
-
{{#if (eq authType "AWS_IAM")}}
|
|
37
|
-
return MCPClient(lambda: aws_iam_streamablehttp_client(url, aws_service="bedrock-agentcore", aws_region=os.environ.get("AWS_REGION", os.environ.get("AWS_DEFAULT_REGION"))))
|
|
38
|
-
{{else if (eq authType "CUSTOM_JWT")}}
|
|
39
|
-
token = _get_bearer_token_{{snakeCase name}}()
|
|
40
|
-
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
|
41
|
-
return MCPClient(lambda: streamablehttp_client(url, headers=headers))
|
|
42
|
-
{{else}}
|
|
43
|
-
return MCPClient(lambda: streamablehttp_client(url))
|
|
44
|
-
{{/if}}
|
|
45
|
-
|
|
46
|
-
{{/each}}
|
|
47
|
-
def get_all_gateway_mcp_clients() -> list[MCPClient]:
|
|
48
|
-
"""Returns MCP clients for all configured gateways."""
|
|
49
|
-
clients = []
|
|
50
|
-
{{#each gatewayProviders}}
|
|
51
|
-
client = get_{{snakeCase name}}_mcp_client()
|
|
52
|
-
if client:
|
|
53
|
-
clients.append(client)
|
|
54
|
-
{{/each}}
|
|
55
|
-
return clients
|
|
56
|
-
{{else}}
|
|
57
|
-
{{#if isVpc}}
|
|
58
|
-
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
59
|
-
# Add an AgentCore Gateway with `agentcore add gateway`, or configure your own endpoint below.
|
|
60
|
-
|
|
61
|
-
def get_streamable_http_mcp_client() -> MCPClient | None:
|
|
62
|
-
"""No MCP server configured. Add a gateway with `agentcore add gateway`."""
|
|
63
|
-
return None
|
|
64
|
-
{{else}}
|
|
65
|
-
# ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
|
|
66
|
-
EXAMPLE_MCP_ENDPOINT = "https://mcp.exa.ai/mcp"
|
|
67
|
-
|
|
68
|
-
def get_streamable_http_mcp_client() -> MCPClient:
|
|
69
|
-
"""Returns an MCP Client compatible with Strands"""
|
|
70
|
-
# to use an MCP server that supports bearer authentication, add headers={"Authorization": f"Bearer {access_token}"}
|
|
71
|
-
return MCPClient(lambda: streamablehttp_client(EXAMPLE_MCP_ENDPOINT))
|
|
72
|
-
{{/if}}
|
|
73
|
-
{{/if}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Package marker
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
[build-system]
|
|
2
|
-
requires = ["hatchling"]
|
|
3
|
-
build-backend = "hatchling.build"
|
|
4
|
-
|
|
5
|
-
[project]
|
|
6
|
-
name = "{{ name }}"
|
|
7
|
-
version = "0.1.0"
|
|
8
|
-
description = "AgentCore Runtime Application using Strands SDK"
|
|
9
|
-
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.10"
|
|
11
|
-
dependencies = [
|
|
12
|
-
{{#if (eq modelProvider "Anthropic")}}"anthropic >= 0.30.0",
|
|
13
|
-
{{/if}}"aws-opentelemetry-distro",
|
|
14
|
-
"bedrock-agentcore >= 1.0.3",
|
|
15
|
-
"botocore[crt] >= 1.35.0",
|
|
16
|
-
{{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
|
|
17
|
-
{{/if}}"mcp >= 1.19.0",
|
|
18
|
-
{{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
|
|
19
|
-
{{/if}}"strands-agents >= 1.13.0",
|
|
20
|
-
{{#if hasGateway}}{{#if (includes gatewayAuthTypes "AWS_IAM")}}"mcp-proxy-for-aws >= 1.1.0",
|
|
21
|
-
{{/if}}{{/if}}
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
[tool.hatch.build.targets.wheel]
|
|
25
|
-
packages = ["."]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# Package marker
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import uuid
|
|
3
|
-
from typing import Optional
|
|
4
|
-
|
|
5
|
-
from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig{{#if memoryProviders.[0].strategies.length}}, RetrievalConfig{{/if}}
|
|
6
|
-
from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager
|
|
7
|
-
|
|
8
|
-
MEMORY_ID = os.getenv("{{memoryProviders.[0].envVarName}}")
|
|
9
|
-
REGION = os.getenv("AWS_REGION")
|
|
10
|
-
|
|
11
|
-
def get_memory_session_manager(session_id: Optional[str], actor_id: str) -> Optional[AgentCoreMemorySessionManager]:
|
|
12
|
-
if not MEMORY_ID:
|
|
13
|
-
return None
|
|
14
|
-
|
|
15
|
-
# AgentCoreMemoryConfig rejects None; OAuth/CUSTOM_JWT callers can reach us
|
|
16
|
-
# without a runtime session header, so synthesize one when absent.
|
|
17
|
-
session_id = session_id or uuid.uuid4().hex
|
|
18
|
-
|
|
19
|
-
{{#if memoryProviders.[0].strategies.length}}
|
|
20
|
-
retrieval_config = {
|
|
21
|
-
{{#if (includes memoryProviders.[0].strategies "SEMANTIC")}}
|
|
22
|
-
f"/users/{actor_id}/facts": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
23
|
-
{{/if}}
|
|
24
|
-
{{#if (includes memoryProviders.[0].strategies "USER_PREFERENCE")}}
|
|
25
|
-
f"/users/{actor_id}/preferences": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
26
|
-
{{/if}}
|
|
27
|
-
{{#if (includes memoryProviders.[0].strategies "SUMMARIZATION")}}
|
|
28
|
-
f"/summaries/{actor_id}/{session_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
29
|
-
{{/if}}
|
|
30
|
-
}
|
|
31
|
-
{{/if}}
|
|
32
|
-
|
|
33
|
-
return AgentCoreMemorySessionManager(
|
|
34
|
-
AgentCoreMemoryConfig(
|
|
35
|
-
memory_id=MEMORY_ID,
|
|
36
|
-
session_id=session_id,
|
|
37
|
-
actor_id=actor_id,
|
|
38
|
-
{{#if memoryProviders.[0].strategies.length}}
|
|
39
|
-
retrieval_config=retrieval_config,
|
|
40
|
-
{{/if}}
|
|
41
|
-
),
|
|
42
|
-
REGION
|
|
43
|
-
)
|
|
44
|
-
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# {{ name }}
|
|
2
|
-
|
|
3
|
-
An MCP (Model Context Protocol) server deployed on Amazon Bedrock AgentCore.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
This project implements an MCP server using FastMCP. MCP servers expose tools that can be consumed by MCP clients (other agents or applications).
|
|
8
|
-
|
|
9
|
-
## Local Development
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Install dependencies
|
|
13
|
-
uv sync
|
|
14
|
-
|
|
15
|
-
# Run the MCP server locally
|
|
16
|
-
uv run python main.py
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
The server starts on port 8000 with Streamable HTTP transport.
|
|
20
|
-
|
|
21
|
-
## Adding Tools
|
|
22
|
-
|
|
23
|
-
Define tools using the `@mcp.tool()` decorator in `main.py`:
|
|
24
|
-
|
|
25
|
-
```python
|
|
26
|
-
@mcp.tool()
|
|
27
|
-
def my_tool(param: str) -> str:
|
|
28
|
-
"""Description of what the tool does."""
|
|
29
|
-
return f"Result: {param}"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Deploy
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
agentcore deploy
|
|
36
|
-
```
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# Environment variables
|
|
2
|
-
.env
|
|
3
|
-
|
|
4
|
-
# Python
|
|
5
|
-
__pycache__/
|
|
6
|
-
*.py[cod]
|
|
7
|
-
*$py.class
|
|
8
|
-
*.so
|
|
9
|
-
.Python
|
|
10
|
-
build/
|
|
11
|
-
develop-eggs/
|
|
12
|
-
dist/
|
|
13
|
-
downloads/
|
|
14
|
-
eggs/
|
|
15
|
-
.eggs/
|
|
16
|
-
lib/
|
|
17
|
-
lib64/
|
|
18
|
-
parts/
|
|
19
|
-
sdist/
|
|
20
|
-
var/
|
|
21
|
-
wheels/
|
|
22
|
-
*.egg-info/
|
|
23
|
-
.installed.cfg
|
|
24
|
-
*.egg
|
|
25
|
-
|
|
26
|
-
# Virtual environments
|
|
27
|
-
.venv/
|
|
28
|
-
venv/
|
|
29
|
-
ENV/
|
|
30
|
-
env/
|
|
31
|
-
|
|
32
|
-
# IDE
|
|
33
|
-
.vscode/
|
|
34
|
-
.idea/
|
|
35
|
-
*.swp
|
|
36
|
-
*.swo
|
|
37
|
-
*~
|
|
38
|
-
|
|
39
|
-
# OS
|
|
40
|
-
.DS_Store
|
|
41
|
-
Thumbs.db
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
from mcp.server.fastmcp import FastMCP
|
|
2
|
-
|
|
3
|
-
mcp = FastMCP("{{ name }}", host="0.0.0.0", stateless_http=True)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
@mcp.tool()
|
|
7
|
-
def add_numbers(a: int, b: int) -> int:
|
|
8
|
-
"""Add two numbers together"""
|
|
9
|
-
return a + b
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@mcp.tool()
|
|
13
|
-
def multiply_numbers(a: int, b: int) -> int:
|
|
14
|
-
"""Multiply two numbers together"""
|
|
15
|
-
return a * b
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
@mcp.tool()
|
|
19
|
-
def greet_user(name: str) -> str:
|
|
20
|
-
"""Greet a user by name"""
|
|
21
|
-
return f"Hello, {name}! Nice to meet you."
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if __name__ == "__main__":
|
|
25
|
-
mcp.run(transport="streamable-http")
|