Anthropic SDK for Python 1.4
Last reviewed Sep 12, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- Anthropic SDK for Python 1.4113 lines · 4K tokens
Total268 lines · 7.7K tokens
CWE Coverage
- 20
- 23
- 36
- 59
- 78
- 79
- 89
- 95
- 117
- 201
- 208
- 209
- 214
- 250
- 295
- 319
- 328
- 338
- 347
- 367
- 379
- 409
- 416
- 426
- 427
- 459
- 470
- 488
- 502
- 532
- 611
- 639
- 674
- 694
- 732
- 770
- 772
- 776
- 798
- 807
- 829
- 862
- 916
- 918
- 1104
- 1333
- 1395
- 1426
- 1427
Prompt Preview
Apply the Python 3 baseline first, then these rules for applications built on the anthropic package 1.4 release line. Version 1.4 requires Python 3.10 or later and uses httpx2, not the separate httpx package. Treat prompts, retrieved content, tool results, model text, tool arguments, generated files, and agent state as untrusted across every API and worker boundary.
Version and dependency boundary
- Lock
anthropicand its transitive dependencies in the lock file, check at startup thatanthropic.__version__matches the locked release, and record it in deployment evidence. Anthropic ships fixes and hardening such as stricter credential-file checks in new 1.x releases rather than as patches to earlier minors, so taking one means moving to a newer release and re-reviewing these rules against it. - Run on a CPython minor that still receives security fixes; 1.4 still installs on 3.10, which reached end of life on 2026-10-01. Test the exact interpreter you deploy rather than relying on the package classifiers through Python 3.14 as proof of compatibility.
- Import transports, timeouts, and custom clients from
httpx2; do not pass an object from the distincthttpxpackage ashttp_client. - Call
httpx2.alias_httpx()only when a reviewed tracing or mocking integration genuinely needs the alias, and prove that it does not record API keys, prompts, files, or responses. - Remove legacy Text Completions calls and the deleted Messages sampling parameters
temperature,top_p, andtop_kwhen migrating to 1.x. - Replace
output_formatarguments containing schema