@aws/agentcore 0.13.1 → 0.14.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.
Files changed (124) hide show
  1. package/README.md +6 -6
  2. package/dist/agent-inspector/index.css +1 -1
  3. package/dist/agent-inspector/index.js +79 -79
  4. package/dist/assets/__tests__/__snapshots__/assets.snapshot.test.ts.snap +628 -10
  5. package/dist/assets/__tests__/__snapshots__/dockerfile-render.test.ts.snap +6 -2
  6. package/dist/assets/cdk/test/cdk.test.ts +0 -1
  7. package/dist/assets/container/python/Dockerfile +3 -1
  8. package/dist/assets/container/typescript/Dockerfile +25 -0
  9. package/dist/assets/container/typescript/dockerignore.template +24 -0
  10. package/dist/assets/python/a2a/googleadk/base/pyproject.toml +2 -2
  11. package/dist/assets/python/a2a/langchain_langgraph/base/pyproject.toml +1 -1
  12. package/dist/assets/python/a2a/strands/base/pyproject.toml +2 -2
  13. package/dist/assets/python/agui/googleadk/base/pyproject.toml +1 -1
  14. package/dist/assets/python/agui/strands/base/pyproject.toml +1 -1
  15. package/dist/assets/python/http/googleadk/base/pyproject.toml +1 -1
  16. package/dist/assets/python/http/strands/base/pyproject.toml +1 -1
  17. package/dist/assets/typescript/http/strands/base/README.md +37 -0
  18. package/dist/assets/typescript/http/strands/base/gitignore.template +22 -0
  19. package/dist/assets/typescript/http/strands/base/main.ts +66 -0
  20. package/dist/assets/typescript/http/strands/base/mcp_client/client.ts +11 -0
  21. package/dist/assets/typescript/http/strands/base/model/load.ts +102 -0
  22. package/dist/assets/typescript/http/strands/base/package.json +37 -0
  23. package/dist/assets/typescript/http/strands/base/tsconfig.json +19 -0
  24. package/dist/assets/typescript/http/vercelai/base/README.md +37 -0
  25. package/dist/assets/typescript/http/vercelai/base/gitignore.template +22 -0
  26. package/dist/assets/typescript/http/vercelai/base/main.ts +24 -0
  27. package/dist/assets/typescript/http/vercelai/base/model/load.ts +121 -0
  28. package/dist/assets/typescript/http/vercelai/base/package.json +35 -0
  29. package/dist/assets/typescript/http/vercelai/base/tsconfig.json +19 -0
  30. package/dist/cli/index.mjs +679 -540
  31. package/dist/lib/errors/index.d.ts +1 -1
  32. package/dist/lib/errors/index.d.ts.map +1 -1
  33. package/dist/lib/errors/index.js +1 -1
  34. package/dist/lib/errors/index.js.map +1 -1
  35. package/dist/lib/errors/types.d.ts +183 -0
  36. package/dist/lib/errors/types.d.ts.map +1 -0
  37. package/dist/lib/errors/types.js +284 -0
  38. package/dist/lib/errors/types.js.map +1 -0
  39. package/dist/lib/errors/zod.d.ts +8 -0
  40. package/dist/lib/errors/zod.d.ts.map +1 -0
  41. package/dist/lib/errors/{config.js → zod.js} +7 -80
  42. package/dist/lib/errors/zod.js.map +1 -0
  43. package/dist/lib/index.d.ts +3 -0
  44. package/dist/lib/index.d.ts.map +1 -1
  45. package/dist/lib/index.js +4 -1
  46. package/dist/lib/index.js.map +1 -1
  47. package/dist/lib/packaging/container.js +5 -5
  48. package/dist/lib/packaging/container.js.map +1 -1
  49. package/dist/lib/packaging/helpers.d.ts +16 -0
  50. package/dist/lib/packaging/helpers.d.ts.map +1 -1
  51. package/dist/lib/packaging/helpers.js +71 -9
  52. package/dist/lib/packaging/helpers.js.map +1 -1
  53. package/dist/lib/packaging/index.d.ts +0 -1
  54. package/dist/lib/packaging/index.d.ts.map +1 -1
  55. package/dist/lib/packaging/index.js +4 -19
  56. package/dist/lib/packaging/index.js.map +1 -1
  57. package/dist/lib/packaging/node.d.ts +2 -2
  58. package/dist/lib/packaging/node.d.ts.map +1 -1
  59. package/dist/lib/packaging/node.js +83 -38
  60. package/dist/lib/packaging/node.js.map +1 -1
  61. package/dist/lib/packaging/python.js +12 -12
  62. package/dist/lib/packaging/python.js.map +1 -1
  63. package/dist/lib/result.d.ts +29 -0
  64. package/dist/lib/result.d.ts.map +1 -0
  65. package/dist/lib/result.js +16 -0
  66. package/dist/lib/result.js.map +1 -0
  67. package/dist/lib/schemas/io/config-io.d.ts.map +1 -1
  68. package/dist/lib/schemas/io/config-io.js +2 -2
  69. package/dist/lib/schemas/io/config-io.js.map +1 -1
  70. package/dist/lib/schemas/io/index.d.ts +1 -1
  71. package/dist/lib/schemas/io/index.d.ts.map +1 -1
  72. package/dist/lib/schemas/io/index.js +1 -2
  73. package/dist/lib/schemas/io/index.js.map +1 -1
  74. package/dist/lib/schemas/io/path-resolver.d.ts +0 -6
  75. package/dist/lib/schemas/io/path-resolver.d.ts.map +1 -1
  76. package/dist/lib/schemas/io/path-resolver.js +3 -13
  77. package/dist/lib/schemas/io/path-resolver.js.map +1 -1
  78. package/dist/lib/time-constants.d.ts +5 -0
  79. package/dist/lib/time-constants.d.ts.map +1 -0
  80. package/dist/lib/time-constants.js +8 -0
  81. package/dist/lib/time-constants.js.map +1 -0
  82. package/dist/lib/utils/index.d.ts +1 -0
  83. package/dist/lib/utils/index.d.ts.map +1 -1
  84. package/dist/lib/utils/index.js +4 -1
  85. package/dist/lib/utils/index.js.map +1 -1
  86. package/dist/lib/utils/polling.d.ts +31 -0
  87. package/dist/lib/utils/polling.d.ts.map +1 -0
  88. package/dist/lib/utils/polling.js +61 -0
  89. package/dist/lib/utils/polling.js.map +1 -0
  90. package/dist/schema/constants.d.ts +7 -0
  91. package/dist/schema/constants.d.ts.map +1 -1
  92. package/dist/schema/constants.js +18 -3
  93. package/dist/schema/constants.js.map +1 -1
  94. package/dist/schema/schemas/agent-env.d.ts +12 -1
  95. package/dist/schema/schemas/agent-env.d.ts.map +1 -1
  96. package/dist/schema/schemas/agent-env.js +32 -5
  97. package/dist/schema/schemas/agent-env.js.map +1 -1
  98. package/dist/schema/schemas/agentcore-project.d.ts +9 -3
  99. package/dist/schema/schemas/agentcore-project.d.ts.map +1 -1
  100. package/dist/schema/schemas/agentcore-project.js +7 -2
  101. package/dist/schema/schemas/agentcore-project.js.map +1 -1
  102. package/dist/schema/schemas/primitives/evaluator.d.ts +8 -0
  103. package/dist/schema/schemas/primitives/evaluator.d.ts.map +1 -1
  104. package/dist/schema/schemas/primitives/evaluator.js +17 -1
  105. package/dist/schema/schemas/primitives/evaluator.js.map +1 -1
  106. package/dist/schema/schemas/primitives/index.d.ts +1 -1
  107. package/dist/schema/schemas/primitives/index.d.ts.map +1 -1
  108. package/dist/schema/schemas/primitives/index.js +3 -1
  109. package/dist/schema/schemas/primitives/index.js.map +1 -1
  110. package/dist/schema/schemas/primitives/memory.d.ts +22 -4
  111. package/dist/schema/schemas/primitives/memory.d.ts.map +1 -1
  112. package/dist/schema/schemas/primitives/memory.js +57 -16
  113. package/dist/schema/schemas/primitives/memory.js.map +1 -1
  114. package/package.json +11 -9
  115. package/scripts/bump-version.ts +3 -3
  116. package/scripts/run-e2e-dev.sh +56 -0
  117. package/scripts/run-e2e-local.sh +1 -1
  118. package/dist/lib/errors/config.d.ts +0 -49
  119. package/dist/lib/errors/config.d.ts.map +0 -1
  120. package/dist/lib/errors/config.js.map +0 -1
  121. package/dist/lib/packaging/errors.d.ts +0 -16
  122. package/dist/lib/packaging/errors.d.ts.map +0 -1
  123. package/dist/lib/packaging/errors.js +0 -36
  124. package/dist/lib/packaging/errors.js.map +0 -1
@@ -382,7 +382,6 @@ test('AgentCoreStack synthesizes with empty spec', () => {
382
382
  credentials: [],
383
383
  evaluators: [],
384
384
  onlineEvalConfigs: [],
385
- configBundles: [],
386
385
  policyEngines: [],
387
386
  agentCoreGateways: [],
388
387
  mcpRuntimeTools: [],
@@ -447,6 +446,8 @@ exports[`Assets Directory Snapshots > File listing > should match the expected f
447
446
  "cdk/tsconfig.json",
448
447
  "container/python/Dockerfile",
449
448
  "container/python/dockerignore.template",
449
+ "container/typescript/Dockerfile",
450
+ "container/typescript/dockerignore.template",
450
451
  "evaluators/python-lambda/execution-role-policy.json",
451
452
  "evaluators/python-lambda/lambda_function.py",
452
453
  "evaluators/python-lambda/pyproject.toml",
@@ -543,6 +544,19 @@ exports[`Assets Directory Snapshots > File listing > should match the expected f
543
544
  "python/mcp/standalone/base/main.py",
544
545
  "python/mcp/standalone/base/pyproject.toml",
545
546
  "typescript/.gitkeep",
547
+ "typescript/http/strands/base/README.md",
548
+ "typescript/http/strands/base/gitignore.template",
549
+ "typescript/http/strands/base/main.ts",
550
+ "typescript/http/strands/base/mcp_client/client.ts",
551
+ "typescript/http/strands/base/model/load.ts",
552
+ "typescript/http/strands/base/package.json",
553
+ "typescript/http/strands/base/tsconfig.json",
554
+ "typescript/http/vercelai/base/README.md",
555
+ "typescript/http/vercelai/base/gitignore.template",
556
+ "typescript/http/vercelai/base/main.ts",
557
+ "typescript/http/vercelai/base/model/load.ts",
558
+ "typescript/http/vercelai/base/package.json",
559
+ "typescript/http/vercelai/base/tsconfig.json",
546
560
  ]
547
561
  `;
548
562
 
@@ -1164,10 +1178,10 @@ description = "AgentCore A2A Agent using Google ADK"
1164
1178
  readme = "README.md"
1165
1179
  requires-python = ">=3.10"
1166
1180
  dependencies = [
1167
- "a2a-sdk >= 0.2.0",
1181
+ "a2a-sdk >= 0.2.0, < 1.0.0",
1168
1182
  "aws-opentelemetry-distro",
1169
1183
  "bedrock-agentcore[a2a] >= 1.0.3",
1170
- "google-adk >= 1.0.0",
1184
+ "google-adk >= 1.0.0, < 2.0.0",
1171
1185
  "google-genai >= 1.0.0",
1172
1186
  ]
1173
1187
 
@@ -1525,7 +1539,7 @@ description = "AgentCore A2A Agent using LangChain + LangGraph"
1525
1539
  readme = "README.md"
1526
1540
  requires-python = ">=3.10"
1527
1541
  dependencies = [
1528
- "a2a-sdk >= 0.2.0",
1542
+ "a2a-sdk >= 0.2.0, < 1.0.0",
1529
1543
  {{#if (eq modelProvider "Anthropic")}}"langchain-anthropic >= 0.3.0",
1530
1544
  {{/if}}{{#if (eq modelProvider "Bedrock")}}"langchain-aws >= 0.2.0",
1531
1545
  {{/if}}{{#if (eq modelProvider "Gemini")}}"langchain-google-genai >= 2.0.0",
@@ -1869,9 +1883,9 @@ readme = "README.md"
1869
1883
  requires-python = ">=3.10"
1870
1884
  dependencies = [
1871
1885
  {{#if (eq modelProvider "Anthropic")}}"anthropic >= 0.30.0",
1872
- {{/if}}"a2a-sdk[all] >= 0.2.0",
1886
+ {{/if}}"a2a-sdk[all] >= 0.2.0, < 1.0.0",
1873
1887
  "aws-opentelemetry-distro",
1874
- "bedrock-agentcore[a2a] >= 1.0.3",
1888
+ "bedrock-agentcore[a2a] >= 1.9.1",
1875
1889
  "botocore[crt] >= 1.35.0",
1876
1890
  {{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
1877
1891
  {{/if}}{{#if (eq modelProvider "OpenAI")}}"openai >= 1.0.0",
@@ -2115,7 +2129,7 @@ dependencies = [
2115
2129
  "ag-ui-protocol >= 0.1.10",
2116
2130
  "bedrock-agentcore >= 1.0.3",
2117
2131
  "fastapi >= 0.115.12",
2118
- "google-adk >= 1.16.0",
2132
+ "google-adk >= 1.16.0, < 2.0.0",
2119
2133
  "google-genai >= 1.0.0",
2120
2134
  "opentelemetry-distro",
2121
2135
  "opentelemetry-exporter-otlp",
@@ -2708,7 +2722,7 @@ dependencies = [
2708
2722
  {{/if}}"ag-ui-strands >= 0.1.7",
2709
2723
  "ag-ui-protocol >= 0.1.10",
2710
2724
  "aws-opentelemetry-distro",
2711
- "bedrock-agentcore >= 1.0.3",
2725
+ "bedrock-agentcore >= 1.9.1",
2712
2726
  "botocore[crt] >= 1.35.0",
2713
2727
  "fastapi >= 0.115.12",
2714
2728
  {{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
@@ -3599,7 +3613,7 @@ requires-python = ">=3.10"
3599
3613
  dependencies = [
3600
3614
  "opentelemetry-distro",
3601
3615
  "opentelemetry-exporter-otlp",
3602
- "google-adk >= 1.17.0",
3616
+ "google-adk >= 1.17.0, < 2.0.0",
3603
3617
  "bedrock-agentcore >= 1.0.3",
3604
3618
  "botocore[crt] >= 1.35.0",
3605
3619
  {{#if hasGateway}}{{#if (includes gatewayAuthTypes "AWS_IAM")}}"mcp-proxy-for-aws >= 1.1.0",
@@ -5089,7 +5103,7 @@ requires-python = ">=3.10"
5089
5103
  dependencies = [
5090
5104
  {{#if (eq modelProvider "Anthropic")}}"anthropic >= 0.30.0",
5091
5105
  {{/if}}"aws-opentelemetry-distro",
5092
- "bedrock-agentcore >= 1.0.3",
5106
+ "bedrock-agentcore >= 1.9.1",
5093
5107
  "botocore[crt] >= 1.35.0",
5094
5108
  {{#if (eq modelProvider "Gemini")}}"google-genai >= 1.0.0",
5095
5109
  {{/if}}"mcp >= 1.19.0",
@@ -5609,3 +5623,607 @@ When modifying JSON config files:
5609
5623
  `;
5610
5624
 
5611
5625
  exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/.gitkeep should match snapshot 1`] = `""`;
5626
+
5627
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/README.md should match snapshot 1`] = `
5628
+ "This is a project generated by the AgentCore CLI!
5629
+
5630
+ # Layout
5631
+
5632
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
5633
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
5634
+ commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
5635
+
5636
+ ## Agent Root
5637
+
5638
+ The main entrypoint to your app is defined in \`main.ts\`. Using the AgentCore SDK \`BedrockAgentCoreApp\`, this file
5639
+ defines an HTTP server that streams tokens from your chosen Agent framework SDK.
5640
+
5641
+ \`model/load.ts\` instantiates your chosen model provider.
5642
+
5643
+ ## Environment Variables
5644
+
5645
+ | Variable | Required | Description |
5646
+ | --- | --- | --- |
5647
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
5648
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
5649
+
5650
+ # Developing locally
5651
+
5652
+ If installation was successful, \`node_modules/\` is already populated with dependencies.
5653
+
5654
+ \`agentcore dev\` will start a local server using \`npx tsx watch main.ts\` for hot reload. The port is logged to the terminal (default \`8080\`).
5655
+
5656
+ In a new terminal, you can invoke that server with:
5657
+
5658
+ \`agentcore invoke --dev "What can you do"\`
5659
+
5660
+ # Deployment
5661
+
5662
+ After providing credentials, \`agentcore deploy\` will deploy your project into Amazon Bedrock AgentCore.
5663
+
5664
+ Use \`agentcore invoke\` to invoke your deployed agent.
5665
+ "
5666
+ `;
5667
+
5668
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/gitignore.template should match snapshot 1`] = `
5669
+ "# Environment variables
5670
+ .env
5671
+ .env.*
5672
+
5673
+ # Node
5674
+ node_modules/
5675
+ dist/
5676
+ *.log
5677
+ npm-debug.log*
5678
+ yarn-debug.log*
5679
+ yarn-error.log*
5680
+
5681
+ # IDE
5682
+ .vscode/
5683
+ .idea/
5684
+ *.swp
5685
+ *.swo
5686
+ *~
5687
+
5688
+ # OS
5689
+ .DS_Store
5690
+ Thumbs.db
5691
+ "
5692
+ `;
5693
+
5694
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/main.ts should match snapshot 1`] = `
5695
+ "import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime';
5696
+ import { Agent, McpClient, tool, type ToolList } from '@strands-agents/sdk';
5697
+ import { z } from 'zod';
5698
+ import { loadModel } from './model/load.js';
5699
+ import { getStreamableHttpMcpClient } from './mcp_client/client.js';
5700
+
5701
+ // Define a collection of MCP clients (filter out anything that failed to initialize)
5702
+ const mcpClients: McpClient[] = [getStreamableHttpMcpClient()].filter(
5703
+ (client): client is McpClient => Boolean(client)
5704
+ );
5705
+
5706
+ // Define a collection of tools used by the model
5707
+ const tools: ToolList = [];
5708
+
5709
+ // Define a simple function tool — the Zod schema gives us type inference and runtime validation for free
5710
+ const addNumbers = tool({
5711
+ name: 'add_numbers',
5712
+ description: 'Return the sum of two numbers',
5713
+ inputSchema: z.object({
5714
+ a: z.number(),
5715
+ b: z.number(),
5716
+ }),
5717
+ callback: async ({ a, b }) => a + b,
5718
+ });
5719
+ tools.push(addNumbers);
5720
+
5721
+ // Add MCP clients to tools
5722
+ tools.push(...mcpClients);
5723
+
5724
+ const SYSTEM_PROMPT = \`
5725
+ You are a helpful assistant. Use tools when appropriate.
5726
+ \`;
5727
+
5728
+ let cachedAgent: Agent | null = null;
5729
+
5730
+ async function getOrCreateAgent(): Promise<Agent> {
5731
+ if (!cachedAgent) {
5732
+ const model = await loadModel();
5733
+ cachedAgent = new Agent({
5734
+ model,
5735
+ systemPrompt: SYSTEM_PROMPT,
5736
+ tools,
5737
+ });
5738
+ }
5739
+ return cachedAgent;
5740
+ }
5741
+
5742
+ const app = new BedrockAgentCoreApp({
5743
+ invocationHandler: {
5744
+ async *process(payload: any, context: any) {
5745
+ const agent = await getOrCreateAgent();
5746
+
5747
+ for await (const event of agent.stream(payload.prompt ?? '')) {
5748
+ if (
5749
+ event.type === 'modelStreamUpdateEvent' &&
5750
+ event.event?.type === 'modelContentBlockDeltaEvent' &&
5751
+ event.event.delta?.type === 'textDelta'
5752
+ ) {
5753
+ yield { data: event.event.delta.text };
5754
+ }
5755
+ }
5756
+ },
5757
+ },
5758
+ });
5759
+
5760
+ app.run({ port: parseInt(process.env.PORT ?? '8080') });
5761
+ "
5762
+ `;
5763
+
5764
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/mcp_client/client.ts should match snapshot 1`] = `
5765
+ "import { McpClient } from '@strands-agents/sdk';
5766
+ import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
5767
+
5768
+ // ExaAI provides information about code through web searches, crawling and code context searches through their platform. Requires no authentication
5769
+ const EXAMPLE_MCP_ENDPOINT = 'https://mcp.exa.ai/mcp';
5770
+
5771
+ export function getStreamableHttpMcpClient(): McpClient {
5772
+ // to use an MCP server that supports bearer authentication, add a headers() callback to requestInit
5773
+ const transport = new StreamableHTTPClientTransport(new URL(EXAMPLE_MCP_ENDPOINT));
5774
+ return new McpClient({ transport });
5775
+ }
5776
+ "
5777
+ `;
5778
+
5779
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/model/load.ts should match snapshot 1`] = `
5780
+ "{{#if (eq modelProvider "Bedrock")}}
5781
+ import { BedrockModel } from '@strands-agents/sdk/models/bedrock';
5782
+
5783
+ export function loadModel(): BedrockModel {
5784
+ return new BedrockModel({ modelId: 'global.anthropic.claude-sonnet-4-5-20250929-v1:0' });
5785
+ }
5786
+ {{/if}}
5787
+ {{#if (eq modelProvider "Anthropic")}}
5788
+ import { AnthropicModel } from '@strands-agents/sdk/models/anthropic';
5789
+ import { withApiKey } from 'bedrock-agentcore/identity';
5790
+
5791
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
5792
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
5793
+
5794
+ async function getApiKey(): Promise<string> {
5795
+ if (process.env.LOCAL_DEV === '1') {
5796
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.ANTHROPIC_API_KEY;
5797
+ if (!apiKey) {
5798
+ throw new Error(\`\${IDENTITY_ENV_VAR} or ANTHROPIC_API_KEY not found. Add your key to agentcore/.env.local\`);
5799
+ }
5800
+ return apiKey;
5801
+ }
5802
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
5803
+ }
5804
+
5805
+ let _model: AnthropicModel | undefined;
5806
+
5807
+ export async function loadModel(): Promise<AnthropicModel> {
5808
+ if (!_model) {
5809
+ const apiKey = await getApiKey();
5810
+ _model = new AnthropicModel({
5811
+ apiKey,
5812
+ modelId: 'claude-sonnet-4-5-20250929',
5813
+ maxTokens: 5000,
5814
+ });
5815
+ }
5816
+ return _model;
5817
+ }
5818
+ {{/if}}
5819
+ {{#if (eq modelProvider "OpenAI")}}
5820
+ import { OpenAIModel } from '@strands-agents/sdk/models/openai';
5821
+ import { withApiKey } from 'bedrock-agentcore/identity';
5822
+
5823
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
5824
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
5825
+
5826
+ async function getApiKey(): Promise<string> {
5827
+ if (process.env.LOCAL_DEV === '1') {
5828
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.OPENAI_API_KEY;
5829
+ if (!apiKey) {
5830
+ throw new Error(\`\${IDENTITY_ENV_VAR} or OPENAI_API_KEY not found. Add your key to agentcore/.env.local\`);
5831
+ }
5832
+ return apiKey;
5833
+ }
5834
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
5835
+ }
5836
+
5837
+ let _model: OpenAIModel | undefined;
5838
+
5839
+ export async function loadModel(): Promise<OpenAIModel> {
5840
+ if (!_model) {
5841
+ const apiKey = await getApiKey();
5842
+ _model = new OpenAIModel({
5843
+ api: 'chat',
5844
+ apiKey,
5845
+ modelId: 'gpt-4.1',
5846
+ });
5847
+ }
5848
+ return _model;
5849
+ }
5850
+ {{/if}}
5851
+ {{#if (eq modelProvider "Gemini")}}
5852
+ import { GoogleModel } from '@strands-agents/sdk/models/google';
5853
+ import { withApiKey } from 'bedrock-agentcore/identity';
5854
+
5855
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
5856
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
5857
+
5858
+ async function getApiKey(): Promise<string> {
5859
+ if (process.env.LOCAL_DEV === '1') {
5860
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.GEMINI_API_KEY;
5861
+ if (!apiKey) {
5862
+ throw new Error(\`\${IDENTITY_ENV_VAR} or GEMINI_API_KEY not found. Add your key to agentcore/.env.local\`);
5863
+ }
5864
+ return apiKey;
5865
+ }
5866
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
5867
+ }
5868
+
5869
+ let _model: GoogleModel | undefined;
5870
+
5871
+ export async function loadModel(): Promise<GoogleModel> {
5872
+ if (!_model) {
5873
+ const apiKey = await getApiKey();
5874
+ _model = new GoogleModel({
5875
+ apiKey,
5876
+ modelId: 'gemini-2.5-flash',
5877
+ });
5878
+ }
5879
+ return _model;
5880
+ }
5881
+ {{/if}}
5882
+ "
5883
+ `;
5884
+
5885
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/package.json should match snapshot 1`] = `
5886
+ "{
5887
+ "name": "{{name}}",
5888
+ "version": "0.1.0",
5889
+ "description": "AgentCore Runtime Application using Strands TypeScript SDK",
5890
+ "private": true,
5891
+ "type": "module",
5892
+ "scripts": {
5893
+ "build": "tsc",
5894
+ "start": "node dist/main.js",
5895
+ "dev": "tsx watch main.ts"
5896
+ },
5897
+ "dependencies": {
5898
+ {{#if (eq modelProvider "Anthropic")}}
5899
+ "@anthropic-ai/sdk": "^0.71.2",
5900
+ {{/if}}
5901
+ {{#if (eq modelProvider "OpenAI")}}
5902
+ "openai": "^6.7.0",
5903
+ {{/if}}
5904
+ {{#if (eq modelProvider "Gemini")}}
5905
+ "@google/genai": "^1.40.0",
5906
+ {{/if}}
5907
+ "@modelcontextprotocol/sdk": "^1.25.2",
5908
+ "@strands-agents/sdk": "1.0.0-rc.4",
5909
+ "bedrock-agentcore": "^0.2.4",
5910
+ "tsx": "^4.19.0",
5911
+ "zod": "^4.4.3"
5912
+ },
5913
+ "devDependencies": {
5914
+ "@types/node": "^22.0.0",
5915
+ "typescript": "^5.6.0"
5916
+ },
5917
+ "overrides": {
5918
+ "bedrock-agentcore": {
5919
+ "@strands-agents/sdk": "$@strands-agents/sdk"
5920
+ }
5921
+ }
5922
+ }
5923
+ "
5924
+ `;
5925
+
5926
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/strands/base/tsconfig.json should match snapshot 1`] = `
5927
+ "{
5928
+ "compilerOptions": {
5929
+ "target": "ES2022",
5930
+ "module": "NodeNext",
5931
+ "moduleResolution": "NodeNext",
5932
+ "strict": true,
5933
+ "esModuleInterop": true,
5934
+ "skipLibCheck": true,
5935
+ "forceConsistentCasingInFileNames": true,
5936
+ "resolveJsonModule": true,
5937
+ "declaration": false,
5938
+ "sourceMap": true,
5939
+ "outDir": "dist",
5940
+ "rootDir": ".",
5941
+ "types": ["node"]
5942
+ },
5943
+ "include": ["**/*.ts"],
5944
+ "exclude": ["node_modules", "dist"]
5945
+ }
5946
+ "
5947
+ `;
5948
+
5949
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/README.md should match snapshot 1`] = `
5950
+ "This is a project generated by the AgentCore CLI!
5951
+
5952
+ # Layout
5953
+
5954
+ The generated application code lives at the agent root directory. At the root, there is a \`.gitignore\` file, an
5955
+ \`agentcore/\` folder which represents the configurations and state associated with this project. Other \`agentcore\`
5956
+ commands like \`deploy\`, \`dev\`, and \`invoke\` rely on the configuration stored here.
5957
+
5958
+ ## Agent Root
5959
+
5960
+ The main entrypoint to your app is defined in \`main.ts\`. Using the AgentCore SDK \`BedrockAgentCoreApp\`, this file
5961
+ defines an HTTP app that streams tokens using the Vercel AI SDK's \`streamText\` API.
5962
+
5963
+ \`model/load.ts\` instantiates your chosen model provider.
5964
+
5965
+ ## Environment Variables
5966
+
5967
+ | Variable | Required | Description |
5968
+ | --- | --- | --- |
5969
+ {{#if hasIdentity}}| \`{{identityProviders.[0].envVarName}}\` | Yes | {{modelProvider}} API key (local) or Identity provider name (deployed) |
5970
+ {{/if}}| \`LOCAL_DEV\` | No | Set to \`1\` to use \`.env.local\` instead of AgentCore Identity |
5971
+
5972
+ # Developing locally
5973
+
5974
+ If installation was successful, \`node_modules/\` is already populated with dependencies.
5975
+
5976
+ \`agentcore dev\` will start a local server using \`npx tsx watch main.ts\` for hot reload. The port is logged to the terminal (default \`8080\`).
5977
+
5978
+ In a new terminal, you can invoke that server with:
5979
+
5980
+ \`agentcore invoke --dev "What can you do"\`
5981
+
5982
+ # Deployment
5983
+
5984
+ After providing credentials, \`agentcore deploy\` will deploy your project into Amazon Bedrock AgentCore.
5985
+
5986
+ Use \`agentcore invoke\` to invoke your deployed agent.
5987
+ "
5988
+ `;
5989
+
5990
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/gitignore.template should match snapshot 1`] = `
5991
+ "# Environment variables
5992
+ .env
5993
+ .env.*
5994
+
5995
+ # Node
5996
+ node_modules/
5997
+ dist/
5998
+ *.log
5999
+ npm-debug.log*
6000
+ yarn-debug.log*
6001
+ yarn-error.log*
6002
+
6003
+ # IDE
6004
+ .vscode/
6005
+ .idea/
6006
+ *.swp
6007
+ *.swo
6008
+ *~
6009
+
6010
+ # OS
6011
+ .DS_Store
6012
+ Thumbs.db
6013
+ "
6014
+ `;
6015
+
6016
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/main.ts should match snapshot 1`] = `
6017
+ "import { BedrockAgentCoreApp } from 'bedrock-agentcore/runtime';
6018
+ import { streamText } from 'ai';
6019
+ import { loadModel } from './model/load.js';
6020
+
6021
+ const SYSTEM_PROMPT = \`You are a helpful assistant.\`;
6022
+
6023
+ const app = new BedrockAgentCoreApp({
6024
+ invocationHandler: {
6025
+ async *process(payload: any, context: any) {
6026
+ const model = await loadModel();
6027
+ const result = streamText({
6028
+ model,
6029
+ system: SYSTEM_PROMPT,
6030
+ prompt: payload.prompt ?? '',
6031
+ });
6032
+
6033
+ for await (const chunk of result.textStream) {
6034
+ yield { data: chunk };
6035
+ }
6036
+ },
6037
+ },
6038
+ });
6039
+
6040
+ app.run({ port: parseInt(process.env.PORT ?? '8080') });
6041
+ "
6042
+ `;
6043
+
6044
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/model/load.ts should match snapshot 1`] = `
6045
+ "{{#if (eq modelProvider "Bedrock")}}
6046
+ import { createAmazonBedrock } from '@ai-sdk/amazon-bedrock';
6047
+ import { fromNodeProviderChain } from '@aws-sdk/credential-providers';
6048
+
6049
+ const provider = fromNodeProviderChain();
6050
+
6051
+ const bedrock = createAmazonBedrock({
6052
+ region: process.env.AWS_REGION ?? 'us-east-1',
6053
+ credentialProvider: async () => {
6054
+ const creds = await provider();
6055
+ return {
6056
+ accessKeyId: creds.accessKeyId,
6057
+ secretAccessKey: creds.secretAccessKey,
6058
+ sessionToken: creds.sessionToken,
6059
+ };
6060
+ },
6061
+ });
6062
+
6063
+ export function loadModel() {
6064
+ return bedrock('us.anthropic.claude-sonnet-4-5-20250929-v1:0');
6065
+ }
6066
+ {{/if}}
6067
+ {{#if (eq modelProvider "Anthropic")}}
6068
+ import { createAnthropic } from '@ai-sdk/anthropic';
6069
+ import { withApiKey } from 'bedrock-agentcore/identity';
6070
+
6071
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
6072
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
6073
+
6074
+ async function getApiKey(): Promise<string> {
6075
+ if (process.env.LOCAL_DEV === '1') {
6076
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.ANTHROPIC_API_KEY;
6077
+ if (!apiKey) {
6078
+ throw new Error(\`\${IDENTITY_ENV_VAR} or ANTHROPIC_API_KEY not found. Add your key to agentcore/.env.local\`);
6079
+ }
6080
+ return apiKey;
6081
+ }
6082
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
6083
+ }
6084
+
6085
+ let _anthropic: ReturnType<typeof createAnthropic> | undefined;
6086
+
6087
+ async function getProvider() {
6088
+ if (!_anthropic) {
6089
+ const apiKey = await getApiKey();
6090
+ _anthropic = createAnthropic({ apiKey });
6091
+ }
6092
+ return _anthropic;
6093
+ }
6094
+
6095
+ export async function loadModel() {
6096
+ const anthropic = await getProvider();
6097
+ return anthropic('claude-sonnet-4-5-20250929');
6098
+ }
6099
+ {{/if}}
6100
+ {{#if (eq modelProvider "OpenAI")}}
6101
+ import { createOpenAI } from '@ai-sdk/openai';
6102
+ import { withApiKey } from 'bedrock-agentcore/identity';
6103
+
6104
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
6105
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
6106
+
6107
+ async function getApiKey(): Promise<string> {
6108
+ if (process.env.LOCAL_DEV === '1') {
6109
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.OPENAI_API_KEY;
6110
+ if (!apiKey) {
6111
+ throw new Error(\`\${IDENTITY_ENV_VAR} or OPENAI_API_KEY not found. Add your key to agentcore/.env.local\`);
6112
+ }
6113
+ return apiKey;
6114
+ }
6115
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
6116
+ }
6117
+
6118
+ let _openai: ReturnType<typeof createOpenAI> | undefined;
6119
+
6120
+ async function getProvider() {
6121
+ if (!_openai) {
6122
+ const apiKey = await getApiKey();
6123
+ _openai = createOpenAI({ apiKey });
6124
+ }
6125
+ return _openai;
6126
+ }
6127
+
6128
+ export async function loadModel() {
6129
+ const openai = await getProvider();
6130
+ return openai('gpt-4.1');
6131
+ }
6132
+ {{/if}}
6133
+ {{#if (eq modelProvider "Gemini")}}
6134
+ import { createGoogleGenerativeAI } from '@ai-sdk/google';
6135
+ import { withApiKey } from 'bedrock-agentcore/identity';
6136
+
6137
+ const IDENTITY_PROVIDER_NAME = '{{identityProviders.[0].name}}';
6138
+ const IDENTITY_ENV_VAR = '{{identityProviders.[0].envVarName}}';
6139
+
6140
+ async function getApiKey(): Promise<string> {
6141
+ if (process.env.LOCAL_DEV === '1') {
6142
+ const apiKey = process.env[IDENTITY_ENV_VAR] ?? process.env.GEMINI_API_KEY;
6143
+ if (!apiKey) {
6144
+ throw new Error(\`\${IDENTITY_ENV_VAR} or GEMINI_API_KEY not found. Add your key to agentcore/.env.local\`);
6145
+ }
6146
+ return apiKey;
6147
+ }
6148
+ return withApiKey({ providerName: IDENTITY_PROVIDER_NAME })(async (apiKey: string) => apiKey)();
6149
+ }
6150
+
6151
+ let _google: ReturnType<typeof createGoogleGenerativeAI> | undefined;
6152
+
6153
+ async function getProvider() {
6154
+ if (!_google) {
6155
+ const apiKey = await getApiKey();
6156
+ _google = createGoogleGenerativeAI({ apiKey });
6157
+ }
6158
+ return _google;
6159
+ }
6160
+
6161
+ export async function loadModel() {
6162
+ const google = await getProvider();
6163
+ return google('gemini-2.5-flash');
6164
+ }
6165
+ {{/if}}
6166
+ "
6167
+ `;
6168
+
6169
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/package.json should match snapshot 1`] = `
6170
+ "{
6171
+ "name": "{{name}}",
6172
+ "version": "0.1.0",
6173
+ "description": "AgentCore Runtime Application using Vercel AI SDK",
6174
+ "private": true,
6175
+ "type": "module",
6176
+ "scripts": {
6177
+ "build": "tsc",
6178
+ "start": "node dist/main.js",
6179
+ "dev": "tsx watch main.ts"
6180
+ },
6181
+ "dependencies": {
6182
+ "ai": "^6.0.0",
6183
+ {{#if (eq modelProvider "Bedrock")}}
6184
+ "@ai-sdk/amazon-bedrock": "^4.0.0",
6185
+ "@aws-sdk/credential-providers": "^3.0.0",
6186
+ {{/if}}
6187
+ {{#if (eq modelProvider "Anthropic")}}
6188
+ "@ai-sdk/anthropic": "^3.0.0",
6189
+ {{/if}}
6190
+ {{#if (eq modelProvider "OpenAI")}}
6191
+ "@ai-sdk/openai": "^3.0.0",
6192
+ {{/if}}
6193
+ {{#if (eq modelProvider "Gemini")}}
6194
+ "@ai-sdk/google": "^3.0.0",
6195
+ {{/if}}
6196
+ "bedrock-agentcore": "^0.2.4",
6197
+ "tsx": "^4.19.0",
6198
+ "zod": "^3.24.0"
6199
+ },
6200
+ "devDependencies": {
6201
+ "@types/node": "^22.0.0",
6202
+ "typescript": "^5.6.0"
6203
+ }
6204
+ }
6205
+ "
6206
+ `;
6207
+
6208
+ exports[`Assets Directory Snapshots > TypeScript assets > typescript/typescript/http/vercelai/base/tsconfig.json should match snapshot 1`] = `
6209
+ "{
6210
+ "compilerOptions": {
6211
+ "target": "ES2022",
6212
+ "module": "NodeNext",
6213
+ "moduleResolution": "NodeNext",
6214
+ "strict": true,
6215
+ "esModuleInterop": true,
6216
+ "skipLibCheck": true,
6217
+ "forceConsistentCasingInFileNames": true,
6218
+ "resolveJsonModule": true,
6219
+ "declaration": false,
6220
+ "sourceMap": true,
6221
+ "outDir": "dist",
6222
+ "rootDir": ".",
6223
+ "types": ["node"]
6224
+ },
6225
+ "include": ["**/*.ts"],
6226
+ "exclude": ["node_modules", "dist"]
6227
+ }
6228
+ "
6229
+ `;