@aws/agentcore 1.0.0-preview.9 → 1.0.0-rc.3
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 +1218 -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 +43 -17
- package/dist/assets/cdk/bin/cdk.ts +22 -123
- package/dist/assets/cdk/lib/cdk-stack.ts +18 -69
- package/dist/assets/cdk/package.json +6 -13
- package/dist/assets/cdk/tsconfig.json +1 -1
- package/dist/assets/evaluators/python-lambda/README.md +32 -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 +56 -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 +50 -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 +60 -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 +65 -0
- package/dist/assets/templates/agent-python-strands/memory/__init__.py +0 -0
- package/dist/assets/templates/agent-python-strands/memory/session.py +31 -0
- package/dist/assets/{python/http/strands/base → templates/agent-python-strands}/model/load.py +49 -3
- package/dist/assets/templates/agent-python-strands/parse.py +41 -0
- package/dist/assets/templates/agent-python-strands/pyproject.toml +24 -0
- package/dist/assets/templates/agent-typescript-strands/README.md +50 -0
- package/dist/assets/templates/agent-typescript-strands/gitignore.template +22 -0
- package/dist/assets/templates/agent-typescript-strands/main.ts +77 -0
- package/dist/assets/templates/agent-typescript-strands/memory/memory.ts +33 -0
- package/dist/assets/templates/agent-typescript-strands/model/load.ts +5 -0
- package/dist/assets/templates/agent-typescript-strands/package.json.template +28 -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/harness/harness.yaml +157 -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 +1582 -0
- package/package.json +76 -148
- 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/cdk/.prettierrc +0 -8
- package/dist/assets/cdk/jest.config.js +0 -9
- package/dist/assets/cdk/npmignore.template +0 -6
- package/dist/assets/cdk/test/cdk.test.ts +0 -28
- 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,26 +1,52 @@
|
|
|
1
|
-
# AgentCore CDK
|
|
1
|
+
# AgentCore CDK app
|
|
2
2
|
|
|
3
|
-
This CDK
|
|
3
|
+
This CDK app is managed by the AgentCore CLI. It deploys everything declared in `agentcore/agentcore.json` into AWS
|
|
4
|
+
through the `@aws/agentcore-cdk` constructs. It is two files:
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
- `bin/cdk.ts` — the entry point. It reads the project once (`readAgentCoreProject`), creates one stack per deployment
|
|
7
|
+
target (`resolveTargetStacks`), and turns `agentcore.json` into the application's props (`transformAgentCoreJson`).
|
|
8
|
+
Everything about how `agentcore.json` is interpreted lives in the library, so it changes with the library version, not
|
|
9
|
+
with this file.
|
|
10
|
+
- `lib/cdk-stack.ts` — `AgentCoreStack`, which instantiates one `AgentCoreApplication`. This is the file you edit.
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- `test/cdk.test.ts` — Unit tests for stack synthesis.
|
|
12
|
+
Harness settings are read from `harness.yaml`. Inline `systemPrompt` text overrides
|
|
13
|
+
the conventional `system-prompt.md` file in the harness directory.
|
|
10
14
|
|
|
11
|
-
##
|
|
15
|
+
## The CLI runs it for you
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
- `npm run test` run unit tests
|
|
15
|
-
- `npx cdk synth` emit the synthesized CloudFormation template
|
|
16
|
-
- `npx cdk deploy` deploy this stack to your default AWS account/region
|
|
17
|
-
- `npx cdk diff` compare deployed stack with current state
|
|
17
|
+
You normally do not run this app directly:
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
```bash
|
|
20
|
+
agentcore project build # synthesizes the CloudFormation templates into agentcore/cdk/cdk.out
|
|
21
|
+
agentcore project deploy # synthesizes, then deploys the stack for the selected target
|
|
22
|
+
agentcore project status # reports the resources agentcore.json declares
|
|
23
|
+
```
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
`npm run build` compiles the app, and `npx cdk synth` / `npx cdk diff` work from this directory too.
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
## Extending the stack
|
|
28
|
+
|
|
29
|
+
Add your own AWS resources in `lib/cdk-stack.ts` after the application and wire them to a runtime or harness through the
|
|
30
|
+
application's accessors. Runtimes and harnesses implement `iam.IGrantable`, so any AWS L2 grant accepts them, and they
|
|
31
|
+
expose `grantRead` / `grantWrite` / `grantReadWrite` for DynamoDB tables, S3 buckets and Secrets Manager secrets plus
|
|
32
|
+
`addEnvironmentVariable`:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
36
|
+
|
|
37
|
+
const orders = new dynamodb.Table(this, 'Orders', {
|
|
38
|
+
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
39
|
+
});
|
|
40
|
+
const checkout = this.application.runtime('checkout'); // or this.application.harness('support')
|
|
41
|
+
checkout.grantReadWrite(orders); // updates the runtime's execution role
|
|
42
|
+
checkout.addEnvironmentVariable('ORDERS_TABLE', orders.tableName);
|
|
43
|
+
orders.grantReadData(this.application.harness('support')); // any AWS L2 grant works too
|
|
26
44
|
```
|
|
45
|
+
|
|
46
|
+
Then run `agentcore project deploy` again. An unknown name fails at synth and lists the names that exist.
|
|
47
|
+
|
|
48
|
+
If a runtime or harness is configured with an `executionRoleArn`, CDK cannot modify that imported role: every grant
|
|
49
|
+
emits a synth-time warning listing the permissions that were not attached, and the role must already carry them.
|
|
50
|
+
|
|
51
|
+
`agentcore project status` reports only the resources `agentcore.json` declares; resources you add here are visible
|
|
52
|
+
through CloudFormation (`aws cloudformation describe-stack-resources`).
|
|
@@ -1,131 +1,30 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { App } from 'aws-cdk-lib';
|
|
3
|
+
import { readAgentCoreProject, resolveTargetStacks, transformAgentCoreJson } from '@aws/agentcore-cdk';
|
|
2
4
|
import { AgentCoreStack } from '../lib/cdk-stack';
|
|
3
|
-
import { ConfigIO, type AwsDeploymentTarget } from '@aws/agentcore-cdk';
|
|
4
|
-
import { App, type Environment } from 'aws-cdk-lib';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import * as fs from 'fs';
|
|
7
|
-
|
|
8
|
-
function toEnvironment(target: AwsDeploymentTarget): Environment {
|
|
9
|
-
return {
|
|
10
|
-
account: target.account,
|
|
11
|
-
region: target.region,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function sanitize(name: string): string {
|
|
16
|
-
return name.replace(/_/g, '-');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toStackName(projectName: string, targetName: string): string {
|
|
20
|
-
return `AgentCore-${sanitize(projectName)}-${sanitize(targetName)}`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function main() {
|
|
24
|
-
// Config root is parent of cdk/ directory. The CLI sets process.cwd() to agentcore/cdk/.
|
|
25
|
-
const configRoot = path.resolve(process.cwd(), '..');
|
|
26
|
-
const configIO = new ConfigIO({ baseDir: configRoot });
|
|
27
|
-
|
|
28
|
-
const spec = await configIO.readProjectSpec();
|
|
29
|
-
const targets = await configIO.readAWSDeploymentTargets();
|
|
30
|
-
|
|
31
|
-
// Extract MCP configuration from project spec.
|
|
32
|
-
// Gateway fields are stored in agentcore.json but may not yet be on the
|
|
33
|
-
// AgentCoreProjectSpec type from @aws/agentcore-cdk, so we read them
|
|
34
|
-
// dynamically and cast the resulting object.
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
-
const specAny = spec as any;
|
|
37
|
-
const mcpSpec = specAny.agentCoreGateways?.length
|
|
38
|
-
? {
|
|
39
|
-
agentCoreGateways: specAny.agentCoreGateways,
|
|
40
|
-
mcpRuntimeTools: specAny.mcpRuntimeTools,
|
|
41
|
-
unassignedTargets: specAny.unassignedTargets,
|
|
42
|
-
}
|
|
43
|
-
: undefined;
|
|
44
|
-
|
|
45
|
-
// Read deployed state for credential ARNs (populated by pre-deploy identity setup)
|
|
46
|
-
let deployedState: Record<string, unknown> | undefined;
|
|
47
|
-
try {
|
|
48
|
-
deployedState = JSON.parse(fs.readFileSync(path.join(configRoot, '.cli', 'deployed-state.json'), 'utf8'));
|
|
49
|
-
} catch {
|
|
50
|
-
// Deployed state may not exist on first deploy
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (targets.length === 0) {
|
|
54
|
-
throw new Error('No deployment targets configured. Please define targets in agentcore/aws-targets.json');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Read harness configs for role creation.
|
|
58
|
-
// Harness fields may not yet be on the AgentCoreProjectSpec type from @aws/agentcore-cdk,
|
|
59
|
-
// so we read them dynamically via specAny (same pattern as gateways above).
|
|
60
|
-
// Harness paths in agentcore.json are relative to the project root (parent of agentcore/).
|
|
61
|
-
const projectRoot = path.resolve(configRoot, '..');
|
|
62
|
-
const harnessConfigs: {
|
|
63
|
-
name: string;
|
|
64
|
-
executionRoleArn?: string;
|
|
65
|
-
memoryName?: string;
|
|
66
|
-
containerUri?: string;
|
|
67
|
-
hasDockerfile?: boolean;
|
|
68
|
-
dockerfile?: string;
|
|
69
|
-
codeLocation?: string;
|
|
70
|
-
tools?: { type: string; name: string }[];
|
|
71
|
-
apiKeyArn?: string;
|
|
72
|
-
}[] = [];
|
|
73
|
-
for (const entry of specAny.harnesses ?? []) {
|
|
74
|
-
const harnessDir = path.resolve(projectRoot, entry.path);
|
|
75
|
-
const harnessPath = path.resolve(harnessDir, 'harness.json');
|
|
76
|
-
try {
|
|
77
|
-
const harnessSpec = JSON.parse(fs.readFileSync(harnessPath, 'utf-8'));
|
|
78
|
-
harnessConfigs.push({
|
|
79
|
-
name: entry.name,
|
|
80
|
-
executionRoleArn: harnessSpec.executionRoleArn,
|
|
81
|
-
memoryName: harnessSpec.memory?.name,
|
|
82
|
-
containerUri: harnessSpec.containerUri,
|
|
83
|
-
hasDockerfile: !!harnessSpec.dockerfile,
|
|
84
|
-
dockerfile: harnessSpec.dockerfile,
|
|
85
|
-
codeLocation: harnessSpec.dockerfile ? harnessDir : undefined,
|
|
86
|
-
tools: harnessSpec.tools,
|
|
87
|
-
apiKeyArn: harnessSpec.model?.apiKeyArn,
|
|
88
|
-
});
|
|
89
|
-
} catch (err) {
|
|
90
|
-
throw new Error(
|
|
91
|
-
`Could not read harness.json for "${entry.name}" at ${harnessPath}: ${err instanceof Error ? err.message : err}`
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
5
|
|
|
6
|
+
try {
|
|
7
|
+
// The AgentCore CLI runs this app from agentcore/cdk/; readAgentCoreProject walks up to agentcore/.
|
|
8
|
+
const project = readAgentCoreProject();
|
|
96
9
|
const app = new App();
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
new AgentCoreStack(app, stackName, {
|
|
112
|
-
spec,
|
|
113
|
-
mcpSpec,
|
|
114
|
-
credentials,
|
|
115
|
-
harnesses: harnessConfigs.length > 0 ? harnessConfigs : undefined,
|
|
116
|
-
env,
|
|
117
|
-
description: `AgentCore stack for ${spec.name} deployed to ${target.name} (${target.region})`,
|
|
118
|
-
tags: {
|
|
119
|
-
'agentcore:project-name': spec.name,
|
|
120
|
-
'agentcore:target-name': target.name,
|
|
121
|
-
},
|
|
10
|
+
for (const stack of resolveTargetStacks({
|
|
11
|
+
projectName: project.projectName,
|
|
12
|
+
targets: project.targets,
|
|
13
|
+
deployedState: project.deployedState,
|
|
14
|
+
})) {
|
|
15
|
+
new AgentCoreStack(app, stack.stackName, {
|
|
16
|
+
env: stack.env,
|
|
17
|
+
tags: stack.tags,
|
|
18
|
+
description: stack.description,
|
|
19
|
+
application: transformAgentCoreJson(project.agentCoreJson, {
|
|
20
|
+
projectRoot: project.projectRoot,
|
|
21
|
+
credentials: stack.credentials,
|
|
22
|
+
target: stack.target,
|
|
23
|
+
}),
|
|
122
24
|
});
|
|
123
25
|
}
|
|
124
|
-
|
|
125
26
|
app.synth();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
main().catch((error: unknown) => {
|
|
27
|
+
} catch (error) {
|
|
129
28
|
console.error('AgentCore CDK synthesis failed:', error instanceof Error ? error.message : error);
|
|
130
|
-
process.
|
|
131
|
-
}
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
@@ -1,83 +1,32 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AgentCoreMcp,
|
|
4
|
-
type AgentCoreProjectSpec,
|
|
5
|
-
type AgentCoreMcpSpec,
|
|
6
|
-
} from '@aws/agentcore-cdk';
|
|
7
|
-
import { CfnOutput, Stack, type StackProps } from 'aws-cdk-lib';
|
|
1
|
+
import { AgentCoreApplication, type AgentCoreApplicationProps } from '@aws/agentcore-cdk';
|
|
2
|
+
import { Stack, type StackProps } from 'aws-cdk-lib';
|
|
8
3
|
import { Construct } from 'constructs';
|
|
9
4
|
|
|
10
|
-
export interface HarnessConfig {
|
|
11
|
-
name: string;
|
|
12
|
-
executionRoleArn?: string;
|
|
13
|
-
memoryName?: string;
|
|
14
|
-
containerUri?: string;
|
|
15
|
-
hasDockerfile?: boolean;
|
|
16
|
-
dockerfile?: string;
|
|
17
|
-
codeLocation?: string;
|
|
18
|
-
tools?: { type: string; name: string }[];
|
|
19
|
-
apiKeyArn?: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
5
|
export interface AgentCoreStackProps extends StackProps {
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
spec: AgentCoreProjectSpec;
|
|
27
|
-
/**
|
|
28
|
-
* The MCP specification containing gateways and servers.
|
|
29
|
-
*/
|
|
30
|
-
mcpSpec?: AgentCoreMcpSpec;
|
|
31
|
-
/**
|
|
32
|
-
* Credential provider ARNs from deployed state, keyed by credential name.
|
|
33
|
-
*/
|
|
34
|
-
credentials?: Record<string, { credentialProviderArn: string; clientSecretArn?: string }>;
|
|
35
|
-
/**
|
|
36
|
-
* Harness role configurations. Each entry creates an IAM execution role for a harness.
|
|
37
|
-
*
|
|
38
|
-
* When `hasDockerfile` is true and `codeLocation` is provided (without an explicit
|
|
39
|
-
* `containerUri`), the L3 construct builds and pushes a container image via CodeBuild
|
|
40
|
-
* and emits its URI as a stack output for the post-CDK harness deployer.
|
|
41
|
-
*/
|
|
42
|
-
harnesses?: HarnessConfig[];
|
|
6
|
+
/** Props for the AgentCore application, produced by transformAgentCoreJson from agentcore/agentcore.json. */
|
|
7
|
+
application: AgentCoreApplicationProps;
|
|
43
8
|
}
|
|
44
9
|
|
|
45
10
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* All resource logic and outputs are contained within the L3 constructs.
|
|
11
|
+
* The stack the AgentCore CLI deploys. Everything declared in agentcore/agentcore.json is
|
|
12
|
+
* created by the AgentCoreApplication construct. Add your own resources below it and wire
|
|
13
|
+
* them to your runtimes and harnesses through the application's accessors.
|
|
50
14
|
*/
|
|
51
15
|
export class AgentCoreStack extends Stack {
|
|
52
|
-
/** The AgentCore application containing all agent environments */
|
|
53
16
|
public readonly application: AgentCoreApplication;
|
|
54
17
|
|
|
55
18
|
constructor(scope: Construct, id: string, props: AgentCoreStackProps) {
|
|
56
19
|
super(scope, id, props);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
//
|
|
67
|
-
|
|
68
|
-
new AgentCoreMcp(this, 'Mcp', {
|
|
69
|
-
projectName: spec.name,
|
|
70
|
-
mcpSpec,
|
|
71
|
-
agentCoreApplication: this.application,
|
|
72
|
-
credentials,
|
|
73
|
-
projectTags: spec.tags,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// Stack-level output
|
|
78
|
-
new CfnOutput(this, 'StackNameOutput', {
|
|
79
|
-
description: 'Name of the CloudFormation Stack',
|
|
80
|
-
value: this.stackName,
|
|
81
|
-
});
|
|
20
|
+
this.application = new AgentCoreApplication(this, 'Application', props.application);
|
|
21
|
+
|
|
22
|
+
// Example: give a runtime a DynamoDB table.
|
|
23
|
+
//
|
|
24
|
+
// import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
|
|
25
|
+
// const orders = new dynamodb.Table(this, 'Orders', {
|
|
26
|
+
// partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
|
|
27
|
+
// });
|
|
28
|
+
// const checkout = this.application.runtime('checkout'); // or .harness('support')
|
|
29
|
+
// checkout.grantReadWrite(orders);
|
|
30
|
+
// checkout.addEnvironmentVariable('ORDERS_TABLE', orders.tableName);
|
|
82
31
|
}
|
|
83
32
|
}
|
|
@@ -7,24 +7,17 @@
|
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc",
|
|
9
9
|
"watch": "tsc -w",
|
|
10
|
-
"test": "jest",
|
|
11
10
|
"cdk": "npm run build && cdk",
|
|
12
|
-
"clean": "rm -rf dist"
|
|
13
|
-
"format": "prettier --write .",
|
|
14
|
-
"format:check": "prettier --check ."
|
|
11
|
+
"clean": "rm -rf dist"
|
|
15
12
|
},
|
|
16
13
|
"devDependencies": {
|
|
17
|
-
"@types/
|
|
18
|
-
"
|
|
19
|
-
"jest": "^29.7.0",
|
|
20
|
-
"ts-jest": "^29.2.5",
|
|
21
|
-
"aws-cdk": "2.1100.1",
|
|
22
|
-
"prettier": "^3.4.2",
|
|
14
|
+
"@types/node": "~24.13.3",
|
|
15
|
+
"aws-cdk": "~2.1126.0",
|
|
23
16
|
"typescript": "~5.9.3"
|
|
24
17
|
},
|
|
25
18
|
"dependencies": {
|
|
26
|
-
"@aws/agentcore-cdk": "
|
|
27
|
-
"aws-cdk-lib": "
|
|
28
|
-
"constructs": "
|
|
19
|
+
"@aws/agentcore-cdk": "1.0.0-rc.1",
|
|
20
|
+
"aws-cdk-lib": "~2.269.0",
|
|
21
|
+
"constructs": "~10.7.0"
|
|
29
22
|
}
|
|
30
23
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# {{ Name }}
|
|
2
|
+
|
|
3
|
+
An AgentCore **code-based evaluator** — a Lambda that scores an agent session
|
|
4
|
+
with your own logic.
|
|
5
|
+
|
|
6
|
+
## What's here
|
|
7
|
+
|
|
8
|
+
- `lambda_function.py` — the evaluator. The `@custom_code_based_evaluator()`
|
|
9
|
+
handler receives an `EvaluatorInput` (the session / trace / tool-call to
|
|
10
|
+
grade) and returns an `EvaluatorOutput` (`value` + `label`, or an error). It
|
|
11
|
+
ships as a stub that returns `Pass` for everything — replace the `TODO` with
|
|
12
|
+
your scoring logic.
|
|
13
|
+
- `pyproject.toml` — Python dependencies, managed with
|
|
14
|
+
[uv](https://docs.astral.sh/uv/).
|
|
15
|
+
- `execution-role-policy.json` — extra IAM the evaluator Lambda gets at runtime.
|
|
16
|
+
Add statements here for anything your logic calls (Bedrock, DynamoDB, S3, …).
|
|
17
|
+
|
|
18
|
+
Third-party evaluation libraries are ordinary application dependencies. Add
|
|
19
|
+
them to `pyproject.toml`, configure them in `lambda_function.py`, and grant any
|
|
20
|
+
required permissions in `execution-role-policy.json`.
|
|
21
|
+
|
|
22
|
+
## Write your evaluator
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
@custom_code_based_evaluator()
|
|
26
|
+
def handler(input: EvaluatorInput, context) -> EvaluatorOutput:
|
|
27
|
+
# inspect input.session_spans / input.target_trace_id / input.target_span_id
|
|
28
|
+
return EvaluatorOutput(value=1.0, label="Pass", explanation="…")
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Then `agentcore project deploy` packages this directory into the evaluator
|
|
32
|
+
Lambda and registers the evaluator.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# {{ name }}
|
|
2
|
+
|
|
3
|
+
An A2A (Agent-to-Agent) agent deployed on Amazon Bedrock AgentCore using the Strands SDK.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This agent speaks the A2A protocol. Other agents discover it via its agent card at
|
|
8
|
+
`/.well-known/agent-card.json` and invoke it with JSON-RPC (`message/send`, `message/stream`)
|
|
9
|
+
at the server root, matching the AgentCore Runtime A2A service contract.
|
|
10
|
+
|
|
11
|
+
## Adding Tools
|
|
12
|
+
|
|
13
|
+
Define tools with the `@tool` decorator in `main.py` and add them to the `tools` list:
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
@tool
|
|
17
|
+
def my_tool(param: str) -> str:
|
|
18
|
+
"""Description of what the tool does."""
|
|
19
|
+
return f"Result: {param}"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Developing locally
|
|
23
|
+
|
|
24
|
+
`agentcore project dev` starts the agent locally on `0.0.0.0:9000`. Fetch its agent card at
|
|
25
|
+
`http://127.0.0.1:9000/.well-known/agent-card.json` and send it messages by posting A2A
|
|
26
|
+
JSON-RPC to `http://127.0.0.1:9000/`.
|
|
27
|
+
|
|
28
|
+
## Deployment
|
|
29
|
+
|
|
30
|
+
`agentcore project deploy` deploys the agent into Amazon Bedrock AgentCore. Invoke it with the
|
|
31
|
+
AWS CLI (`bedrock-agentcore invoke-agent-runtime`) using an A2A JSON-RPC payload.
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
from strands import Agent, tool
|
|
2
|
+
from strands.multiagent.a2a.executor import StrandsA2AExecutor
|
|
3
|
+
from bedrock_agentcore.runtime import serve_a2a
|
|
4
|
+
from model.load import load_model
|
|
5
|
+
from memory.session import get_memory_session_manager
|
|
6
|
+
{{#if needsOs}}
|
|
7
|
+
import os
|
|
8
|
+
{{/if}}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@tool
|
|
12
|
+
def add_numbers(a: int, b: int) -> int:
|
|
13
|
+
"""Return the sum of two numbers."""
|
|
14
|
+
return a + b
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
tools = [add_numbers]
|
|
18
|
+
|
|
19
|
+
{{#if needsOs}}
|
|
20
|
+
_MOUNT_PATHS = [
|
|
21
|
+
{{#if sessionStorageMountPath}}"{{sessionStorageMountPath}}",{{/if}}
|
|
22
|
+
{{#each efsMounts}}"{{mountPath}}",{{/each}}
|
|
23
|
+
{{#each s3Mounts}}"{{mountPath}}",{{/each}}
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
def _safe_resolve(path: str) -> str:
|
|
27
|
+
resolved = os.path.realpath(path)
|
|
28
|
+
if not any(resolved == os.path.realpath(m) or resolved.startswith(os.path.realpath(m) + os.sep) for m in _MOUNT_PATHS):
|
|
29
|
+
raise ValueError(f"Path '{path}' is not within any configured mount ({', '.join(_MOUNT_PATHS)})")
|
|
30
|
+
return resolved
|
|
31
|
+
|
|
32
|
+
@tool
|
|
33
|
+
def file_read(path: str) -> str:
|
|
34
|
+
"""Read a file from a mounted filesystem. Use the absolute path (e.g. /mnt/tools/data.txt)."""
|
|
35
|
+
try:
|
|
36
|
+
full_path = _safe_resolve(path)
|
|
37
|
+
with open(full_path) as f:
|
|
38
|
+
return f.read()
|
|
39
|
+
except ValueError as e:
|
|
40
|
+
return str(e)
|
|
41
|
+
except OSError as e:
|
|
42
|
+
return f"Error reading '{path}': {e.strerror}"
|
|
43
|
+
|
|
44
|
+
@tool
|
|
45
|
+
def file_write(path: str, content: str) -> str:
|
|
46
|
+
"""Write a file to a mounted filesystem. Use the absolute path (e.g. /mnt/tools/data.txt)."""
|
|
47
|
+
try:
|
|
48
|
+
full_path = _safe_resolve(path)
|
|
49
|
+
parent = os.path.dirname(full_path)
|
|
50
|
+
if parent:
|
|
51
|
+
os.makedirs(parent, exist_ok=True)
|
|
52
|
+
with open(full_path, "w") as f:
|
|
53
|
+
f.write(content)
|
|
54
|
+
return f"Written to {path}"
|
|
55
|
+
except ValueError as e:
|
|
56
|
+
return str(e)
|
|
57
|
+
except OSError as e:
|
|
58
|
+
return f"Error writing '{path}': {e.strerror}"
|
|
59
|
+
|
|
60
|
+
@tool
|
|
61
|
+
def list_files(path: str) -> str:
|
|
62
|
+
"""List files in a mounted filesystem directory. Use the absolute path (e.g. /mnt/tools)."""
|
|
63
|
+
try:
|
|
64
|
+
full_path = _safe_resolve(path)
|
|
65
|
+
entries = os.listdir(full_path)
|
|
66
|
+
return "\n".join(entries) if entries else "(empty directory)"
|
|
67
|
+
except ValueError as e:
|
|
68
|
+
return str(e)
|
|
69
|
+
except OSError as e:
|
|
70
|
+
return f"Error listing '{path}': {e.strerror}"
|
|
71
|
+
|
|
72
|
+
tools.extend([file_read, file_write, list_files])
|
|
73
|
+
{{/if}}
|
|
74
|
+
|
|
75
|
+
SYSTEM_PROMPT = """
|
|
76
|
+
You are a helpful assistant. Use tools when appropriate.
|
|
77
|
+
{{#if needsOs}}
|
|
78
|
+
You have access to the following mounted filesystems. Use file_read, file_write, and list_files with full absolute paths:
|
|
79
|
+
{{#if sessionStorageMountPath}}- {{sessionStorageMountPath}}: ephemeral session storage (lost when session ends)
|
|
80
|
+
{{/if}}{{#each efsMounts}}- {{mountPath}}: EFS persistent storage (persists across sessions and agent restarts)
|
|
81
|
+
{{/each}}{{#each s3Mounts}}- {{mountPath}}: S3 Files persistent storage (durable, backed by S3)
|
|
82
|
+
{{/each}}{{/if}}
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
# serve_a2a serves one agent instance, so it is bound to a fixed session and
|
|
86
|
+
# actor; get_memory_session_manager returns None (in-process history only) until
|
|
87
|
+
# the deployed MEMORY_ID env var is set by the CDK.
|
|
88
|
+
agent = Agent(
|
|
89
|
+
name="{{ name }}",
|
|
90
|
+
model=load_model(),
|
|
91
|
+
session_manager=get_memory_session_manager("default-session", "default-user"),
|
|
92
|
+
system_prompt=SYSTEM_PROMPT,
|
|
93
|
+
tools=tools,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
# serve_a2a binds 0.0.0.0:9000 in the container (the AgentCore A2A service
|
|
97
|
+
# contract) and publishes the agent card at /.well-known/agent-card.json. The
|
|
98
|
+
# card is derived by introspecting the executor's agent.
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
serve_a2a(StrandsA2AExecutor(agent))
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import uuid
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from bedrock_agentcore.memory.integrations.strands.config import AgentCoreMemoryConfig, RetrievalConfig
|
|
6
|
+
from bedrock_agentcore.memory.integrations.strands.session_manager import AgentCoreMemorySessionManager
|
|
7
|
+
|
|
8
|
+
MEMORY_ID = os.getenv("{{memoryEnvVarName}}")
|
|
9
|
+
REGION = os.getenv("AWS_REGION")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def get_memory_session_manager(
|
|
13
|
+
session_id: Optional[str], actor_id: str
|
|
14
|
+
) -> Optional[AgentCoreMemorySessionManager]:
|
|
15
|
+
if not MEMORY_ID:
|
|
16
|
+
return None
|
|
17
|
+
|
|
18
|
+
session_id = session_id or uuid.uuid4().hex
|
|
19
|
+
|
|
20
|
+
retrieval_config = {
|
|
21
|
+
f"/users/{actor_id}/facts": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
22
|
+
f"/users/{actor_id}/preferences": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
23
|
+
f"/episodes/{actor_id}/{session_id}": RetrievalConfig(top_k=5, relevance_score=0.5),
|
|
24
|
+
f"/summaries/{actor_id}": RetrievalConfig(top_k=3, relevance_score=0.5),
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return AgentCoreMemorySessionManager(
|
|
28
|
+
AgentCoreMemoryConfig(
|
|
29
|
+
memory_id=MEMORY_ID,
|
|
30
|
+
session_id=session_id,
|
|
31
|
+
actor_id=actor_id,
|
|
32
|
+
retrieval_config=retrieval_config,
|
|
33
|
+
),
|
|
34
|
+
REGION,
|
|
35
|
+
)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling ~= 1.27.0"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "{{ name }}"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "AgentCore A2A Agent using Strands SDK"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"a2a-sdk[all] ~= 0.3.0",
|
|
13
|
+
"aws-opentelemetry-distro ~= 0.18.0",
|
|
14
|
+
"bedrock-agentcore[a2a] ~= 1.9.1",
|
|
15
|
+
"botocore[crt] ~= 1.43.0",
|
|
16
|
+
"strands-agents ~= 1.15.0",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[tool.hatch.build.targets.wheel]
|
|
20
|
+
packages = ["."]
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# agent-python-langchain
|
|
2
|
+
|
|
3
|
+
A LangChain agent on AgentCore Runtime, calling Claude through Amazon Bedrock.
|
|
4
|
+
The agent is built with `create_agent`, keeps conversation history per Runtime
|
|
5
|
+
session, and streams its response.
|
|
6
|
+
|
|
7
|
+
## What's here
|
|
8
|
+
|
|
9
|
+
- `main.py`: the agent. A `BedrockAgentCoreApp` wraps an async entrypoint
|
|
10
|
+
that reads `prompt` from the payload, runs the agent, and streams each
|
|
11
|
+
completed model message back as a JSON event of content blocks. An
|
|
12
|
+
`InMemorySaver` checkpointer keyed on the Runtime session id carries history
|
|
13
|
+
between turns.
|
|
14
|
+
- `model/load.py`: creates the Bedrock chat model with `init_chat_model`.
|
|
15
|
+
- `pyproject.toml`: Python dependencies, managed with
|
|
16
|
+
[uv](https://docs.astral.sh/uv/). `agentcore project create` has already run
|
|
17
|
+
`uv sync` for you (unless you passed `--skip-install`), so `.venv/` is ready.
|
|
18
|
+
|
|
19
|
+
## Develop
|
|
20
|
+
|
|
21
|
+
Run the agent locally from the project root:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
agentcore project dev
|
|
25
|
+
agentcore project invoke runtime --local --payload '{"prompt":"What is 2 plus 3?"}'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Environment variables for local development go in `agentcore/.env.local`
|
|
29
|
+
(gitignored).
|
|
30
|
+
|
|
31
|
+
## Deploy
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
agentcore project deploy
|
|
35
|
+
agentcore project invoke runtime --payload '{"prompt":"Hello!"}'
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Traces are collected automatically: AgentCore Runtime starts the agent under
|
|
39
|
+
`opentelemetry-instrument`, which picks up `opentelemetry-instrumentation-langchain`
|
|
40
|
+
from the dependencies.
|
|
41
|
+
|
|
42
|
+
## Extending
|
|
43
|
+
|
|
44
|
+
Everything hangs off the `create_agent` call in `main.py`.
|
|
45
|
+
|
|
46
|
+
- **Tools.** Add a function decorated with `@tool` and append it to `tools`.
|
|
47
|
+
- **Middleware.** Hook the agent loop with `langchain.agents.middleware`, for
|
|
48
|
+
example a `@before_model` function passed as `middleware=[...]`.
|
|
49
|
+
- **Durable memory.** Replace `InMemorySaver()` with `AgentCoreMemorySaver`
|
|
50
|
+
from `langgraph-checkpoint-aws` and add `actor_id` next to `thread_id` in the
|
|
51
|
+
`configurable` config to persist history in AgentCore Memory.
|
|
52
|
+
- **Structured output.** Pass a Pydantic model as `response_format=` and read
|
|
53
|
+
`structured_response` from the final state.
|
|
54
|
+
|
|
55
|
+
See the [LangChain agents documentation](https://docs.langchain.com/oss/python/langchain/agents)
|
|
56
|
+
for the full `create_agent` surface.
|