LangChain for Python 1.4
Last reviewed Oct 28, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- LangChain for Python 1.4137 lines · 5.7K tokens
Total292 lines · 9.5K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 73
- 78
- 79
- 89
- 95
- 117
- 201
- 208
- 209
- 214
- 250
- 295
- 319
- 328
- 338
- 347
- 367
- 379
- 409
- 416
- 426
- 427
- 470
- 488
- 502
- 522
- 524
- 532
- 611
- 639
- 674
- 732
- 770
- 772
- 776
- 807
- 829
- 841
- 862
- 863
- 916
- 918
- 1104
- 1333
- 1336
- 1395
- 1426
- 1427
Prompt Preview
Apply the Python 3 baseline first. These rules apply to LangChain for Python 1.4 on the CPython minors up to 3.14 that still receive security fixes; 1.4 also installs on 3.10, which reached end of life on 2026-10-01. They cover agents built with create_agent, tools, the langchain.mcp adapter added in this line, middleware, human approval, structured output, retrieval and memory, tracing, and deployment.
Agent construction and runtime context
- Build
model,system_prompt,tools,middleware,response_format,context_schema,checkpointer, andstorefrom trusted application configuration, never from request bodies or model output. - Keep
PromptTemplateandChatPromptTemplatetemplate text trusted and pass user content as variables; prefertemplate_format="f-string"and never accept untrusted Jinja2 templates despite their best-effort sandbox. - Use
langchain_core.load.load()andloads()only for trusted serialized objects with a narrowallowed_objectslist; keepsecrets_from_env=Falseand the defaultinit_validator, and parse request data as inert JSON instead. - Treat prompts loaded with
langsmith.Client().pull_prompt(),pull_prompt_commit(), orlangchain_classic.hub.pull()as executable configuration that can set a model'sbase_url, headers, and secret references: keep the refusal of publicowner/namepulls thatlangsmith0.8.0 made the default, never passdangerously_pull_public_prompt=True,include_model=True, orsecrets_from_env=Truefor a prompt you have not reviewed, pull a pinnedname:commit_hash, and