Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Add copy buttons to all
 blocks
(function() {
function addCopyButtons() {
document.querySelectorAll('pre code').forEach(function(codeBlock) {
if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;
codeBlock.parentElement.setAttribute('data-copy-added', 'true');
var btn = document.createElement('button');
btn.textContent = 'Copy';
btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';
btn.onmouseover = function() { this.style.opacity = '1'; };
btn.onmouseout = function() { this.style.opacity = '0.7'; };
btn.onclick = function() {
navigator.clipboard.writeText(codeBlock.textContent).then(function() {
btn.textContent = 'Copied!';
setTimeout(function() { btn.textContent = 'Copy'; }, 1500);
});
};
codeBlock.parentElement.style.position = 'relative';
codeBlock.parentElement.appendChild(btn);
});
}
addCopyButtons();
// Re-run on dynamic content
var observer = new MutationObserver(addCopyButtons);
observer.observe(document.body, { childList: true, subtree: true });
})();
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Force GitHub README to respect dark mode (function() { var style = document.createElement('style'); style.textContent = ' .markdown-body { color-scheme: dark light; } .markdown-body pre { background: #161b22 !important; } .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; } .markdown-body table th, .markdown-body table td { border-color: #30363d !important; } .markdown-body img { background: #0d1117; } .markdown-body blockquote { border-left-color: #8b949e; } .markdown-body hr { border-color: #30363d; } '; document.head.appendChild(style); })(); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Highlight search terms from Google/DuckDuckGo/Bing referrer (function() { var ref = document.referrer; var terms = []; if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) { var url = new URL(ref); var q = url.searchParams.get('q') || url.searchParams.get('p'); if (q) { terms = q.split(/\s+/).filter(function(t) { return t.length > 2; }); } } if (terms.length === 0) return; var style = document.createElement('style'); style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }'; document.head.appendChild(style); function highlight(node) { if (node.nodeType === 3) { // text node var text = node.textContent; var found = false; terms.forEach(function(term) { var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\]\\]/g, '\\') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ' feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ' feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock
, 'i'); if (__m === '*' || __re.test(location.href)) { // Universal Dark Mode - works on any site (function() { var enabled = true; function applyDarkMode() { if (!enabled) return; // Create style element if it doesn't exist var style = document.getElementById('universal-dark-mode-style'); if (!style) { style = document.createElement('style'); style.id = 'universal-dark-mode-style'; document.head.appendChild(style); } // Dark mode CSS - inverts colors but preserves images/video style.textContent = ' /* Invert everything except media */ html { filter: invert(1) hue-rotate(180deg) !important; background: #1a1a2e !important; } /* Restore images, videos, iframes, canvas */ img, video, iframe, canvas, svg, picture, [style*="background-image"] { filter: invert(1) hue-rotate(180deg) !important; } /* Preserve specific elements that should not be inverted */ .no-dark-mode, .no-dark-mode *, [data-theme="light"], [data-theme="light"], .ace_editor, .ace_editor *, .CodeMirror, .CodeMirror *, .monaco-editor, .monaco-editor *, .markdown-body pre, .markdown-body pre *, .highlight, .highlight *, pre code, pre code * { filter: none !important; } /* Fix common UI elements */ .modal, .popup, .dropdown-menu, .tooltip, .popover { filter: invert(1) hue-rotate(180deg) !important; background: #2d2d44 !important; border-color: #444 !important; } /* Scrollbars */ ::-webkit-scrollbar { background: #1a1a2e !important; } ::-webkit-scrollbar-thumb { background: #444 !important; } ::-webkit-scrollbar-thumb:hover { background: #555 !important; } /* Selection */ ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; } ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; } '; } function removeDarkMode() { var style = document.getElementById('universal-dark-mode-style'); if (style) style.remove(); } // Toggle with Alt+Shift+D document.addEventListener('keydown', function(e) { if (e.altKey && e.shiftKey && e.key === 'D') { e.preventDefault(); enabled = !enabled; if (enabled) { applyDarkMode(); console.log('[Universal Dark Mode] Enabled'); } else { removeDarkMode(); console.log('[Universal Dark Mode] Disabled'); } } }); // Apply on load applyDarkMode(); // Re-apply on dynamic content var observer = new MutationObserver(function(mutations) { if (enabled && !document.getElementById('universal-dark-mode-style')) { applyDarkMode(); } }); observer.observe(document.head, { childList: true }); console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle'); })(); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })(); feat(templates): add strands-ts TypeScript runtime template by Hweinstock · Pull Request #7 · Hweinstock/agentcore-cli · GitHub
Skip to content

feat(templates): add strands-ts TypeScript runtime template - #7

Closed
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template
Closed

feat(templates): add strands-ts TypeScript runtime template#7
Hweinstock wants to merge 7 commits into
refactorfrom
feat/strands-ts-template

Conversation

@Hweinstock

@HweinstockHweinstock commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Adds first-class TypeScript support to the CLI via a new strands-ts project template, ported from the upstream src/assets/typescript/http/strands assets and reformatted to match the Python template layout. Containers are intentionally out of scope for this PR (pending other work).

Stacked on top of aws#2116 (memory-in-templates) — base is memory-in-templates.

Spec

Problem

There is no support for TS. We want to first support strands TS templates from the original CLI (src/assets/typescript/http/strands). Containers are out of scope for the initial PR.

Definition of Done

  • agentcore project create --template strands-ts yields a working TypeScript agent, usable in agentcore project dev (curl in another terminal) and agentcore project deploy (invoke via aws cli).
  • Validation errors if you select typescript but not with strands (or other options).
  • Memory can be added and comes with the default option wired in; validation works with memory or no memory.

Details

What changed

  • src/assets/templates/strands-http-typescript/ — new template (main.ts, model/load.ts, mcp_client/client.ts, memory/memory.ts, package.json, tsconfig.json, gitignore.template, README.md). Handlebars-templated; memory variables rewired to this repo's render context (memoryEnvVarName / memoryStrategies / hasMemory), mirroring the Python strands-http-python template.
  • runtime.ts — new strands/TypeScript resolver (+ toNpmPackageName), mirroring the Python strands resolver (same memory-dir filter and spec shape).
  • shortcuts.ts — new strands-ts shortcut (CodeZip, NODE_22, longAndShortTerm memory).
  • types.ts / create / add runtime"TypeScript" added to the language enum. Unsupported language/framework combos (e.g. TypeScript without strands) are rejected by the template resolver — there's no strands/none × TypeScript resolver key, so getRuntimeTemplateResolver returns nothing and the caller raises an InputValidationError. runtimeVersion is derived per language in the handlers.
  • runtime.ts — the runtime spec entrypoint is derived from the language in buildRuntimeSpec (entrypointForLanguage: TypeScript → main.js, Python → main.py), rather than carried on the scaffold input.
  • manager.tsxinstallRuntimeDependencies gained a package.jsonnpm install branch.
  • codezip.tsproject dev maps a compiled .js entrypoint back to its .ts source for tsx watch.

Entrypoint note

The AgentCore NODE_22 runtime requires a .js entrypoint; the deploy packager (@aws/agentcore-cdk) compiles main.tsmain.js via esbuild at synth. So the runtime spec entrypoint is main.js while the scaffolded source is main.ts; project dev runs the .ts source directly.

package.json version pinning

Template dependencies are pinned with ~ (patch-only) to avoid pulling breaking minor bumps into customer projects.

Verification

Built the binary with bun run compile:linux-x64 and exercised the compiled CLI end to end against a dev AWS account (us-east-1).

Automated checks

bun run typecheck # clean
bun run lint:check # clean
bun run format:check # clean
bun test # 2217 pass, 0 fail (3 snapshots)

project dev + curl (headless)

$ agentcore project dev --mode headless --agent strands_agent --port 8081 --no-traces
... Server listening on port 8081
$ curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-e2e-session-000000000002' \
-d '{"prompt":"Reply with exactly: STRANDS_TS_DEV_OK"}'
data: "STRANDS_TS_DEV"
data: "_OK"

project deploy + aws cli invoke

$ agentcore project deploy --target default
... Deploying AgentCore-TsE2E-default
ApplicationAgentStrandsAgentRuntimeArnOutput...: arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id>
# CloudFormation: Runtime + Memory CREATE_COMPLETE
$ aws bedrock-agentcore invoke-agent-runtime --region us-east-1 \
--agent-runtime-arn arn:aws:bedrock-agentcore:us-east-1:<account>:runtime/TsE2E_strands_agent-<id> \
--runtime-session-id strands-ts-deploy-session-000000000000001 \
--payload fileb://payload.json --content-type application/json \
--accept text/event-stream out.txt
{ "runtimeSessionId": "...", "contentType": "text/event-stream", "statusCode": 200 }
$ cat out.txt
data: "STRANDS_TS_DEPLOY"
data: "_OK"

(Test stack deleted after verification.)

Validation — TypeScript without strands is rejected

$ agentcore project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock
Error: ✖ TypeScript runtimes are only supported with the strands framework
→ at framework

Memory works both ways: --memory none omits the memory/ dir and the memory import from main.ts; the default (longAndShortTerm) wires memory/memory.ts with MEMORY_<NAME>_ID and all four strategy namespaces.

How to test

git fetch fork feat/strands-ts-template && git checkout feat/strands-ts-template
bun install
bun test
bun run compile:linux-x64
BIN=./dist/bin/agentcore-linux-x64
# 1. Create + dev
mkdir /tmp/tsdemo && cd /tmp/tsdemo
$BIN project create --name TsDemo --template strands-ts --skip-git
cd TsDemo
$BIN project dev --mode headless --agent strands_agent --port 8081 --no-traces &
curl -sN -X POST http://127.0.0.1:8081/invocations \
-H 'Content-Type: application/json' -H 'Accept: text/event-stream' \
-H 'x-amzn-bedrock-agentcore-runtime-session-id: strands-ts-demo-session-000000000001' \
-d '{"prompt":"hello"}'
# 2. Validation error
$BIN project create --name Bad --language TypeScript --framework none \
--build CodeZip --model-provider Bedrock # -> validation error
# 3. Deploy (add a default target to agentcore/aws-targets.json, then)
$BIN project deploy --target default

@github-actionsgithub-actionsBot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 28, 2026
@@ -0,0 +1,29 @@
{

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these templates are copied as is from https://github.com/aws/agentcore-cli/tree/main/src/assets/typescript/http/strands. I think it'd be great to simplify here.

memory: MEMORY_SHORTCUTS[flags.memory ?? "longAndShortTerm"](runtimeName),
entrypoint: "main.py",
runtimeVersion: flags.build === "CodeZip" ? "PYTHON_3_14" : undefined,
entrypoint: flags.language === "TypeScript" ? "main.js" : "main.py",

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this is constant depending on the language, lets remove it from this interface and resolve it when we template the files.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 4b8e295 — removed entrypoint from ScaffoldRuntimeInput (and the shortcuts); it is now derived from the language in buildRuntimeSpec via entrypointForLanguage.

Comment threadsrc/handlers/project/types.ts Outdated
});
}
})
.superRefine(({ language, framework }, ctx) => {

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be rejected already later on when we try to resolve the template. i.e. in src/core/project/templates/runtime the key should not exist, and it should fail to find a resolver.

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in af204ac — removed the superRefine. none/TypeScript has no resolver key, so getRuntimeTemplateResolver returns nothing and the caller throws an InputValidationError (both create and add-runtime paths). Kept a test asserting the rejection.

Comment threadsrc/core/dev/codezip.ts Outdated

const [entrypoint] = input.runtime.entrypoint.split(":");
const entrypointPath = resolve(directory, entrypoint!);
// TypeScript runtimes deploy a compiled main.js but are developed from the

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets update this comment be clearer, something like:

// the spec stores `.js` to be compatible with deploy, but dev uses `tsx watch` on the source code. // therefore we take the `.ts` version of the entrypoint if it exists for dev, and fallback to the `.js` in case a project has a pure js entrypoint. 

Copy link
Copy Markdown
OwnerAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 8e2de34 — updated the comment to your wording.

@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 4b8e295 to 18d284cCompareAugust 28, 2026 17:45
@Hweinstock

Copy link
Copy Markdown
OwnerAuthor

Rebased onto the latest memory-in-templates (970ecac), which pulled in aws#2130's scaffold refactor. Reconstructed my changes on the new model:

Re-verified end-to-end on the new base with the compiled binary: create → dev (curl) → deploy → aws bedrock-agentcore invoke-agent-runtime (statusCode 200). Full suite: 2225 pass, typecheck/lint/format clean. Test stack torn down.

@Hweinstock
Hweinstock changed the base branch from memory-in-templates to refactorAugust 28, 2026 18:45
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 18d284c to 8a39389CompareAugust 28, 2026 18:52
@Hweinstock
Hweinstockforce-pushed the feat/strands-ts-template branch from 3042954 to bd35521CompareAugust 28, 2026 20:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@Hweinstock