refactor(templates): simplify agent-typescript-strands to a barebones agent - #23
Closed
Hweinstock wants to merge 2 commits into
Closed
refactor(templates): simplify agent-typescript-strands to a barebones agent#23Hweinstock wants to merge 2 commits into
Hweinstock wants to merge 2 commits into
Conversation
… in agent-typescript-strands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec
Problem: The
agent-typescript-strandstemplate has too many parameters on therefactorbranch, making it hard to read, extend, and understand.Definition of done:
Verification (spec): create a CodeZip runtime + add a Container runtime, run dev for each and invoke locally, deploy to AWS and invoke via the CLI/AWS CLI; do both across the memory options; and verify a non-Bedrock (Gemini) provider works. This is the TypeScript analog of the merged Python PR aws#2179.
Changes
1.
refactor: reduceagent-typescript-strandsto a barebones agent — mirrors aws#2179 for TypeScript.mcp_client/client.ts, stripped the MCP import/usage frommain.ts, dropped@modelcontextprotocol/sdkfrompackage.json.template, updated themanager.test.tssnapshot.runtime.tswas already minimal — it never carried the gateway/payment/VPC/filesystem context that refactor(templates): simplify strands python agent to barebones agent aws/agentcore-cli#2179 stripped from the Python resolver — so noruntime.tschange was needed. The template now renders onlyname,memory(+ strategies), andmodelProvider(+ identity providers). Memory continues to use the AgentCoreMemoryManagersession manager.2.
fix: pass the workload identity token to non-Bedrock providers — discovered during the Gemini deploy verification; a pre-existing bug in the non-Bedrock deploy path (not caused by the simplification).workloadIdentityToken not provided and no context available. The template relied onwithApiKey's implicitgetContext()fallback, which is unreliable inside a streamed async generator; and the pinnedbedrock-agentcore ~0.3.0read only the legacy WAT header.context.workloadAccessTokenfrom the handler inmain.ts→getOrCreateAgent→loadModel(workloadIdentityToken)→withApiKey({ providerName, workloadIdentityToken })(all four provider branches; Bedrock accepts and ignores the param), and bump the SDK pin to~0.4.3(reads the current WAT header). Deployed non-Bedrock providers must be invoked with a runtime user id (--user-id), which triggers the runtime to mint & deliver the WAT.How to test
Verification evidence (dev account, us-east-1)
Barebones scaffold — generated source is just
main.ts,memory/memory.ts,model/load.ts,package.json,tsconfig.json(+ README/.gitignore); nomcp_client/, no@modelcontextprotocol/sdk.Memory options (TS):
noneandlongAndShortTermscaffold, deploy, and invoke.shortTermis rejected with a clear, pre-existing validation error (the TS SDK'screateAgentCoreMemoryStoresrequires ≥1 long-term namespace):Local dev (final template, all three invokable):
AWS deploy: stack
AgentCore-simpleTsStrands-default→CREATE_COMPLETE(3 runtimes + AgentCore Memory + Gemini credential provider).Deployed invoke (all HTTP 200):
Notes
oxlint --fix→ "No files found to lint" because template/snapshot paths are oxlint-ignored); committed with--no-verifyafter runningtypecheck/lint:check/format:check/ fullbun test(2824 pass) on the whole tree. CI re-runs them.