Haystack 3
Last reviewed Sep 24, 2026
Prompt Details
Prompt Composition
2prompts
- Python 3155 lines · 3.8K tokens
- Haystack 371 lines · 3.2K tokens
Total226 lines · 7K 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
- 532
- 611
- 639
- 674
- 732
- 770
- 772
- 776
- 807
- 829
- 862
- 916
- 918
- 1104
- 1333
- 1395
- 1426
- 1427
Prompt Preview
Apply the Python 3 prompt first. These rules cover the Haystack 3 line of haystack-ai on maintained Python 3.10–3.14 runtimes and were checked against 3.1.0. Check compatibility and security fixes separately for independently versioned integrations, including mcp-haystack.
Prompts and application inputs
- Construct user input as
ChatMessage.from_userand restore assistant, system, and tool messages only from trusted conversation storage; do not accept caller-selected roles or forged tool results as conversation history. - Treat retrieved
Document.content, metadata, model replies, and tool results as untrusted data even when inserted by a trusted template; enforce authorization in application code independently of model instructions or injection classifiers. - Expose an allowlist of pipeline input sockets and validate their values before
Pipeline.runorrun_async; connection type validation and component declarations do not establish caller permissions or validate application constraints. - Keep
PromptBuilder,ChatPromptBuilder, andAgenttemplates developer-controlled and retainrequired_variables="*"for required context. Restrict runtimetemplateandtemplate_variablesoverrides; missing variables made optional can silently erase context, andtemplate_variablestakes precedence over pipeline values.
Deserialization and template execution
- Load pipeline YAML and dictionaries only from reviewed, access-controlled sources;
Pipeline.load,loads, andfrom_dictconstruct executable components even when the YAML parser accepts only