@aws/agentcore 1.0.0-preview.3 → 1.0.0-preview.30
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 +193 -33
- package/dist/agent-inspector/index.css +1 -1
- package/dist/agent-inspector/index.js +99 -84
- package/dist/assets/README.md +6 -2
- package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +3344 -366
- package/dist/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap +6 -2
- package/dist/assets/__tests__/assets.snapshot.test.ts +10 -24
- package/dist/assets/__tests__/googleadk-observability.test.ts +23 -0
- package/dist/assets/__tests__/googleadk-session-eviction.test.ts +87 -0
- package/dist/assets/__tests__/input-validation.test.ts +44 -0
- package/dist/assets/__tests__/summarization-namespace.test.ts +43 -0
- package/dist/assets/agents/AGENTS.md +91 -14
- package/dist/assets/cdk/bin/cdk.ts +109 -24
- package/dist/assets/cdk/lib/cdk-stack.ts +227 -19
- package/dist/assets/cdk/package.json +9 -9
- package/dist/assets/cdk/test/cdk.test.ts +4 -0
- package/dist/assets/container/python/Dockerfile +7 -1
- package/dist/assets/container/typescript/Dockerfile +25 -0
- package/dist/assets/container/typescript/dockerignore.template +24 -0
- package/dist/assets/datasets/predefined-v1.jsonl +3 -0
- package/dist/assets/datasets/simulated-v1.jsonl +3 -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 +22 -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 +19 -0
- package/dist/assets/mcp/python/pyproject.toml +1 -1
- package/dist/assets/python/a2a/googleadk/base/main.py +32 -18
- package/dist/assets/python/a2a/googleadk/base/pyproject.toml +6 -4
- package/dist/assets/python/a2a/langchain_langgraph/base/main.py +35 -21
- package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +4 -3
- package/dist/assets/python/a2a/strands/base/main.py +23 -17
- package/dist/assets/python/a2a/strands/base/pyproject.toml +3 -3
- package/dist/assets/python/a2a/strands/capabilities/memory/session.py +4 -1
- package/dist/assets/python/agui/googleadk/base/main.py +62 -2
- package/dist/assets/python/agui/googleadk/base/pyproject.toml +6 -5
- package/dist/assets/python/agui/langchain_langgraph/base/main.py +56 -0
- package/dist/assets/python/agui/langchain_langgraph/base/pyproject.toml +3 -2
- package/dist/assets/python/agui/strands/base/main.py +63 -1
- package/dist/assets/python/agui/strands/base/pyproject.toml +2 -2
- package/dist/assets/python/agui/strands/capabilities/memory/session.py +4 -1
- package/dist/assets/python/http/autogen/base/README.md +7 -1
- package/dist/assets/python/http/autogen/base/main.py +62 -29
- package/dist/assets/python/http/autogen/base/pyproject.toml +1 -1
- package/dist/assets/python/http/googleadk/base/README.md +7 -1
- package/dist/assets/python/http/googleadk/base/main.py +71 -24
- package/dist/assets/python/http/googleadk/base/mcp_client/client.py +7 -7
- package/dist/assets/python/http/googleadk/base/pyproject.toml +5 -3
- package/dist/assets/python/http/langchain_langgraph/base/README.md +7 -1
- package/dist/assets/python/http/langchain_langgraph/base/main.py +119 -24
- package/dist/assets/python/http/langchain_langgraph/base/mcp_client/client.py +10 -8
- package/dist/assets/python/http/langchain_langgraph/base/pyproject.toml +5 -4
- package/dist/assets/python/http/openaiagents/base/README.md +7 -1
- package/dist/assets/python/http/openaiagents/base/main.py +63 -32
- package/dist/assets/python/http/openaiagents/base/mcp_client/client.py +4 -4
- package/dist/assets/python/http/openaiagents/base/pyproject.toml +3 -3
- package/dist/assets/python/http/strands/base/README.md +8 -1
- package/dist/assets/python/http/strands/base/main.py +607 -47
- package/dist/assets/python/http/strands/base/mcp_client/client.py +49 -6
- package/dist/assets/python/http/strands/base/model/load.py +119 -3
- package/dist/assets/python/http/strands/base/model/mantle_compat.py +21 -0
- package/dist/assets/python/http/strands/base/pyproject.toml +11 -5
- package/dist/assets/python/http/strands/base/skills/fetcher.py +279 -0
- package/dist/assets/python/http/strands/capabilities/execution-limits/hooks/execution_limits.py +54 -0
- package/dist/assets/python/http/strands/capabilities/memory/session.py +4 -1
- package/dist/assets/python/http/strands/capabilities/payments/__init__.py +4 -0
- package/dist/assets/python/http/strands/capabilities/payments/payments.py +142 -0
- package/dist/assets/python/mcp/standalone/base/main.py +58 -0
- package/dist/assets/python/mcp/standalone/base/pyproject.toml +1 -1
- package/dist/assets/typescript/http/strands/base/README.md +42 -0
- package/dist/assets/typescript/http/strands/base/gitignore.template +22 -0
- package/dist/assets/typescript/http/strands/base/main.ts +149 -0
- package/dist/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
- package/dist/assets/typescript/http/strands/base/model/load.ts +102 -0
- package/dist/assets/typescript/http/strands/base/package.json +38 -0
- package/dist/assets/typescript/http/strands/base/tsconfig.json +19 -0
- package/dist/assets/typescript/http/strands/capabilities/memory/memory.ts +52 -0
- package/dist/assets/typescript/http/vercelai/base/README.md +42 -0
- package/dist/assets/typescript/http/vercelai/base/gitignore.template +22 -0
- package/dist/assets/typescript/http/vercelai/base/main.ts +70 -0
- package/dist/assets/typescript/http/vercelai/base/model/load.ts +121 -0
- package/dist/assets/typescript/http/vercelai/base/package.json +35 -0
- package/dist/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
- package/dist/cli/index.mjs +1743 -627
- package/dist/lib/constants.d.ts +8 -4
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +13 -7
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/dependency-management/index.d.ts +5 -0
- package/dist/lib/dependency-management/index.d.ts.map +1 -0
- package/dist/lib/dependency-management/index.js +8 -0
- package/dist/lib/dependency-management/index.js.map +1 -0
- package/dist/lib/dependency-management/messages.d.ts +30 -0
- package/dist/lib/dependency-management/messages.d.ts.map +1 -0
- package/dist/lib/dependency-management/messages.js +86 -0
- package/dist/lib/dependency-management/messages.js.map +1 -0
- package/dist/lib/dependency-management/plan.d.ts +25 -0
- package/dist/lib/dependency-management/plan.d.ts.map +1 -0
- package/dist/lib/dependency-management/plan.js +67 -0
- package/dist/lib/dependency-management/plan.js.map +1 -0
- package/dist/lib/dependency-management/semver.d.ts +21 -0
- package/dist/lib/dependency-management/semver.d.ts.map +1 -0
- package/dist/lib/dependency-management/semver.js +51 -0
- package/dist/lib/dependency-management/semver.js.map +1 -0
- package/dist/lib/dependency-management/sync.d.ts +26 -0
- package/dist/lib/dependency-management/sync.d.ts.map +1 -0
- package/dist/lib/dependency-management/sync.js +141 -0
- package/dist/lib/dependency-management/sync.js.map +1 -0
- package/dist/lib/dependency-management/types.d.ts +85 -0
- package/dist/lib/dependency-management/types.d.ts.map +1 -0
- package/dist/lib/dependency-management/types.js +3 -0
- package/dist/lib/dependency-management/types.js.map +1 -0
- package/dist/lib/errors/index.d.ts +1 -1
- package/dist/lib/errors/index.d.ts.map +1 -1
- package/dist/lib/errors/index.js +1 -1
- package/dist/lib/errors/index.js.map +1 -1
- package/dist/lib/errors/types.d.ts +274 -0
- package/dist/lib/errors/types.d.ts.map +1 -0
- package/dist/lib/errors/types.js +423 -0
- package/dist/lib/errors/types.js.map +1 -0
- package/dist/lib/errors/zod.d.ts +8 -0
- package/dist/lib/errors/zod.d.ts.map +1 -0
- package/dist/lib/errors/{config.js → zod.js} +8 -81
- package/dist/lib/errors/zod.js.map +1 -0
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +4 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/packaging/build-args.d.ts +6 -0
- package/dist/lib/packaging/build-args.d.ts.map +1 -1
- package/dist/lib/packaging/build-args.js +11 -2
- package/dist/lib/packaging/build-args.js.map +1 -1
- package/dist/lib/packaging/build-context-dockerignore.d.ts +23 -0
- package/dist/lib/packaging/build-context-dockerignore.d.ts.map +1 -0
- package/dist/lib/packaging/build-context-dockerignore.js +63 -0
- package/dist/lib/packaging/build-context-dockerignore.js.map +1 -0
- package/dist/lib/packaging/build-context.d.ts +21 -0
- package/dist/lib/packaging/build-context.d.ts.map +1 -0
- package/dist/lib/packaging/build-context.js +21 -0
- package/dist/lib/packaging/build-context.js.map +1 -0
- package/dist/lib/packaging/container.d.ts.map +1 -1
- package/dist/lib/packaging/container.js +20 -9
- package/dist/lib/packaging/container.js.map +1 -1
- package/dist/lib/packaging/helpers.d.ts +16 -0
- package/dist/lib/packaging/helpers.d.ts.map +1 -1
- package/dist/lib/packaging/helpers.js +127 -29
- package/dist/lib/packaging/helpers.js.map +1 -1
- package/dist/lib/packaging/index.d.ts +2 -1
- package/dist/lib/packaging/index.d.ts.map +1 -1
- package/dist/lib/packaging/index.js +9 -20
- package/dist/lib/packaging/index.js.map +1 -1
- package/dist/lib/packaging/node.d.ts +2 -2
- package/dist/lib/packaging/node.d.ts.map +1 -1
- package/dist/lib/packaging/node.js +83 -38
- package/dist/lib/packaging/node.js.map +1 -1
- package/dist/lib/packaging/python.js +12 -12
- package/dist/lib/packaging/python.js.map +1 -1
- package/dist/lib/result.d.ts +57 -0
- package/dist/lib/result.d.ts.map +1 -0
- package/dist/lib/result.js +62 -0
- package/dist/lib/result.js.map +1 -0
- package/dist/lib/schemas/io/config-io.d.ts +14 -0
- package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
- package/dist/lib/schemas/io/config-io.js +89 -5
- package/dist/lib/schemas/io/config-io.js.map +1 -1
- package/dist/lib/schemas/io/global-config.d.ts +41 -0
- package/dist/lib/schemas/io/global-config.d.ts.map +1 -0
- package/dist/lib/schemas/io/global-config.js +119 -0
- package/dist/lib/schemas/io/global-config.js.map +1 -0
- package/dist/lib/schemas/io/index.d.ts +1 -2
- package/dist/lib/schemas/io/index.d.ts.map +1 -1
- package/dist/lib/schemas/io/index.js +1 -4
- package/dist/lib/schemas/io/index.js.map +1 -1
- package/dist/lib/schemas/io/path-resolver.d.ts +0 -6
- package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
- package/dist/lib/schemas/io/path-resolver.js +3 -13
- package/dist/lib/schemas/io/path-resolver.js.map +1 -1
- package/dist/lib/secrets/cipher.d.ts +12 -0
- package/dist/lib/secrets/cipher.d.ts.map +1 -0
- package/dist/lib/secrets/cipher.js +54 -0
- package/dist/lib/secrets/cipher.js.map +1 -0
- package/dist/lib/secrets/index.d.ts +4 -0
- package/dist/lib/secrets/index.d.ts.map +1 -0
- package/dist/lib/secrets/index.js +15 -0
- package/dist/lib/secrets/index.js.map +1 -0
- package/dist/lib/secrets/key-provider.d.ts +16 -0
- package/dist/lib/secrets/key-provider.d.ts.map +1 -0
- package/dist/lib/secrets/key-provider.js +191 -0
- package/dist/lib/secrets/key-provider.js.map +1 -0
- package/dist/lib/secrets/sensitive-keys.d.ts +21 -0
- package/dist/lib/secrets/sensitive-keys.d.ts.map +1 -0
- package/dist/lib/secrets/sensitive-keys.js +67 -0
- package/dist/lib/secrets/sensitive-keys.js.map +1 -0
- package/dist/lib/time-constants.d.ts +5 -0
- package/dist/lib/time-constants.d.ts.map +1 -0
- package/dist/lib/time-constants.js +8 -0
- package/dist/lib/time-constants.js.map +1 -0
- package/dist/lib/utils/env.d.ts +8 -2
- package/dist/lib/utils/env.d.ts.map +1 -1
- package/dist/lib/utils/env.js +65 -17
- package/dist/lib/utils/env.js.map +1 -1
- package/dist/lib/utils/index.d.ts +3 -2
- package/dist/lib/utils/index.d.ts.map +1 -1
- package/dist/lib/utils/index.js +6 -1
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/lib/utils/polling.d.ts +31 -0
- package/dist/lib/utils/polling.d.ts.map +1 -0
- package/dist/lib/utils/polling.js +61 -0
- package/dist/lib/utils/polling.js.map +1 -0
- package/dist/lib/utils/subprocess.d.ts +4 -1
- package/dist/lib/utils/subprocess.d.ts.map +1 -1
- package/dist/lib/utils/subprocess.js +11 -57
- package/dist/lib/utils/subprocess.js.map +1 -1
- package/dist/lib/utils/zod.d.ts +16 -0
- package/dist/lib/utils/zod.d.ts.map +1 -1
- package/dist/lib/utils/zod.js +45 -0
- package/dist/lib/utils/zod.js.map +1 -1
- package/dist/schema/constants.d.ts +56 -2
- package/dist/schema/constants.d.ts.map +1 -1
- package/dist/schema/constants.js +82 -7
- package/dist/schema/constants.js.map +1 -1
- package/dist/schema/schemas/agent-env.d.ts +187 -7
- package/dist/schema/schemas/agent-env.d.ts.map +1 -1
- package/dist/schema/schemas/agent-env.js +323 -27
- package/dist/schema/schemas/agent-env.js.map +1 -1
- package/dist/schema/schemas/agentcore-project.d.ts +519 -12
- package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
- package/dist/schema/schemas/agentcore-project.js +342 -13
- package/dist/schema/schemas/agentcore-project.js.map +1 -1
- package/dist/schema/schemas/auth.d.ts +174 -0
- package/dist/schema/schemas/auth.d.ts.map +1 -1
- package/dist/schema/schemas/auth.js +127 -3
- package/dist/schema/schemas/auth.js.map +1 -1
- package/dist/schema/schemas/aws-targets.d.ts +18 -0
- package/dist/schema/schemas/aws-targets.d.ts.map +1 -1
- package/dist/schema/schemas/aws-targets.js +6 -0
- package/dist/schema/schemas/aws-targets.js.map +1 -1
- package/dist/schema/schemas/connections.d.ts +185 -0
- package/dist/schema/schemas/connections.d.ts.map +1 -0
- package/dist/schema/schemas/connections.js +176 -0
- package/dist/schema/schemas/connections.js.map +1 -0
- package/dist/schema/schemas/deployed-state.d.ts +392 -5
- package/dist/schema/schemas/deployed-state.d.ts.map +1 -1
- package/dist/schema/schemas/deployed-state.js +112 -2
- package/dist/schema/schemas/deployed-state.js.map +1 -1
- package/dist/schema/schemas/index.d.ts +3 -0
- package/dist/schema/schemas/index.d.ts.map +1 -1
- package/dist/schema/schemas/index.js +5 -0
- package/dist/schema/schemas/index.js.map +1 -1
- package/dist/schema/schemas/mcp-defs.d.ts +2 -1
- package/dist/schema/schemas/mcp-defs.d.ts.map +1 -1
- package/dist/schema/schemas/mcp-defs.js +3 -2
- package/dist/schema/schemas/mcp-defs.js.map +1 -1
- package/dist/schema/schemas/mcp.d.ts +197 -0
- package/dist/schema/schemas/mcp.d.ts.map +1 -1
- package/dist/schema/schemas/mcp.js +334 -5
- package/dist/schema/schemas/mcp.js.map +1 -1
- package/dist/schema/schemas/primitives/ab-test.d.ts +135 -0
- package/dist/schema/schemas/primitives/ab-test.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/ab-test.js +95 -0
- package/dist/schema/schemas/primitives/ab-test.js.map +1 -0
- package/dist/schema/schemas/primitives/capacity-provider.d.ts +237 -0
- package/dist/schema/schemas/primitives/capacity-provider.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/capacity-provider.js +220 -0
- package/dist/schema/schemas/primitives/capacity-provider.js.map +1 -0
- package/dist/schema/schemas/primitives/config-bundle.d.ts +32 -0
- package/dist/schema/schemas/primitives/config-bundle.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/config-bundle.js +41 -0
- package/dist/schema/schemas/primitives/config-bundle.js.map +1 -0
- package/dist/schema/schemas/primitives/dataset.d.ts +48 -0
- package/dist/schema/schemas/primitives/dataset.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/dataset.js +58 -0
- package/dist/schema/schemas/primitives/dataset.js.map +1 -0
- package/dist/schema/schemas/primitives/evaluator.d.ts +22 -0
- package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/evaluator.js +28 -3
- package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
- package/dist/schema/schemas/primitives/harness.d.ts +377 -19
- package/dist/schema/schemas/primitives/harness.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/harness.js +379 -24
- package/dist/schema/schemas/primitives/harness.js.map +1 -1
- package/dist/schema/schemas/primitives/index.d.ts +17 -9
- package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/index.js +62 -1
- package/dist/schema/schemas/primitives/index.js.map +1 -1
- package/dist/schema/schemas/primitives/knowledge-base.d.ts +104 -0
- package/dist/schema/schemas/primitives/knowledge-base.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/knowledge-base.js +99 -0
- package/dist/schema/schemas/primitives/knowledge-base.js.map +1 -0
- package/dist/schema/schemas/primitives/memory.d.ts +22 -4
- package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/memory.js +57 -16
- package/dist/schema/schemas/primitives/memory.js.map +1 -1
- package/dist/schema/schemas/primitives/online-eval-config.d.ts +21 -2
- package/dist/schema/schemas/primitives/online-eval-config.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/online-eval-config.js +45 -5
- package/dist/schema/schemas/primitives/online-eval-config.js.map +1 -1
- package/dist/schema/schemas/primitives/payment.d.ts +86 -0
- package/dist/schema/schemas/primitives/payment.d.ts.map +1 -0
- package/dist/schema/schemas/primitives/payment.js +88 -0
- package/dist/schema/schemas/primitives/payment.js.map +1 -0
- package/dist/schema/schemas/primitives/policy.d.ts +26 -0
- package/dist/schema/schemas/primitives/policy.d.ts.map +1 -1
- package/dist/schema/schemas/primitives/policy.js +5 -1
- package/dist/schema/schemas/primitives/policy.js.map +1 -1
- package/npm-shrinkwrap.json +16874 -0
- package/package.json +49 -21
- package/scripts/bump-version.ts +4 -4
- package/scripts/bundle.mjs +70 -41
- package/scripts/extract-cli-model.mjs +269 -0
- package/scripts/extract-cli-model.test.mjs +43 -0
- package/scripts/render_adoc.py +350 -0
- package/scripts/run-e2e-dev.sh +56 -0
- package/scripts/run-e2e-local.sh +145 -0
- package/scripts/safe-junit-reporter.ts +7 -0
- package/scripts/sanitize-test-artifacts.ts +65 -0
- package/scripts/sync-vended-cdk.ts +49 -0
- package/scripts/test_render_adoc.py +38 -0
- 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.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/schemas/io/cli-config.d.ts +0 -12
- package/dist/lib/schemas/io/cli-config.d.ts.map +0 -1
- package/dist/lib/schemas/io/cli-config.js +0 -35
- package/dist/lib/schemas/io/cli-config.js.map +0 -1
|
@@ -32,23 +32,25 @@ def get_all_gateway_mcp_client() -> MultiServerMCPClient | None:
|
|
|
32
32
|
{{#each gatewayProviders}}
|
|
33
33
|
url = os.environ.get("{{envVarName}}")
|
|
34
34
|
if url:
|
|
35
|
-
|
|
35
|
+
{{#if (eq authType "AWS_IAM")}}
|
|
36
36
|
session = create_aws_session()
|
|
37
37
|
auth = SigV4HTTPXAuth(session.get_credentials(), "bedrock-agentcore", session.region_name)
|
|
38
|
-
servers["{{name}}"] = {"transport": "streamable_http", "url": url, "auth": auth}
|
|
39
|
-
|
|
38
|
+
servers["{{snakeCase name}}"] = {"transport": "streamable_http", "url": url, "auth": auth}
|
|
39
|
+
{{else if (eq authType "CUSTOM_JWT")}}
|
|
40
40
|
token = _get_bearer_token_{{snakeCase name}}()
|
|
41
41
|
headers = {"Authorization": f"Bearer {token}"} if token else None
|
|
42
|
-
servers["{{name}}"] = {"transport": "streamable_http", "url": url, "headers": headers}
|
|
43
|
-
|
|
44
|
-
servers["{{name}}"] = {"transport": "streamable_http", "url": url}
|
|
45
|
-
|
|
42
|
+
servers["{{snakeCase name}}"] = {"transport": "streamable_http", "url": url, "headers": headers}
|
|
43
|
+
{{else}}
|
|
44
|
+
servers["{{snakeCase name}}"] = {"transport": "streamable_http", "url": url}
|
|
45
|
+
{{/if}}
|
|
46
46
|
else:
|
|
47
47
|
logger.warning("{{envVarName}} not set — {{name}} gateway tools unavailable")
|
|
48
48
|
{{/each}}
|
|
49
49
|
if not servers:
|
|
50
50
|
return None
|
|
51
|
-
|
|
51
|
+
# tool_name_prefix namespaces each gateway's tools by server key so multiple
|
|
52
|
+
# gateways exposing the same tool (e.g. x_amz_bedrock_agentcore_search) don't collide.
|
|
53
|
+
return MultiServerMCPClient(servers, tool_name_prefix=True)
|
|
52
54
|
{{else}}
|
|
53
55
|
{{#if isVpc}}
|
|
54
56
|
# VPC mode: external MCP endpoints are not reachable without a NAT gateway.
|
|
@@ -9,13 +9,13 @@ description = "AgentCore Runtime Application using LangChain/LangGraph"
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"aws-opentelemetry-distro",
|
|
12
|
+
"aws-opentelemetry-distro ~= 0.18.0",
|
|
13
13
|
"opentelemetry-instrumentation-langchain >= 0.59.0",
|
|
14
14
|
"langgraph >= 1.0.2",
|
|
15
|
-
"mcp
|
|
16
|
-
"langchain-mcp-adapters >= 0.1
|
|
15
|
+
"mcp ~= 1.24.0",
|
|
16
|
+
"langchain-mcp-adapters >= 0.3.1",
|
|
17
17
|
"langchain >= 1.0.3",
|
|
18
|
-
"bedrock-agentcore >= 1.0
|
|
18
|
+
"bedrock-agentcore >= 1.8.0",
|
|
19
19
|
"botocore[crt] >= 1.35.0",
|
|
20
20
|
{{#if (eq modelProvider "Bedrock")}}
|
|
21
21
|
"langchain-aws >= 1.0.0",
|
|
@@ -28,6 +28,7 @@ dependencies = [
|
|
|
28
28
|
{{/if}}
|
|
29
29
|
{{#if (eq modelProvider "Gemini")}}
|
|
30
30
|
"langchain-google-genai >= 3.0.3",
|
|
31
|
+
"google-genai >= 1.0.0, < 2.0.0",
|
|
31
32
|
{{/if}}
|
|
32
33
|
{{#if hasGateway}}{{#if (includes gatewayAuthTypes "AWS_IAM")}}"mcp-proxy-for-aws >= 1.1.0",
|
|
33
34
|
{{/if}}{{/if}}
|
|
@@ -13,6 +13,11 @@ file defines a Starlette ASGI app with the OpenAI Agents SDK framework running w
|
|
|
13
13
|
|
|
14
14
|
`model/load.py` instantiates your chosen model provider (OpenAI).
|
|
15
15
|
|
|
16
|
+
## Input Validation
|
|
17
|
+
|
|
18
|
+
Validate invocation input before forwarding it to the agent framework. Keep plain prompts typed as strings and pass
|
|
19
|
+
only prompt text to the agent.
|
|
20
|
+
|
|
16
21
|
## Environment Variables
|
|
17
22
|
|
|
18
23
|
| Variable | Required | Description |
|
|
@@ -24,7 +29,8 @@ file defines a Starlette ASGI app with the OpenAI Agents SDK framework running w
|
|
|
24
29
|
|
|
25
30
|
If installation was successful, a virtual environment is already created with dependencies installed.
|
|
26
31
|
|
|
27
|
-
|
|
32
|
+
Activate the environment with `source .venv/bin/activate` on macOS/Linux, `.venv\Scripts\activate.bat` in Windows
|
|
33
|
+
Command Prompt, or `.\.venv\Scripts\activate.ps1` in Windows PowerShell.
|
|
28
34
|
|
|
29
35
|
`agentcore dev` will start a local server on 0.0.0.0:8080.
|
|
30
36
|
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
+
{{#if needsOs}}
|
|
1
2
|
import os
|
|
2
|
-
|
|
3
|
+
{{/if}}
|
|
4
|
+
{{#if hasGateway}}
|
|
5
|
+
from contextlib import AsyncExitStack
|
|
6
|
+
{{/if}}
|
|
7
|
+
from functools import lru_cache
|
|
8
|
+
from agents import Agent, Runner, SQLiteSession, function_tool
|
|
3
9
|
from bedrock_agentcore.runtime import BedrockAgentCoreApp
|
|
4
10
|
from model.load import load_model
|
|
5
11
|
{{#if hasGateway}}
|
|
@@ -37,19 +43,22 @@ def add_numbers(a: int, b: int) -> int:
|
|
|
37
43
|
|
|
38
44
|
tools = [add_numbers]
|
|
39
45
|
|
|
40
|
-
{{#if
|
|
41
|
-
|
|
46
|
+
{{#if needsOs}}
|
|
47
|
+
_MOUNT_PATHS = [
|
|
48
|
+
{{#if sessionStorageMountPath}}"{{sessionStorageMountPath}}",{{/if}}
|
|
49
|
+
{{#each efsMounts}}"{{mountPath}}",{{/each}}
|
|
50
|
+
{{#each s3Mounts}}"{{mountPath}}",{{/each}}
|
|
51
|
+
]
|
|
42
52
|
|
|
43
53
|
def _safe_resolve(path: str) -> str:
|
|
44
|
-
|
|
45
|
-
resolved
|
|
46
|
-
|
|
47
|
-
raise ValueError(f"Path '{path}' is outside the storage boundary")
|
|
54
|
+
resolved = os.path.realpath(path)
|
|
55
|
+
if not any(resolved == os.path.realpath(m) or resolved.startswith(os.path.realpath(m) + os.sep) for m in _MOUNT_PATHS):
|
|
56
|
+
raise ValueError(f"Path '{path}' is not within any configured mount ({', '.join(_MOUNT_PATHS)})")
|
|
48
57
|
return resolved
|
|
49
58
|
|
|
50
59
|
@function_tool
|
|
51
60
|
def file_read(path: str) -> str:
|
|
52
|
-
"""Read a file from
|
|
61
|
+
"""Read a file from a mounted filesystem. Use the absolute path (e.g. /mnt/tools/data.txt)."""
|
|
53
62
|
try:
|
|
54
63
|
full_path = _safe_resolve(path)
|
|
55
64
|
with open(full_path) as f:
|
|
@@ -61,7 +70,7 @@ def file_read(path: str) -> str:
|
|
|
61
70
|
|
|
62
71
|
@function_tool
|
|
63
72
|
def file_write(path: str, content: str) -> str:
|
|
64
|
-
"""Write
|
|
73
|
+
"""Write a file to a mounted filesystem. Use the absolute path (e.g. /mnt/tools/data.txt)."""
|
|
65
74
|
try:
|
|
66
75
|
full_path = _safe_resolve(path)
|
|
67
76
|
parent = os.path.dirname(full_path)
|
|
@@ -76,42 +85,60 @@ def file_write(path: str, content: str) -> str:
|
|
|
76
85
|
return f"Error writing '{path}': {e.strerror}"
|
|
77
86
|
|
|
78
87
|
@function_tool
|
|
79
|
-
def list_files(
|
|
80
|
-
"""List files in
|
|
88
|
+
def list_files(path: str) -> str:
|
|
89
|
+
"""List files in a mounted filesystem directory. Use the absolute path (e.g. /mnt/tools)."""
|
|
81
90
|
try:
|
|
82
|
-
|
|
83
|
-
entries = os.listdir(
|
|
91
|
+
full_path = _safe_resolve(path)
|
|
92
|
+
entries = os.listdir(full_path)
|
|
84
93
|
return "\n".join(entries) if entries else "(empty directory)"
|
|
85
94
|
except ValueError as e:
|
|
86
95
|
return str(e)
|
|
87
96
|
except OSError as e:
|
|
88
|
-
return f"Error listing '{
|
|
97
|
+
return f"Error listing '{path}': {e.strerror}"
|
|
89
98
|
|
|
90
99
|
tools.extend([file_read, file_write, list_files])
|
|
91
100
|
{{/if}}
|
|
92
101
|
|
|
93
102
|
INSTRUCTIONS = """
|
|
94
103
|
You are a helpful assistant. Use tools when appropriate.
|
|
95
|
-
{{#if
|
|
96
|
-
You have
|
|
97
|
-
{{
|
|
104
|
+
{{#if needsOs}}
|
|
105
|
+
You have access to the following mounted filesystems. Use file_read, file_write, and list_files with full absolute paths:
|
|
106
|
+
{{#if sessionStorageMountPath}}- {{sessionStorageMountPath}}: ephemeral session storage (lost when session ends)
|
|
107
|
+
{{/if}}{{#each efsMounts}}- {{mountPath}}: EFS persistent storage (persists across sessions and agent restarts)
|
|
108
|
+
{{/each}}{{#each s3Mounts}}- {{mountPath}}: S3 Files persistent storage (durable, backed by S3)
|
|
109
|
+
{{/each}}{{/if}}
|
|
98
110
|
"""
|
|
99
111
|
|
|
112
|
+
# Caches up to 128 active sessions; LRU eviction silently resets history for
|
|
113
|
+
# the oldest session. For production use, replace with a durable session store
|
|
114
|
+
# (e.g. SQLiteSession with a file path).
|
|
115
|
+
@lru_cache(maxsize=128)
|
|
116
|
+
def get_session(session_id):
|
|
117
|
+
return SQLiteSession(session_id)
|
|
118
|
+
|
|
119
|
+
|
|
100
120
|
# Define the agent execution
|
|
101
|
-
async def main(query):
|
|
121
|
+
async def main(query, session):
|
|
102
122
|
ensure_credentials_loaded()
|
|
103
123
|
try:
|
|
104
124
|
{{#if hasGateway}}
|
|
105
125
|
if mcp_servers:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
mcp_servers
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
126
|
+
# Connect every gateway server before the run; include_server_in_tool_names
|
|
127
|
+
# namespaces each server's tools so multiple gateways exposing the same tool
|
|
128
|
+
# (e.g. x_amz_bedrock_agentcore_search) don't collide.
|
|
129
|
+
async with AsyncExitStack() as stack:
|
|
130
|
+
for server in mcp_servers:
|
|
131
|
+
await stack.enter_async_context(server)
|
|
132
|
+
agent = Agent(
|
|
133
|
+
name="{{ name }}",
|
|
134
|
+
model="gpt-4.1",
|
|
135
|
+
instructions=INSTRUCTIONS,
|
|
136
|
+
mcp_servers=mcp_servers,
|
|
137
|
+
tools=tools,
|
|
138
|
+
mcp_config={"include_server_in_tool_names": True},
|
|
139
|
+
)
|
|
140
|
+
result = await Runner.run(agent, query, session=session)
|
|
141
|
+
return result
|
|
115
142
|
else:
|
|
116
143
|
agent = Agent(
|
|
117
144
|
name="{{ name }}",
|
|
@@ -120,7 +147,7 @@ async def main(query):
|
|
|
120
147
|
mcp_servers=[],
|
|
121
148
|
tools=tools
|
|
122
149
|
)
|
|
123
|
-
result = await Runner.run(agent, query)
|
|
150
|
+
result = await Runner.run(agent, query, session=session)
|
|
124
151
|
return result
|
|
125
152
|
{{else}}
|
|
126
153
|
if mcp_servers:
|
|
@@ -133,7 +160,7 @@ async def main(query):
|
|
|
133
160
|
mcp_servers=active_servers,
|
|
134
161
|
tools=tools
|
|
135
162
|
)
|
|
136
|
-
result = await Runner.run(agent, query)
|
|
163
|
+
result = await Runner.run(agent, query, session=session)
|
|
137
164
|
return result
|
|
138
165
|
else:
|
|
139
166
|
agent = Agent(
|
|
@@ -143,7 +170,7 @@ async def main(query):
|
|
|
143
170
|
mcp_servers=[],
|
|
144
171
|
tools=tools
|
|
145
172
|
)
|
|
146
|
-
result = await Runner.run(agent, query)
|
|
173
|
+
result = await Runner.run(agent, query, session=session)
|
|
147
174
|
return result
|
|
148
175
|
{{/if}}
|
|
149
176
|
except Exception as e:
|
|
@@ -157,9 +184,13 @@ async def invoke(payload, context):
|
|
|
157
184
|
|
|
158
185
|
# Process the user prompt
|
|
159
186
|
prompt = payload.get("prompt", "What can you help me with?")
|
|
187
|
+
if not isinstance(prompt, str):
|
|
188
|
+
raise ValueError("prompt must be a string")
|
|
189
|
+
session_id = getattr(context, "session_id", "default-session")
|
|
190
|
+
session = get_session(session_id)
|
|
160
191
|
|
|
161
|
-
# Run the agent
|
|
162
|
-
result = await main(prompt)
|
|
192
|
+
# Run the agent (session automatically loads/saves conversation history)
|
|
193
|
+
result = await main(prompt, session)
|
|
163
194
|
|
|
164
195
|
# Return result
|
|
165
196
|
return {"result": result.final_output}
|
|
@@ -33,20 +33,20 @@ def get_all_gateway_mcp_servers() -> list[MCPServerStreamableHttp]:
|
|
|
33
33
|
{{#each gatewayProviders}}
|
|
34
34
|
url = os.environ.get("{{envVarName}}")
|
|
35
35
|
if url:
|
|
36
|
-
|
|
36
|
+
{{#if (eq authType "AWS_IAM")}}
|
|
37
37
|
session = create_aws_session()
|
|
38
38
|
auth = SigV4HTTPXAuth(session.get_credentials(), "bedrock-agentcore", session.region_name)
|
|
39
39
|
servers.append(MCPServerStreamableHttp(
|
|
40
40
|
name="{{name}}",
|
|
41
41
|
params={"url": url, "httpx_client_factory": lambda **kwargs: httpx.AsyncClient(auth=auth, **kwargs)}
|
|
42
42
|
))
|
|
43
|
-
|
|
43
|
+
{{else if (eq authType "CUSTOM_JWT")}}
|
|
44
44
|
token = _get_bearer_token_{{snakeCase name}}()
|
|
45
45
|
headers = {"Authorization": f"Bearer {token}"} if token else {}
|
|
46
46
|
servers.append(MCPServerStreamableHttp(name="{{name}}", params={"url": url, "headers": headers}))
|
|
47
|
-
|
|
47
|
+
{{else}}
|
|
48
48
|
servers.append(MCPServerStreamableHttp(name="{{name}}", params={"url": url}))
|
|
49
|
-
|
|
49
|
+
{{/if}}
|
|
50
50
|
else:
|
|
51
51
|
logger.warning("{{envVarName}} not set — {{name}} gateway tools unavailable")
|
|
52
52
|
{{/each}}
|
|
@@ -9,9 +9,9 @@ description = "AgentCore Runtime Application using OpenAI Agents SDK"
|
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
11
11
|
dependencies = [
|
|
12
|
-
"aws-opentelemetry-distro",
|
|
13
|
-
"openai-agents >= 0.
|
|
14
|
-
"bedrock-agentcore >= 1.0
|
|
12
|
+
"aws-opentelemetry-distro ~= 0.18.0",
|
|
13
|
+
"openai-agents >= 0.16.0",
|
|
14
|
+
"bedrock-agentcore >= 1.8.0",
|
|
15
15
|
"botocore[crt] >= 1.35.0",
|
|
16
16
|
{{#if hasGateway}}{{#if (includes gatewayAuthTypes "AWS_IAM")}}"mcp-proxy-for-aws >= 1.1.0",
|
|
17
17
|
{{/if}}{{/if}}
|
|
@@ -13,6 +13,12 @@ file defines a Starlette ASGI app with the chosen Agent framework SDK running wi
|
|
|
13
13
|
|
|
14
14
|
`model/load.py` instantiates your chosen model provider.
|
|
15
15
|
|
|
16
|
+
## Input Validation
|
|
17
|
+
|
|
18
|
+
Validate invocation input before forwarding it to Strands. Keep plain prompts typed as strings. If the app accepts a
|
|
19
|
+
caller-supplied message history, retain `strip_trailing_tool_use()`, which normalizes the history tail before
|
|
20
|
+
invoking the agent.
|
|
21
|
+
|
|
16
22
|
## Environment Variables
|
|
17
23
|
|
|
18
24
|
| Variable | Required | Description |
|
|
@@ -24,7 +30,8 @@ file defines a Starlette ASGI app with the chosen Agent framework SDK running wi
|
|
|
24
30
|
|
|
25
31
|
If installation was successful, a virtual environment is already created with dependencies installed.
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
Activate the environment with `source .venv/bin/activate` on macOS/Linux, `.venv\Scripts\activate.bat` in Windows
|
|
34
|
+
Command Prompt, or `.\.venv\Scripts\activate.ps1` in Windows PowerShell.
|
|
28
35
|
|
|
29
36
|
`agentcore dev` will start a local server on 0.0.0.0:8080.
|
|
30
37
|
|