harness-sdk / strands-ts
AGENTS.md8.7k starsChanged 59 days agoApache-2.0View on GitHub
This document provides guidance for AI agents working on the Strands TypeScript SDK (strands-ts/). For human contributor guidelines, see CONTRIBUTING.md. Cross-SDK rules live in the root AGENTS.md. Plugin naming, cross-SDK parity, public/internal API marking, the structured-logging format, and the evergreen-comment rule apply to both SDKs and are stated once there — this file shows only the TypeScript-idiomatic form and the rules unique to TypeScript. When a rule applies to both SDKs, edit the root, not this file. The Strands TypeScript…
- Reads credentials
- Commits and pushes
Trending
More talk lately.about the whole repository
Who's talking about strands-agents/harness-sdk
- @fluid.sublimer.me“GitHub - strands-agents/harness-sdk: Build an agent harness and control it end-to-end. Open-source SDK for …”Bluesky · Sep 30, 2026 · 2 likes
- @github-trending.bsky.social“📦 strands-agents / harness-sdk ⭐ 7,621 (+96) 🗒 Python Build an agent harness and control it end-to-end. …”Bluesky · Sep 24, 2026 · 2 likes
- aws/bedrock-agentcore-sdk-typescript“feat: implement SessionManager for Strands TS integration”GitHub · Jul 16, 2026 · 2 reactions
- aws/bedrock-agentcore-sdk-typescript“An AgentCoreMemoryStore that works with the Strands native memory management system (`MemoryManager`)”GitHub · Jun 5, 2026 · 2 reactions
- @dailygithubtrends.bsky.social“今日のGitHubトレンド strands-agents/harness-sdk”Bluesky · Sep 23, 2026 · 1 likes
The biggest 5 of 51 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 51
Talked about on GitHub and Bluesky (51 times).
On GitHub · 47
- Jul 16, 2026feat: implement SessionManager for Strands TS integration — aws/bedrock-agentcore-sdk-typescript2 reactions
- Jun 5, 2026An AgentCoreMemoryStore that works with the Strands native memory management system (`MemoryManager`) — aws/bedrock-agentcore-sdk-typescript2 reactions
- Aug 16, 2026Chore(deps): bump strands-agents[openai] from 1.51.0 to 1.52.0 in /v1 — rhprasad0/nova-toll-budget-agent1 reaction · 1 comment
- Aug 11, 2026Chore(deps): bump strands-agents[openai] from 1.50.2 to 1.51.0 — rhprasad0/nova-toll-budget-agent1 reaction
- Jun 22, 2026chore(deps): bump the lambda-dependencies group across 1 directory with 6 updates — thechrisgrey/thechrisgrey1 reaction · 3 comments
42 more on GitHub
- Oct 5, 2026build(deps): bump strands-agents from 1.45.0 to 1.57.1 — diagridio/python-ai0 reactions
- Oct 5, 2026chore(deps): update strands-agents requirement from >=1.42.0 to >=1.57.2 in /tutor — aws-samples/amazon-bedrock-workshop0 reactions
- Oct 5, 2026chore(deps): bump the agent-framework group across 1 directory with 3 updates — suranimayur/banking-data-agents0 reactions · 1 comment
- Oct 3, 2026Update strands-agents requirement from >=1.0.0 to >=1.57.1 in /harness — sholtomaud/desktop-uat0 reactions
- Oct 3, 2026Update strands-agents requirement from <2,>=1.47.0 to >=1.57.1,<2 in /src — ikenley/email-ai-agent0 reactions
- Oct 2, 2026rc5 a2a template has incompatible dependencies — aws/agentcore-cli0 reactions · 1 comment
- Oct 1, 2026Bump strands-agents from 1.45.0 to 1.57.1 in /functions/most_popular_repo_strands — nexcode240/prompt-chaining-sls0 reactions
- Oct 1, 2026Bump strands-agents from 1.54.0 to 1.57.1 in /functions/most_popular_repo_strands — aws-samples/amazon-bedrock-serverless-prompt-chaining0 reactions · 1 comment
- Oct 1, 2026chore(deps): update strands-agents requirement from <2.0,>=1.0 to >=1.57.1,<2.0 — MariamJangveladze/conversational-banking-agent-demo0 reactions
- Oct 1, 2026Bump strands-agents from 1.50.2 to 1.57.1 in /functions/most_popular_repo_strands — probelabs/amazon-bedrock-serverless-prompt-chaining-audit0 reactions
- Oct 1, 2026Bump the python-deps group with 2 updates — mauc-agentic/spec-to-runtime-aws0 reactions
- Oct 1, 2026build(deps): bump the python group with 2 updates — vishalsg42/munim0 reactions
- Sep 30, 2026chore(deps): bump the python-minor-patch group across 6 directories with 3 updates — aws-samples/amazon-transcribe-live-meeting-assistant0 reactions
- Sep 29, 2026build(deps): bump strands-agents from 1.55.1 to 1.57.1 — AjaneeI/homeops-agent0 reactions · 1 comment
- Sep 29, 2026chore(deps): bump strands-harness from 0.1.1 to 0.1.2 in /app/ops_investigator — iracic82/strands-harness-on-aws0 reactions
- Sep 29, 2026chore(deps): bump strands-agents from 1.56.0 to 1.57.1 in /app/ops_investigator — iracic82/strands-harness-on-aws0 reactions
- Sep 28, 2026chore(deps): bump @strands-agents/sdk from 1.12.0 to 1.19.0 — 4suke-sun/connpass-scout-agent0 reactions · 1 comment
- Sep 28, 2026chore(deps): bump strands-agents from 1.56.0 to 1.57.0 — iguinea/mongodb-session-manager0 reactions
- Sep 27, 2026Bump strands-agents from 1.56.0 to 1.57.0 — Prashant-thakur77/Beacon0 reactions
- Sep 26, 2026build(deps): Update strands-agents requirement from >=1.0 to >=1.57.0 in /agents — minho5889/gen-ai-pro0 reactions
- Sep 23, 2026Add LangGraph migration examples (Python and TypeScript) — strands-agents/samples0 reactions · 1 comment
- Sep 22, 2026chore(deps): bump the python group across 1 directory with 3 updates — aws-samples/sample-strands-agent-with-agentcore0 reactions
- Sep 21, 2026chore(deps): bump strands-agents from 1.55.1 to 1.56.0 — fakhriaunur/genie-fleet0 reactions
- Sep 18, 2026Bump strands-agents from 1.55.0 to 1.55.1 — harveybellini/glide0 reactions
- Sep 16, 2026Bump the aws-agent-toolchain group across 1 directory with 2 updates — ag-ke-nakamura/form-echo-agent0 reactions
- Sep 12, 2026Bump strands-agents from 1.54.0 to 1.55.0 — AmirmLotfy/incaseof0 reactions
- Sep 4, 2026Bump the all group with 6 updates — rogervinas/strands-agents-langfuse-evaluations0 reactions
- Sep 2, 2026Bump the aws-agent-toolchain group in /app/FormEchoAgent with 2 updates — ag-ke-nakamura/form-echo-agent0 reactions
- Sep 2, 2026build(deps): bump the agent-dependencies group across 1 directory with 6 updates — nightandweather/lifelens-agent0 reactions
- Sep 2, 2026Bump strands-agents from 1.53.0 to 1.54.0 — mli-cyber/ada0 reactions
- Sep 1, 2026chore(deps): bump the python-e2e group in /e2e_tests/python with 5 updates — awslabs/run-model-context-protocol-servers-with-aws-lambda0 reactions
- Sep 1, 2026chore(deps): bump the python-chatbots group in /examples/chatbots/python with 4 updates — awslabs/run-model-context-protocol-servers-with-aws-lambda0 reactions
- Aug 29, 2026chore(deps): update strands-agents requirement from >=1.52.0 to >=1.53.0 in /apps/agent — yuyumama/AWS-MON0 reactions
- Aug 10, 2026chore(deps): update strands-agents requirement from >=1.26.0 to >=1.52.0 in /backend — SxBxcoder/Avoir0 reactions
- Aug 5, 2026[BUG] filter_restored_tool_context is incompatible with extended thinking — aws/bedrock-agentcore-sdk-python0 reactions · 1 comment
- Aug 3, 2026build(deps): Update strands-agents[anthropic,gemini,openai] requirement from >=1.50 to >=1.50.2 — khalaharvi/FDE-Agent-Platform0 reactions
- Aug 2, 2026deps(deps): update strands-agents requirement from >=0.1.0 to >=1.50.2 in /backend — camiloavilacm/camiloavila.dev0 reactions · 3 comments
- Jul 22, 2026Bump strands-agents from 1.39.0 to 1.48.0 — huisun/conversation-ai0 reactions
- Jul 1, 2026chore(deps): bump @strands-agents/sdk from 1.6.0 to 1.7.0 — arnoldsimha/skillspell0 reactions · 1 comment
- Jun 24, 2026[design] Determine whether parallel-invocation protection should apply to BiDiAgent — chaynabors/harness-sdk0 reactions
- Jun 18, 2026chore(deps): Update strands-agents[ollama] requirement from >=1.43.0 to >=1.44.0 — Iwaschkin/weather-agent0 reactions
- Jun 15, 2026build(deps): update strands-agents requirement from <2.0,>=1.42.0 to >=1.43.0,<2.0 in /agent-runtime — christiantobin/tobot-agent0 reactions
On Bluesky · 4
- Sep 30, 2026GitHub - strands-agents/harness-sdk: Build an agent harness and control it end-to-end. Open-source SDK for production AI agents in Python &… — @fluid.sublimer.me2 likes and reposts · 1 reply
- Sep 24, 2026📦 strands-agents / harness-sdk ⭐ 7,621 (+96) 🗒 Python Build an agent harness and control it end-to-end. Open-source SDK for production AI… — @github-trending.bsky.social2 likes and reposts
- Sep 23, 2026今日のGitHubトレンド strands-agents/harness-sdk — @dailygithubtrends.bsky.social1 likes and repost
- Aug 3, 2026harness-sdk from strands-agents hands you the agent loop itself, in Python or TypeScript, running against any model on any cloud. For… — @agentwire.thecompound.tech1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- harness-py/AGENTS.mdAGENTS.md
- harness-ts/AGENTS.mdAGENTS.md
- site/AGENTS.mdAGENTS.md
- strands-cli/AGENTS.mdAGENTS.md
- strands-py/AGENTS.mdAGENTS.md
- test-infra/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- harness-py/CLAUDE.mdCLAUDE.md
- harness-ts/CLAUDE.mdCLAUDE.md
- site/CLAUDE.mdCLAUDE.md
- strands-cli/CLAUDE.mdCLAUDE.md
- strands-py/CLAUDE.mdCLAUDE.md
- strands-ts/CLAUDE.mdCLAUDE.md
- test-infra/CLAUDE.mdCLAUDE.md
- docs-auditSkill
- docs-plannerSkill
- docs-reviewerSkill
- docs-writerSkill
- pr-createSkill
- pre-pushSkill
- pr-feedbackSkill
- pr-writerSkill
- strands-reviewSkill
- strandsSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
17 rules. About 0 are common, 6 are distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
Run quality checks: before committing (pre-commit hooks will run automatically)
- Distinctive: line 59
When creating pull requests, you MUST follow the guidelines in PR.md and use the PR template.
- Distinctive: line 69
When writing tests, you MUST follow the guidelines in docs/TESTING.md.
- Very specific: line 84
Optional chaining for null safety: prefer optional chaining over verbose typeof checks when accessing potentially undefined properties:
- Very specific: line 100
Never use any (enforced by ESLint).
- Distinctive: line 101
Use TypeScript strict-mode features.
- Distinctive: line 156
When adding or modifying dependencies, you MUST follow docs/DEPENDENCIES.md.
- Distinctive: line 162
Rule: if a dependency crosses an API boundary, it MUST be a peer dependency.
- Very specific: line 168
Document thrown errors with @throws (see Documentation Requirements).
- Very specific: line 215
When writing tests, you MUST follow docs/TESTING.md.
- Very specific: line 222
Use an interface for object shapes (with extends).
- Very specific: line 223
Use named exports only; convey privacy by barrel omission + @internal, never an _-prefixed filename
- Very specific: line 225
Document errors with @throws.
- Very specific: line 227
Prefer the bare prop?: T optional form under exactOptionalPropertyTypes
- Very specific: line 232
Use printf-style placeholders (%s, %d) in logs — use template literals
- Very specific: line 233
Put unit tests in a separate tests/ directory (use src//__tests__/)
- Very specific: line 236
Use invocationState for SDK-internal state — it is user-only (see the root AGENTS.md)
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Agent Development Guide - TypeScript SDK
This document provides guidance for AI agents working on the Strands TypeScript SDK (strands-ts/). For human contributor guidelines, see CONTRIBUTING.md.
Cross-SDK rules live in the root AGENTS.md. Plugin naming, cross-SDK parity, public/internal API marking, the structured-logging format, and the evergreen-comment rule apply to both SDKs and are stated once there — this file shows only the TypeScript-idiomatic form and the rules unique to TypeScript. When a rule applies to both SDKs, edit the root, not this file.
Product Overview
The Strands TypeScript SDK is the TypeScript/JavaScript port of the Strands Agents framework for building AI agents with a model-driven approach. It mirrors the Python SDK in concepts and names (re-cased to TS idiom) while being idiomatic TypeScript, and runs in both Node.js and browser environments.
Core Features:
- Model Agnostic: Multiple model providers (Amazon Bedrock, Anthropic, OpenAI, Google, Vercel AI SDK, etc.)
- Tools:
tool()factory with Zod schemas - MCP Integration: Native Model Context Protocol support
- Multi-Agent Systems: Agent-to-agent, swarms, and graph patterns
- Streaming Support: Real-time response streaming via async generators
- Hooks: Event-driven extensibility for agent lifecycle
- Session Management: Pluggable session managers
- Observability: OpenTelemetry tracing and metrics
Directory Structure
strands-ts/
├── src/ # All production source code
│ ├── agent/ # Core agent loop, state, agent-as-tool
│ ├── models/ # Model provider implementations (anthropic.ts, bedrock.ts, openai/, google/, …)
│ ├── tools/ # Tool system (registry, execution, factory)
│ ├── conversation-manager/ # Message history, compression
│ ├── multiagent/ # Multi-agent orchestration (A2A, graphs, swarm)
│ ├── session/ # Session persistence
│ ├── telemetry/ # Tracing and metrics
│ ├── hooks/ # Agent lifecycle hooks
│ ├── types/ # Shared type definitions
│ └── … # Key subsystems shown; run `ls src/` for the full list
├── src/**/__tests__/ # Unit tests (co-located with source)
├── test/integ/ # Integration tests with real providers
├── docs/ # Developer documentation
└── package.json # SDK package config, dependencies, npm scriptsDevelopment Workflow
1. Environment Setup
See CONTRIBUTING.md - TypeScript SDK for prerequisites (Node.js 22+, npm), installation, and verification commands.
2. Making Changes
- Create feature branch:
git checkout -b agent-tasks/{ISSUE_NUMBER} - Implement changes following the patterns below
- Run quality checks before committing (pre-commit hooks will run automatically)
- Commit with conventional commits:
feat:,fix:,refactor:,docs:, etc. - Push to remote:
git push origin agent-tasks/{ISSUE_NUMBER} - Create pull request following PR.md guidelines
3. Pull Request Guidelines
When creating pull requests, you MUST follow the guidelines in PR.md and use the PR template.
4. Quality Gates
Pre-commit hooks run automatically and must all pass: build (npm run build), unit tests with coverage (npm run test:coverage), linting (npm run lint), format check (npm run format:check), and type check (npm run type-check).
ESLint and Prettier already enforce formatting (no semicolons, single quotes, 120 cols), the no-explicit-any and explicit-function-return-type rules, and TSDoc syntax. This guide does not re-list those — it covers the conventions a linter cannot check. When a rule below says "enforced by review," it means exactly that: no tool catches it, so it is on you and the reviewer.
5. Testing Guidelines
When writing tests, you MUST follow the guidelines in docs/TESTING.md; see Testing below.
Coding Patterns and Best Practices
Logging
Structured logging is a cross-SDK rule — see the format in the root AGENTS.md. The TypeScript-idiomatic form uses template literals (never printf %s/%d):
logger.warn(`stop_reason=<${stopReason}>, fallback=<${fallback}> | unknown stop reason, converting to camelCase`)
logger.warn('cache points are not supported in openai system prompts, ignoring cache points') // no context fieldsTypeScript Type Safety
Optional chaining for null safety: prefer optional chaining over verbose typeof checks when accessing potentially undefined properties:
// Good
return globalThis?.process?.env?.API_KEY
// Bad
if (typeof process !== 'undefined' && typeof process.env !== 'undefined') {
return process.env.API_KEY
}
return undefinedStrict requirements (beyond what ESLint catches):
- Function and method signatures MUST have explicit return types (ESLint enforces this). Let TypeScript infer the types of local variables and intermediate expressions — don't annotate those redundantly.
- Never use
any(enforced by ESLint). Reach forunknown(then narrow) when a type is genuinely open. - Use TypeScript strict-mode features.
interface vs type alias: Use an interface for object shapes — model configs, *Options/*Config bags, data blocks, capability contracts — and prefer extends for composition (even when extending an interface in the same file). Use a type alias only when the type is not a plain object shape: unions (including discriminated unions), string-literal unions, intersections, function types, or mapped/conditional/utility-derived types.
// Good — object shape as an interface, composed with extends
interface AnthropicModelConfig extends BaseModelConfig { maxTokens?: number }
interface AnthropicModelOptions extends AnthropicModelConfig { apiKey?: string }
// Good — type alias for a discriminated union (not an object shape)
type OpenAIModelOptions =
| ({ api?: 'responses' } & OpenAIResponsesConfig & OpenAIClientOptions)
| ({ api: 'chat' } & OpenAIChatConfig & OpenAIClientOptions)The model-provider config family (BaseModelConfig and each {Provider}ModelConfig/{Provider}ModelOptions) is the reference pattern. A handful of older object shapes are still type X = { ... } (e.g. AgentConfig, ConversationManagerOptions, SessionStorage) — migrate them to interface on next touch, don't rewrite them en masse.
Optional properties: tsconfig enables exactOptionalPropertyTypes, which makes prop?: T and prop?: T | undefined semantically distinct. Write the bare prop?: T form (the overwhelming majority); only add | undefined when a caller genuinely needs to pass an explicit undefined.
Naming Conventions
- Private class fields: underscore prefix (
private readonly _config: Config,private _state: State). - Name every variable for its content, including short-lived loop/catch bindings —
event,index,error, nevere/i/x(e.g.for (const message of messages), notfor (const m of messages)). - Plugin / construct naming and cross-SDK literal parity are cross-SDK rules — see the root AGENTS.md. In short: name a construct for what it does (
AgentSkills, notAgentSkillsPlugin); match the Python literal re-cased to TS idiom; single-word string-literal values are byte-identical, multi-word ones are camelCased in TS (tool_use→toolUse, viaSTOP_REASON_MAP/snakeToCamel, never emitted ad hoc); wire field names keep their wire format (inputSchema,tool_use_id).
Import Organization
Order imports: (1) external dependencies, (2) internal modules via relative paths, (3) type-only imports (import type { … }).
File Organization
- Test file locations and naming are defined in docs/TESTING.md (see Testing below).
- Function ordering within a file reads top-down, most general to most specific: main entry-point/exported functions at the top, private helpers below in order of use.
- Keep functions small and focused — a single responsibility each.
Public API Surface
Public/internal marking is a cross-SDK rule — see the root AGENTS.md. The TypeScript-idiomatic form:
- Named exports only — never
export default. The codebase has zero default exports. - Convey module privacy by not re-exporting from the barrel (
index.ts), not by an_-prefixed filename. Unlike the Python SDK, TS has no_-prefixed module files; an internal-but-cross-module symbol gets the@internalTSDoc tag instead (see theCancelledErrorintentional-omission comment inindex.ts). - Source and test files are kebab-case (
tool-caller.ts,agent-skills.ts); the class/type inside keeps its PascalCase. No linter checks filename casing, so this is a review item.
Documentation Requirements
TSDoc is required on all exported functions, classes, and interfaces (syntax enforced by ESLint). The judgment rules a linter can't check:
- Include
@paramfor all parameters and@returnsfor return values. - Include
@exampleonly for exported classes (main SDK entry points likeBedrockModel,Agent); do NOT add@exampleto type definitions, interfaces, or internal types. - Include
@throwson an exported function/method that can throw as part of its contract — name the error type and the condition (the TS counterpart to Python'sRaises:). - Interface properties MUST have single-line descriptions.
- Mark non-public exports with the
@internaltag (it may also be applied to non-exported symbols for clarity).
Dependency Management
When adding or modifying dependencies, you MUST follow docs/DEPENDENCIES.md. Key points:
dependencies: core SDK functionality users don't interact with directlypeerDependencies: dependencies that cross API boundaries (users construct/pass instances)devDependencies: build tools, testing frameworks, linters — not shipped to users
Rule: if a dependency crosses an API boundary, it MUST be a peer dependency.
Error Handling
- Handle errors explicitly; prefer optional chaining over verbose
typeofchecks for possibly-undefined access. - Model providers translate vendor errors into the SDK's typed errors — context-window / token overflow →
ContextWindowOverflowError, throttling / 429 →ModelThrottledError— and preserve the original via thecauseoption (new ModelThrottledError(message, { cause: error })). Never let a raw vendor error escape the provider boundary (seemodels/openai/errors.ts,models/google/errors.ts). - Document thrown errors with
@throws(see Documentation Requirements).
Adding a Model Provider
The model provider is the most-repeated pattern in the SDK; models/anthropic.ts is the cleanest reference.
export class XModel extends Model<XModelConfig>withprivate _configandprivate _client.- Two interfaces:
interface XModelConfig extends BaseModelConfig(the model knobs) and a supersetinterface XModelOptions extends XModelConfigadding client/credential fields (apiKey,client,clientConfig). The constructor takesXModelOptions, destructures the client fields, and spreads the rest into_config. - Implement the base contract from
models/model.ts:updateConfig(modelConfig)(spread-merge into_config),getConfig()(returnresolveConfigMetadata(this._config, this._config.modelId ?? <default>)), andasync *stream(...).structuredOutputis not part of the TS provider contract — TS does structured output via a tool + agent config (tools/structured-output-tool.ts,AgentConfig.structuredOutputSchema), not a provider method. - Keep conversion private (
_formatRequest,_formatMessages,_formatContentBlock). Default to a flatmodels/<name>.ts; only reach for amodels/<name>/subdirectory with standalone adapter modules +types.ts/errors.tswhen the provider spans multiple API surfaces (the reasonopenai/exists — chat vs responses).
export interface XModelConfig extends BaseModelConfig {
maxTokens?: number
}
export interface XModelOptions extends XModelConfig {
apiKey?: string
client?: VendorClient
}
export class XModel extends Model<XModelConfig> {
private _config: XModelConfig
private _client: VendorClient
updateConfig(modelConfig: XModelConfig): void {
this._config = { ...this._config, ...modelConfig }
}
getConfig(): XModelConfig {
return resolveConfigMetadata(this._config, this._config.modelId ?? MODEL_DEFAULTS.x.modelId)
}
async *stream(messages: Message[], options?: StreamOptions): AsyncIterable<ModelStreamEvent> {
// map vendor errors to ContextWindowOverflowError / ModelThrottledError with { cause }
}
}Async & Streaming
streamis an async generator typedasync *stream(messages, options?): AsyncIterable<ModelStreamEvent>, matching the abstract base exactly. Consume async iterables withfor await.- Providers emit raw
ModelStreamEvents and must not buffer the whole response. The baseModel.streamAggregatedperforms event accumulation on top ofstream. - The SDK is async-only — no sync facade.
invoke()returns aPromise; there is no blocking equivalent (unlike the Python SDK's__call__). - Cancellation uses
AbortSignal. Tools receive the execution-scoped signal throughToolContext.cancelSignal, and tool middleware throughExecuteToolContext.cancelSignal; foreground and direct tool execution useagent.cancelSignal. Callers may pass an externalcancelSignalviainvoke/streamoptions (merged withAbortSignal.any). When merging concurrent async generators, race.next()withPromise.raceand close the rest withPromise.allSettled(gen.return())infinally; usePromise.all/allSettledfor simple fan-out.
Testing
When writing tests, you MUST follow docs/TESTING.md. It is the authoritative reference for test file location and naming (co-location, environment suffixes), the nested describe pattern, batching strategy, whole-object assertions, fixtures, coverage requirements, and multi-environment testing.
Quick Rules
The un-lintable rules an agent most often misses — every one is enforced by review, not tooling (formatting, no-explicit-any, explicit return types, and TSDoc syntax are already handled by ESLint/Prettier; run npm run lint). Cross-SDK rules (plugin naming, parity, public/internal marking, logging format, evergreen comments) are in the root AGENTS.md.
Do:
- Use an
interfacefor object shapes (withextends); atypealias only for unions/intersections/function/mapped types - Use named exports only; convey privacy by barrel omission +
@internal, never an_-prefixed filename - Name source/test files kebab-case (the class inside stays PascalCase)
- Document errors with
@throws; reserve@examplefor entry-point classes, never type defs - Translate vendor errors to typed SDK errors and preserve
{ cause } - Prefer the bare
prop?: Toptional form underexactOptionalPropertyTypes - Name every variable for its content, even short-lived loop/catch bindings (
event/index/error, nevere/i/x)
Don't:
export default— named exports only- Use printf-style placeholders (
%s,%d) in logs — use template literals - Put unit tests in a separate
tests/directory (usesrc/**/__tests__/) - Annotate local variables with redundant explicit types (infer locals; annotate signatures)
- Let a raw vendor error escape a provider boundary
- Use
invocationStatefor SDK-internal state — it is user-only (see the root AGENTS.md)
Development Commands
npm test # Run unit tests in Node.js
npm run test:browser # Run unit tests in browser (Chromium via Playwright)
npm run test:all # Run all tests in all environments
npm run test:integ # Run integration tests
npm run test:coverage # Run tests with coverage report
npm run lint # Check code quality
npm run format # Auto-fix formatting
npm run type-check # Verify TypeScript types
npm run build # Compile TypeScriptAgent-Specific Notes
Writing Code
- YOU MUST make the SMALLEST reasonable changes to achieve the desired outcome.
- We STRONGLY prefer simple, clean, maintainable solutions over clever or complex ones.
- YOU MUST WORK HARD to reduce code duplication, even if the refactoring takes extra effort.
- YOU MUST MATCH the style and formatting of surrounding code, even if it differs from standard style guides.
- Fix broken things immediately when you find them. Don't ask permission to fix bugs.
Code Comments
Comments are to-the-point, state only what cannot be inferred from the code, and stay evergreen. The full rule (including how it applies to tests, and the deprecated/legacy nuance) is in the root AGENTS.md.
Integration with Other Files
- CONTRIBUTING.md: testing/setup commands and human contribution guidelines
- docs/TESTING.md: comprehensive testing guidelines (MUST follow when writing tests)
- docs/DEPENDENCIES.md: dependency-management rules
- team/PR.md: pull request guidelines and template
- package.json / strands-ts/package.json: workspace and SDK package config
Additional Resources
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

