Repository navigation
fix(typescript): install the SDK from npm in 02, 03, 05 and 06, and migrate to the 1.x API - #317
Merged
manoj-selvakumar5 merged 4 commits intoOct 14, 2026
Conversation
added 4 commits
September 30, 2026 06:57
…e booking flow work Depend on @strands-agents/sdk ^1.19.0 instead of the archived GitHub repo, and on better-sqlite3 ^13 (11.x does not build on current Node) and zod (imported directly, previously only transitive). Give the agent today's date so it can resolve "tomorrow" and actually call create_appointment; without it the agent asked for the date and never booked. Turn off the agent's own printer so each labelled reply prints once, exit 1 on failure, and document Node.js 22+. Refs strands-agents#314
…te moved imports Depend on @strands-agents/sdk ^1.19.0 and its openai ^6.45 peer. OpenAIModel and httpRequest moved to @strands-agents/sdk/models/openai and @strands-agents/sdk/vended-tools/http-request. Read chat input with for-await so the loop ends cleanly when input closes instead of throwing ERR_USE_AFTER_CLOSE, exit 1 on failure, and document Node.js 22+. Refs strands-agents#314
…to appState and addHook Depend on @strands-agents/sdk ^1.19.0. Agent state is now appState (config and agent.appState), and hooks are registered with agent.addHook(Event, callback) instead of agent.hooks.addCallback. Read chat input with for-await so the loop ends cleanly when input closes, exit 1 on failure, and document Node.js 22+. Refs strands-agents#314
…reaming Depend on @strands-agents/sdk ^1.19.0 and openai ^6.45 (openai 4.x peer-requires zod 3, which conflicts with the SDK's zod 4 and fails npm install). Update the OpenAIModel import path. Model deltas now arrive inside modelStreamUpdateEvent, so the old check never matched and every reply showed "No response received."; unwrap the event. Pin the Bedrock model and document Node.js 22+. Refs strands-agents#314
Contributor
Author
|
@mvangara10 @yonib05 this follows up #315 and fixes the other four TypeScript samples from #314. They all need the npm SDK, and each also needed a small 1.x API migration. There is one commit per sample, and the description has a table for each one showing what broke, the fix, and how I tested it end to end. Two of the fixes are for bugs that fail silently: |
manoj-selvakumar5
approved these changes
Oct 14, 2026
|
Latest scan for commit: ✅ Security Scan Report (PR Files Only)Scanned Files
Security Scan Results
Threshold: High No security issues detected in your changes. Great job! This scan only covers files changed in this PR. |
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.
Summary
Fixes the other four TypeScript samples listed in #314:
02-custom-tools03-model-providers05-agent-state06-browser-agentAll four depended on the archived
strands-agents/sdk-typescriptrepo, so none of them installed a working SDK. Once moved to the published@strands-agents/sdk1.19.0, each hit its own breakage from the SDK's pre-1.0 to 1.x API changes. Each is fixed here, and each sample was run end to end.This PR is independent of #315 (
01-first-agent). The two can be reviewed and merged in either order. There is one commit per sample, so they can be reviewed one at a time.Refs #314
Common change (all four)
"@strands-agents/sdk": "^1.19.0"instead ofgithub:strands-agents/sdk-typescriptorgit+ssh://…sdk-typescript.gitmainholds a private workspace root (strands0.0.0), not the SDK, so the import fails. Thegit+sshform also needed a GitHub SSH key to install."engines": { "node": ">=22" }, README says Node.js 22+@strands-agents/sdkdeclaresengines.node >=22.0.0. The READMEs said 18 or 20.1main().catch(console.error)and the chat loops exited0on errors such as invalid AWS credentials.Per-sample changes
02-custom-tools: appointment booking with SQLite toolsbetter-sqlite3^11has no build for current Node, sonpm installfails innode-gyp^13.0.0, which also declaresengines.node >=22zodis imported inAppointmentTools.tsbut was never a dependency. It only resolved as a transitive install of the old SDK.zod^4.1.12, the SDK's peer rangecreate_appointment. The agent asks for the date instead, and the whole demo books nothing.console.log("Agent:", …)prints it againprinter: false, keeping the sample's labelledAgent:transcript03-model-providers: the same agent on Bedrock or OpenAI@strands-agents/sdk/openaiand@strands-agents/sdk/vended_tools/http_requestno longer exist, sotscfails, andnpm installfails becauseprepareruns the build@strands-agents/sdk/models/openaiand@strands-agents/sdk/vended-tools/http-request, in the code and the READMEOpenAIModelneeds theopenaipackage, which the SDK declares as a peer (^6.45.0)openai^6.45.0rl.question()after input closes throwsERR_USE_AFTER_CLOSEon Ctrl+D or piped inputfor await (const input of rl), which ends cleanly when input closes05-agent-state: agent state, persistence and hooksstateis no longer anAgentConfigfield, andagent.stateno longer existsappState: { … }in the config, andagent.appState/context.agent.appStatein tools and hooks. It is the sameStateStoreAPI (get,set,getAll).agent.hooks.addCallback(Event, cb)no longer existsagent.addHook(Event, cb)readlinecrash as03for awaitfix06-browser-agent: Vite app running the agent in the browseropenai^4peer-requireszod3, which conflicts with the SDK'szod4, sonpm installfails withERESOLVEopenai^6.45.0@strands-agents/sdk/openaimoved@strands-agents/sdk/models/openai, in the code and the READMEmodelStreamUpdateEvent, soevent.type === "modelContentBlockDeltaEvent"never matched and every reply rendered "No response received."vite builddoes not type-check, so the build still passed.event.event, in the code and the README snippetglobal.anthropic.claude-sonnet-4-6; README updatedHow this was verified
All four were tested from a clean install (
rm -rf node_modules package-lock.json && npm install) on Node 26.0, against Amazon Bedrock inus-east-1. Every sample passestsc --noEmit.02npx tsx src/index.ts{"date":"2026-10-01 15:00","location":"DC","title":"Agent fun"}.03exitcurrent_timeandhttp_request(Open-Meteo) both answered, exit0. Piped input withoutexitalso ends cleanly.03401 Incorrect API key, exit1(no real OpenAI key was available)0506npm run build && vite preview, driven with Playwright in Chromium, using Bedrock with short-lived STS credentials02,03,051Notes for reviewers
02getting today's date, which the demo needs in order to do what its README describes.03and06is type-checked, and03was shown to reach OpenAI. It was not run with a real key.