LangChain for TypeScript 1.5
Last reviewed Oct 11, 2026
Prompt Details
Prompt Composition
4prompts
- JavaScript ES2026102 lines · 3.1K tokens
- Node.js 24101 lines · 5.3K tokens
- TypeScript 746 lines · 1.5K tokens
- LangChain for TypeScript 1.554 lines · 1.3K tokens
Total303 lines · 11.2K tokens
CWE Coverage
- 20
- 22
- 59
- 73
- 78
- 79
- 88
- 89
- 95
- 113
- 117
- 200
- 208
- 209
- 214
- 250
- 295
- 297
- 319
- 323
- 330
- 338
- 346
- 347
- 352
- 354
- 362
- 367
- 377
- 426
- 444
- 459
- 471
- 488
- 494
- 502
- 524
- 532
- 602
- 639
- 653
- 732
- 754
- 770
- 807
- 829
- 838
- 841
- 862
- 863
- 908
- 915
- 916
- 918
- 922
- 942
- 943
- 1004
- 1321
- 1333
- 1427
Prompt Preview
Apply the Node.js 24 and TypeScript 7 prompts first. These rules cover LangChain for TypeScript 1.5 models, prompts, tools, agents, retrieval, structured output, middleware, memory, and operations.
Models and prompts
- Build
createAgentmodels, system prompts, tools, middleware, and checkpointers from trusted registries, not request-controlled names. - Allowlist
context,configurable, tags, and metadata: callbacks and integrations may treat them as routing or storage controls, andcontextcan override model-call limits and HITL policy. - Set provider token/request limits and LangChain model-call limits; creating an agent imposes no budget.
- Keep origin labels on user, retrieved, memory, and tool messages instead of concatenating them into authoritative instructions.
- Validate returned messages and structured output at the destination; schema-valid values are still model-controlled.
- Deserialize only trusted payloads with
@langchain/core/loadorlangchain/load; keepsecretsFromEnvdisabled and secret/import maps narrow.
Tools and agents
- Give each
tool()a bounded schema and dispatch only the registered implementation; descriptions guide the model but grant no authority. - Authorize parsed tool arguments against the current principal, tenant, resource, and state immediately before side effects.
- Configure
toolCallLimitMiddlewarewith explicitrunLimitand, for persisted threads,threadLimit; each is unlimited when omitted, though omitting both throws at construction. - Choose
exitBehaviordeliberately: the tool-call limiter defaults to