Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

Code

The Code component lets you add custom Python code directly to a pipeline without building a separate custom component. Enter Python code that follows the Haystack component structure, and the platform validates it instantly as you type.

Key Features

  • Add custom Python code to a pipeline without external dependencies or CI/CD setup.
  • Code is validated as you type it in the configuration panel.
  • Define your own input and output types through the run() method.
  • Save and reuse Code components across multiple pipelines from the Component Library.
  • Use the built-in AI assistant to generate code for your component.

Configuration

AI assistant

You can use the AI assistant to generate code for your Code component. To do this, click the AI Assistant button on the component card and write your request in the prompt.

Code Component AI Assistant

Component's Structure

Each component is a Python class with the following required elements:

  • The from haystack import component import statement.
  • The @component decorator to indicate you're creating a component.
  • The run() method that defines what the component does.
    • The run() method must have the @component.output_types decorator to define the type of data the component outputs and the name of the outputting edge. The names and types you define as output types must match the keys and value types of the dictionary object the run() method returns. For details, see Examples below.
    • You can specify the input parameters for the run() method.
    • The run() method must return a dictionary with the keys and values you specify.

Available Dependencies

Your Code component has access to standard dependencies available in Haystack Platform. Expand this section to check available dependencies:

Available Dependencies

Pipeline Image Dependencies

This page lists the frozen Python dependencies for each pipeline image flavor.

indexing

PackageVersion
abnf==2.2.0
accelerate==1.13.0
adbc-driver-manager==1.11.0
adbc-driver-snowflake==1.11.0
aimlapi-haystack==2.0.0
aiobotocore==3.7.0
aiofiles==25.1.0
aiohappyeyeballs==2.6.2
aiohttp==3.13.5
aioitertools==0.13.0
aiolimiter==1.2.1
aiosignal==1.4.0
aiosqlite==0.22.1
alloydb-haystack==0.1.0
amazon-bedrock-haystack==6.10.2
amazon-sagemaker-haystack==0.3.0
annotated-doc==0.0.4
annotated-types==0.7.0
anthropic==0.103.1
anthropic-haystack==5.9.0
antlr4-python3-runtime==4.9.3
anyio==4.13.0
appdirs==1.4.4
arcadedb-haystack==1.2.0
arrow==1.4.0
asn1crypto==1.5.1
astra-haystack==4.3.0
astrapy==1.5.2
asyncpg==0.31.0
attrs==26.1.0
Authlib==1.7.2
azure-ai-documentintelligence==1.0.2
azure-ai-formrecognizer==3.3.3
azure-ai-search-haystack==4.0.0
azure-common==1.1.28
azure-core==1.41.0
azure-doc-intelligence-haystack==1.0.0
azure-identity==1.25.3
azure-search-documents==12.0.0
babel==2.18.0
backoff==2.2.1
batched==0.1.5
bcrypt==5.0.0
beautifulsoup4==4.14.3
blis==1.3.3
boltons==25.0.0
boto3==1.42.54
boto3-extensions==0.23.0
botocore==1.42.54
bracex==2.6
brave-haystack==0.1.0
build==1.5.0
bytecode==0.17.0
catalogue==2.0.10
certifi==2026.5.20
cffi==2.0.0
chardet==7.4.3
charset-normalizer==3.4.7
chroma-haystack==4.3.0
chromadb==1.5.9
cint==1.0.0
click==8.2.0
cloudpathlib==0.24.0
cohere==5.21.1
cohere-haystack==4.2.0
colorlog==6.10.1
cometapi-haystack==2.1.0
confection==1.3.3
courlan==1.3.2
cryptography==48.0.0
cymem==2.0.13
dataclasses-json==0.6.7
datasets==4.8.5
dateparser==1.4.0
dc-consumer-indexing==2.4.14
dc-unified-logging==0.0.5
ddtrace==3.16.0
deepl==1.30.0
deepl-haystack==0.3.0
deepset-cloud-custom-nodes==2.0.299
deepset-cloud-sdk==1.7.5
defusedxml==0.7.1
Deprecated==1.3.1
deprecation==2.1.0
dill==0.4.1
diskcache==5.6.3
distro==1.9.0
dnspython==2.8.0
dockerfile-parse==2.0.1
docling==2.94.0
docling-core==2.77.0
docling-haystack==0.3.0
docling-ibm-models==3.13.2
docling-parse==5.11.0
docling-serve-haystack==1.0.0
docling-slim==2.94.0
docstring_parser==0.18.0
durationpy==0.10
e2b==2.21.1
e2b-haystack==1.0.0
elastic-transport==8.17.1
elasticsearch==8.19.3
elasticsearch-haystack==5.4.0
emoji==2.15.0
envier==0.6.1
et_xmlfile==2.0.0
eval_type_backport==0.3.1
evaluate==0.4.6
Events==0.5
exceptiongroup==1.3.1
face==26.0.0
Faker==40.18.0
FalkorDB==1.6.1
falkordb-haystack==1.1.0
fastapi==0.136.1
fastavro==1.12.2
fastembed==0.8.0
fastembed-haystack==1.4.1
ffmpeg-python==0.2.0
fickling==0.1.11
filelock==3.29.0
filetype==1.2.0
fire==0.7.1
firecrawl-haystack==1.1.0
firecrawl-py==4.27.1
flatbuffers==25.12.19
frozenlist==1.8.0
fsspec==2026.2.0
future==1.0.0
gitdb==4.0.12
github-haystack==1.2.0
GitPython==3.1.50
glom==24.11.0
google-api-core==2.30.3
google-auth==2.53.0
google-cloud-alloydb==0.9.0
google-cloud-alloydb-connector==1.13.0
google-genai==2.5.0
google-genai-haystack==3.1.0
googleapis-common-protos==1.75.0
gql==4.0.0
graphql-core==3.2.8
graphviz==0.21
greenlet==3.5.1
grpc-google-iam-v1==0.14.4
grpcio==1.78.0
grpcio-status==1.71.2
h11==0.16.0
h2==4.3.0
haystack-ai==2.29.0
haystack-experimental==0.19.0
hf-xet==1.5.0
hpack==4.1.0
html5lib==1.1
htmldate==1.9.4
httpcore==1.0.9
httptools==0.7.1
httpx==0.28.1
httpx-sse==0.4.3
huggingface_hub==0.36.2
hyperframe==6.1.0
idna==3.15
importlib_metadata==8.6.1
importlib_resources==7.1.0
iniconfig==2.3.0
installer==0.7.0
intervaltree==3.2.1
invoke==2.2.1
isodate==0.7.2
jina-haystack==0.5.1
Jinja2==3.1.6
jiter==0.15.0
jmespath==1.1.0
joblib==1.5.3
joserfc==1.6.5
jq==1.11.0
jsonlines==4.0.0
jsonpatch==1.33
jsonpointer==3.1.1
jsonref==1.1.0
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
jusText==3.0.2
kaitaistruct==0.11
kubernetes==36.0.0
langchain==1.3.1
langchain-classic==1.0.7
langchain-community==0.4.1
langchain-core==1.4.0
langchain-openai==1.2.1
langchain-protocol==0.0.15
langchain-text-splitters==1.1.2
langdetect==1.0.9
langfuse==2.60.10
langfuse-haystack==2.2.0
langgraph==1.2.0
langgraph-checkpoint==4.1.0
langgraph-prebuilt==1.1.0
langgraph-sdk==0.3.14
langsmith==0.8.5
lara-haystack==1.0.0
lara-sdk==1.10.2
latex2mathml==3.81.0
lazy_imports==1.2.0
llama-cpp-haystack==1.1.0
llama-stack-api==0.7.1
llama-stack-haystack==1.0.0
llama_cpp_python==0.3.23
llama_stack==0.4.5
llvmlite==0.47.0
loguru==0.7.3
lxml==6.1.1
lxml_html_clean==0.4.5
magika==0.6.2
markdown-it-py==3.0.0
markdownify==1.2.2
markitdown==0.1.5
markitdown-haystack==1.0.0
marko==2.2.2
MarkupSafe==3.0.3
marshmallow==3.26.2
mcp==1.27.1
mcp-haystack==1.0.0
mdit-plain==1.0.1
mdurl==0.1.2
mem0ai==2.0.2
meta-llama-haystack==1.1.0
mistral-haystack==1.0.1
mistralai==1.9.11
mmh3==5.2.1
mongodb-atlas-haystack==3.2.1
more-itertools==11.0.2
mpire==2.10.2
mpmath==1.3.0
msal==1.36.0
msal-extensions==1.3.1
msgspec==0.21.1
msrest==0.7.1
multidict==6.7.1
multiprocess==0.70.19
murmurhash==1.0.15
mxbai-rerank==0.1.6
mypy_extensions==1.1.0
nest-asyncio==1.6.0
networkx==3.6.1
nltk==3.9.4
numba==0.65.1
numpy==1.26.4
nvidia-haystack==0.3.0
oauthlib==3.3.1
olefile==0.47
ollama==0.6.2
ollama-haystack==3.0.1
omegaconf==2.3.0
onnxruntime==1.26.0
openai==2.37.0
opencv-python==4.11.0.86
openinference-instrumentation==0.1.51
openinference-instrumentation-haystack==0.1.30
openinference-semantic-conventions==0.1.29
openpyxl==3.1.5
openrouter-haystack==0.2.0
opensearch-haystack==8.1.0
opensearch-protobufs==1.2.0
opensearch-py==3.2.0
opentelemetry-api==1.33.1
opentelemetry-exporter-otlp-proto-common==1.33.1
opentelemetry-exporter-otlp-proto-grpc==1.33.1
opentelemetry-exporter-otlp-proto-http==1.33.1
opentelemetry-instrumentation==0.54b1
opentelemetry-proto==1.33.1
opentelemetry-sdk==1.33.1
opentelemetry-semantic-conventions==0.54b1
oracle-haystack==0.2.0
oracledb==2.5.1
orjson==3.11.9
ormsgpack==1.12.2
overrides==7.7.0
packaging==24.2
pandas==3.0.3
pdf2image==1.17.0
pdfminer.six==20250506
pgvector==0.4.2
pgvector-haystack==6.3.0
phonenumbers==9.0.30
pika==1.3.2
pillow==12.2.0
pinecone==9.0.1
pinecone_haystack==5.1.0
platformdirs==4.9.6
pluggy==1.6.0
polars==1.40.1
polars-runtime-32==1.40.1
polyfactory==3.3.0
polyfile-weave==0.5.7
portalocker==3.2.0
posthog==7.15.1
preshed==3.0.13
presidio-haystack==2.1.0
presidio_analyzer==2.2.362
presidio_anonymizer==2.2.362
prompt_toolkit==3.0.52
propcache==0.5.2
proto-plus==1.28.0
protobuf==4.25.9
psutil==7.2.2
psycopg==3.3.4
psycopg-binary==3.3.4
psycopg2-binary==2.9.12
py_rust_stemmers==0.1.5
pyarrow==24.0.0
pyasn1==0.6.3
pyasn1_modules==0.4.2
pybase64==1.4.3
pyclipper==1.4.0
pycparser==3.0
pydantic==2.12.5
pydantic-settings==2.14.1
pydantic_core==2.41.5
Pygments==2.20.0
PyJWT==2.12.1
pylatexenc==2.10
pymongo==10.10.10.10
pyOpenSSL==26.2.0
pypdf==5.1.0
pypdfium2==5.8.0
PyPika==0.51.1
pyproject_hooks==1.2.0
pyrate-limiter==4.1.0
pytest==8.4.2
pytest-dotenv==0.5.2
python-dateutil==2.9.0.post0
python-docx==1.1.2
python-dotenv==1.2.2
python-iso639==2026.4.20
python-magic==0.4.27
python-multipart==0.0.29
python-oxmsg==0.0.2
python-pptx==1.0.2
python-rapidjson==1.23
pytz==2026.2
pyversity==0.2.0
pyversity-haystack==1.0.0
PyYAML==6.0.3
qdrant-client==1.18.0
qdrant-haystack==9.1.1
ragas==0.2.15
ragas-haystack==2.2.0
RapidFuzz==3.14.5
rapidocr==3.8.1
redis==7.4.0
referencing==0.37.0
regex==2026.5.9
requests==2.34.2
requests-file==3.0.1
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
rich==15.0.0
rpds-py==0.30.0
rtree==1.4.1
ruamel.yaml==0.19.1
s3transfer==0.16.1
safetensors==0.7.0
scikit-learn==1.8.0
scipy==1.17.1
semchunk==3.2.5
sentence-transformers==5.5.1
sentencepiece==0.2.1
sentry-sdk==2.60.0
setfit==1.1.3
setuptools==82.0.1
shapely==2.1.2
shellingham==1.5.4
six==1.17.0
smart_open==7.6.1
smmap==5.0.3
sniffio==1.3.1
snowflake-connector-python==4.5.0
snowflake-haystack==2.0.0
sortedcontainers==2.4.0
soupsieve==2.8.3
spacy==3.8.14
spacy-legacy==3.0.12
spacy-loggers==1.0.5
SQLAlchemy==2.0.49
sqlalchemy-haystack==0.1.0
srsly==2.5.3
sse-starlette==3.4.4
stackit-haystack==1.2.0
starlette==1.0.0
structlog==25.5.0
supabase-haystack==0.1.0
sympy==1.14.0
tabulate==0.10.0
tavily-haystack==0.1.0
tavily-python==0.7.24
tenacity==9.1.4
termcolor==3.3.0
thinc==8.3.13
threadpoolctl==3.6.0
tika==2.6.0
tiktoken==0.13.0
tld==0.13.2
tldextract==5.3.1
togetherai-haystack==2.0.0
tokenizers==0.21.4
toml==0.10.2
tomlkit==0.15.0
torch==2.8.0+cpu
torchvision==0.23.0+cpu
tornado==6.5.5
tqdm==4.67.3
trafilatura==2.0.0
transformers==4.55.4
tree-sitter==0.25.2
tree-sitter-c==0.24.2
tree-sitter-javascript==0.25.0
tree-sitter-python==0.25.0
tree-sitter-typescript==0.23.2
tritonclient==2.51.0
typer==0.21.2
types-requests==2.33.0.20260518
typing-inspect==0.9.0
typing-inspection==0.4.2
typing_extensions==4.15.0
tzdata==2026.2
tzlocal==5.3.1
unstructured==0.21.5
unstructured-client==0.42.3
unstructured-fileconverter-haystack==1.0.0
urllib3==2.7.0
uuid6==2025.0.1
uuid_utils==0.16.0
uvicorn==0.47.0
uvloop==0.22.1
validators==0.35.0
valkey-glide==2.4.0
valkey-glide-sync==2.4.0
valkey-haystack==0.2.0
vllm-haystack==1.1.0
voyage-embedders-haystack==1.5.0
voyageai==0.3.7
wandb==0.27.0
wasabi==1.1.3
watchfiles==1.2.0
wcmatch==10.1
wcwidth==0.7.0
weasel==1.0.0
weave==0.52.25
weave-haystack==2.0.0
weaviate-client==4.21.0
weaviate-haystack==6.0.0
webencodings==0.5.1
websocket-client==1.9.0
websockets==16.0
wrapt==1.17.3
xlsxwriter==3.2.9
xxhash==3.7.0
yarl==1.24.2
yaspin==3.4.0
zipp==4.1.0
zstandard==0.25.0

queryapi

PackageVersion
abnf==2.2.0
accelerate==1.13.0
adbc-driver-manager==1.11.0
adbc-driver-snowflake==1.11.0
aimlapi-haystack==2.0.0
aiobotocore==3.7.0
aiofiles==25.1.0
aiohappyeyeballs==2.6.2
aiohttp==3.13.5
aioitertools==0.13.0
aiolimiter==1.2.1
aiosignal==1.4.0
aiosqlite==0.22.1
alloydb-haystack==0.1.0
amazon-bedrock-haystack==6.10.2
amazon-sagemaker-haystack==0.3.0
amazon-sns-extended-client==1.0.1
annotated-doc==0.0.4
annotated-types==0.7.0
anthropic==0.103.1
anthropic-haystack==5.9.0
antlr4-python3-runtime==4.9.3
anyio==4.13.0
appdirs==1.4.4
arcadedb-haystack==1.2.0
arrow==1.4.0
asn1crypto==1.5.1
astra-haystack==4.3.0
astrapy==1.5.2
asyncer==0.0.17
asyncpg==0.31.0
attrs==26.1.0
Authlib==1.7.2
azure-ai-documentintelligence==1.0.2
azure-ai-formrecognizer==3.3.3
azure-ai-search-haystack==4.0.0
azure-common==1.1.28
azure-core==1.41.0
azure-doc-intelligence-haystack==1.0.0
azure-identity==1.25.3
azure-search-documents==12.0.0
babel==2.18.0
backoff==2.2.1
batched==0.1.5
bcrypt==5.0.0
beautifulsoup4==4.14.3
blis==1.3.3
boltons==25.0.0
boto3==1.42.90
boto3-extensions==0.23.0
botocore==1.42.90
bracex==2.6
brave-haystack==0.1.0
build==1.5.0
bytecode==0.17.0
catalogue==2.0.10
certifi==2026.5.20
cffi==2.0.0
chardet==7.4.3
charset-normalizer==3.4.7
chroma-haystack==4.3.0
chromadb==1.5.9
cint==1.0.0
click==8.2.0
cloudpathlib==0.24.0
cohere==5.21.1
cohere-haystack==4.2.0
colorlog==6.10.1
cometapi-haystack==2.1.0
confection==1.3.3
courlan==1.3.2
cryptography==48.0.0
cymem==2.0.13
dataclasses-json==0.6.7
datasets==4.8.5
dateparser==1.4.0
dc-query-api==2.1.105
dc-unified-logging==0.0.5
ddtrace==4.7.0
deepl==1.30.0
deepl-haystack==0.3.0
deepset-cloud-custom-nodes==2.0.299
deepset-cloud-sdk==1.7.5
defusedxml==0.7.1
Deprecated==1.3.1
deprecation==2.1.0
dill==0.4.1
diskcache==5.6.3
distro==1.9.0
dnspython==2.8.0
dockerfile-parse==2.0.1
docling==2.94.0
docling-core==2.77.0
docling-haystack==0.3.0
docling-ibm-models==3.13.2
docling-parse==5.11.0
docling-serve-haystack==1.0.0
docling-slim==2.94.0
docstring_parser==0.18.0
durationpy==0.10
e2b==2.21.1
e2b-haystack==1.0.0
elastic-transport==8.17.1
elasticsearch==8.19.3
elasticsearch-haystack==5.4.0
email-validator==2.3.0
emoji==2.15.0
envier==0.6.1
et_xmlfile==2.0.0
eval_type_backport==0.3.1
evaluate==0.4.6
Events==0.5
exceptiongroup==1.3.1
face==26.0.0
Faker==40.18.0
FalkorDB==1.6.1
falkordb-haystack==1.1.0
fastapi==0.135.3
fastapi-cli==0.0.24
fastapi-cloud-cli==0.17.1
fastapi-openai-compat==1.2.0
fastar==0.11.0
fastavro==1.12.2
fastembed==0.8.0
fastembed-haystack==1.4.1
ffmpeg-python==0.2.0
fickling==0.1.11
filelock==3.29.0
filetype==1.2.0
fire==0.7.1
firecrawl-haystack==1.1.0
firecrawl-py==4.27.1
flatbuffers==25.12.19
frozenlist==1.8.0
fsspec==2026.2.0
future==1.0.0
gitdb==4.0.12
github-haystack==1.2.0
GitPython==3.1.50
glom==25.12.0
google-api-core==2.30.3
google-auth==2.53.0
google-cloud-alloydb==0.9.0
google-cloud-alloydb-connector==1.13.0
google-genai==2.5.0
google-genai-haystack==3.1.0
googleapis-common-protos==1.75.0
gql==4.0.0
graphql-core==3.2.8
graphviz==0.21
greenlet==3.5.1
grpc-google-iam-v1==0.14.4
grpcio==1.78.0
grpcio-status==1.71.2
h11==0.16.0
h2==4.3.0
hayhooks==1.19.1
haystack-ai==2.29.0
haystack-experimental==0.19.0
hf-xet==1.5.0
hpack==4.1.0
html5lib==1.1
htmldate==1.9.4
httpcore==1.0.9
httptools==0.7.1
httpx==0.28.1
httpx-sse==0.4.3
huggingface_hub==0.36.2
hyperframe==6.1.0
idna==3.15
importlib_metadata==8.6.1
importlib_resources==7.1.0
iniconfig==2.3.0
installer==0.7.0
intervaltree==3.2.1
invoke==2.2.1
isodate==0.7.2
jina-haystack==0.5.1
Jinja2==3.1.6
jiter==0.15.0
jmespath==1.1.0
joblib==1.5.3
joserfc==1.6.5
jq==1.11.0
jsonlines==4.0.0
jsonpatch==1.33
jsonpointer==3.1.1
jsonref==1.1.0
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
jusText==3.0.2
kaitaistruct==0.11
kubernetes==36.0.0
langchain==1.3.1
langchain-classic==1.0.7
langchain-community==0.4.1
langchain-core==1.4.0
langchain-openai==1.2.1
langchain-protocol==0.0.15
langchain-text-splitters==1.1.2
langdetect==1.0.9
langfuse==2.60.10
langfuse-haystack==2.2.0
langgraph==1.2.0
langgraph-checkpoint==4.1.0
langgraph-prebuilt==1.1.0
langgraph-sdk==0.3.14
langsmith==0.8.5
lara-haystack==1.0.0
lara-sdk==1.10.2
latex2mathml==3.81.0
lazy_imports==1.2.0
llama-cpp-haystack==1.1.0
llama-stack-api==0.7.1
llama-stack-haystack==1.0.0
llama_cpp_python==0.3.23
llama_stack==0.4.5
llvmlite==0.47.0
loguru==0.7.3
lxml==6.1.1
lxml_html_clean==0.4.5
magika==0.6.2
markdown-it-py==3.0.0
markdownify==1.2.2
markitdown==0.1.5
markitdown-haystack==1.0.0
marko==2.2.2
MarkupSafe==3.0.3
marshmallow==3.26.2
mcp==1.27.1
mcp-haystack==1.0.0
mdit-plain==1.0.1
mdurl==0.1.2
mem0ai==2.0.2
meta-llama-haystack==1.1.0
mistral-haystack==1.0.1
mistralai==1.9.11
mmh3==5.2.1
mongodb-atlas-haystack==3.2.1
more-itertools==11.0.2
mpire==2.10.2
mpmath==1.3.0
msal==1.36.0
msal-extensions==1.3.1
msgspec==0.21.1
msrest==0.7.1
multidict==6.7.1
multiprocess==0.70.19
murmurhash==1.0.15
mxbai-rerank==0.1.6
mypy_extensions==1.1.0
nest-asyncio==1.6.0
networkx==3.6.1
nltk==3.9.4
numba==0.65.1
numpy==1.26.4
nvidia-haystack==0.3.0
oauthlib==3.3.1
olefile==0.47
ollama==0.6.2
ollama-haystack==3.0.1
omegaconf==2.3.0
onnxruntime==1.26.0
openai==2.37.0
opencv-python==4.11.0.86
openinference-instrumentation==0.1.51
openinference-instrumentation-haystack==0.1.30
openinference-semantic-conventions==0.1.29
openpyxl==3.1.5
openrouter-haystack==0.2.0
opensearch-haystack==8.1.0
opensearch-protobufs==1.2.0
opensearch-py==3.2.0
opentelemetry-api==1.33.1
opentelemetry-exporter-otlp-proto-common==1.33.1
opentelemetry-exporter-otlp-proto-grpc==1.33.1
opentelemetry-exporter-otlp-proto-http==1.33.1
opentelemetry-instrumentation==0.54b1
opentelemetry-proto==1.33.1
opentelemetry-sdk==1.33.1
opentelemetry-semantic-conventions==0.54b1
oracle-haystack==0.2.0
oracledb==2.5.1
orjson==3.11.9
ormsgpack==1.12.2
overrides==7.7.0
packaging==24.2
pandas==3.0.3
pdf2image==1.17.0
pdfminer.six==20250506
pgvector==0.4.2
pgvector-haystack==6.3.0
phonenumbers==9.0.30
pillow==12.2.0
pinecone==9.0.1
pinecone_haystack==5.1.0
platformdirs==4.9.6
pluggy==1.6.0
polars==1.40.1
polars-runtime-32==1.40.1
polyfactory==3.3.0
polyfile-weave==0.5.7
portalocker==3.2.0
posthog==7.15.1
preshed==3.0.13
presidio-haystack==2.1.0
presidio_analyzer==2.2.362
presidio_anonymizer==2.2.362
prompt_toolkit==3.0.52
propcache==0.5.2
proto-plus==1.28.0
protobuf==4.25.9
psutil==7.2.2
psycopg==3.3.4
psycopg-binary==3.3.4
psycopg2-binary==2.9.12
py_rust_stemmers==0.1.5
pyarrow==24.0.0
pyasn1==0.6.3
pyasn1_modules==0.4.2
pybase64==1.4.3
pyclipper==1.4.0
pycparser==3.0
pydantic==2.13.0
pydantic-extra-types==2.11.1
pydantic-settings==2.14.1
pydantic_core==2.46.0
Pygments==2.20.0
PyJWT==2.12.1
pylatexenc==2.10
pymongo==10.10.10.10
pyOpenSSL==26.2.0
pypdf==5.1.0
pypdfium2==5.8.0
PyPika==0.51.1
pyproject_hooks==1.2.0
pyrate-limiter==4.1.0
pytest==8.4.2
pytest-dotenv==0.5.2
python-dateutil==2.9.0.post0
python-docx==1.1.2
python-dotenv==1.2.2
python-iso639==2026.4.20
python-magic==0.4.27
python-multipart==0.0.29
python-oxmsg==0.0.2
python-pptx==1.0.2
python-rapidjson==1.23
pytz==2026.2
pyversity==0.2.0
pyversity-haystack==1.0.0
PyYAML==6.0.3
qdrant-client==1.18.0
qdrant-haystack==9.1.1
ragas==0.2.15
ragas-haystack==2.2.0
RapidFuzz==3.14.5
rapidocr==3.8.1
redis==7.4.0
referencing==0.37.0
regex==2026.5.9
requests==2.34.2
requests-file==3.0.1
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
rich==15.0.0
rich-toolkit==0.19.9
rignore==0.7.6
rpds-py==0.30.0
rtree==1.4.1
ruamel.yaml==0.19.1
s3transfer==0.16.1
safetensors==0.7.0
scikit-learn==1.8.0
scipy==1.17.1
semchunk==3.2.5
sentence-transformers==5.5.1
sentencepiece==0.2.1
sentry-sdk==2.60.0
setfit==1.1.3
setuptools==82.0.1
shapely==2.1.2
shellingham==1.5.4
six==1.17.0
smart_open==7.6.1
smmap==5.0.3
sniffio==1.3.1
snowflake-connector-python==4.5.0
snowflake-haystack==2.0.0
sortedcontainers==2.4.0
soupsieve==2.8.3
spacy==3.8.14
spacy-legacy==3.0.12
spacy-loggers==1.0.5
SQLAlchemy==2.0.49
sqlalchemy-haystack==0.1.0
srsly==2.5.3
sse-starlette==3.4.4
stackit-haystack==1.2.0
starlette==1.0.0
structlog==25.5.0
supabase-haystack==0.1.0
sympy==1.14.0
tabulate==0.10.0
tavily-haystack==0.1.0
tavily-python==0.7.24
tenacity==9.1.4
termcolor==3.3.0
thinc==8.3.13
threadpoolctl==3.6.0
tika==2.6.0
tiktoken==0.13.0
tld==0.13.2
tldextract==5.3.1
togetherai-haystack==2.0.0
tokenizers==0.21.4
toml==0.10.2
tomlkit==0.15.0
torch==2.8.0+cpu
torchvision==0.23.0+cpu
tornado==6.5.5
tqdm==4.67.3
trafilatura==2.0.0
transformers==4.55.4
tree-sitter==0.25.2
tree-sitter-c==0.24.2
tree-sitter-javascript==0.25.0
tree-sitter-python==0.25.0
tree-sitter-typescript==0.23.2
tritonclient==2.51.0
typer==0.21.2
types-requests==2.33.0.20260518
typing-inspect==0.9.0
typing-inspection==0.4.2
typing_extensions==4.15.0
tzdata==2026.2
tzlocal==5.3.1
unstructured==0.21.5
unstructured-client==0.42.3
unstructured-fileconverter-haystack==1.0.0
urllib3==2.7.0
uuid6==2025.0.1
uuid_utils==0.16.0
uvicorn==0.44.0
uvloop==0.22.1
validators==0.35.0
valkey-glide==2.4.0
valkey-glide-sync==2.4.0
valkey-haystack==0.2.0
vllm-haystack==1.1.0
voyage-embedders-haystack==1.5.0
voyageai==0.3.7
wandb==0.27.0
wasabi==1.1.3
watchfiles==1.2.0
wcmatch==10.1
wcwidth==0.7.0
weasel==1.0.0
weave==0.52.25
weave-haystack==2.0.0
weaviate-client==4.21.0
weaviate-haystack==6.0.0
webencodings==0.5.1
websocket-client==1.9.0
websockets==16.0
wrapt==1.17.3
xlsxwriter==3.2.9
xxhash==3.7.0
yarl==1.24.2
yaspin==3.4.0
zipp==4.1.0
zstandard==0.25.0

utilities

PackageVersion
abnf==2.2.0
accelerate==1.13.0
adbc-driver-manager==1.11.0
adbc-driver-snowflake==1.11.0
aimlapi-haystack==2.0.0
aiobotocore==3.7.0
aiofiles==25.1.0
aiohappyeyeballs==2.6.2
aiohttp==3.13.5
aioitertools==0.13.0
aiolimiter==1.2.1
aiosignal==1.4.0
aiosqlite==0.22.1
alloydb-haystack==0.1.0
amazon-bedrock-haystack==6.10.2
amazon-sagemaker-haystack==0.3.0
amazon-sns-extended-client==1.0.1
annotated-doc==0.0.4
annotated-types==0.7.0
anthropic==0.103.1
anthropic-haystack==5.9.0
antlr4-python3-runtime==4.9.3
anyio==4.13.0
appdirs==1.4.4
arcadedb-haystack==1.2.0
argon2-cffi==25.1.0
argon2-cffi-bindings==25.1.0
arrow==1.4.0
asn1crypto==1.5.1
astra-haystack==4.3.0
astrapy==1.5.2
asyncer==0.0.17
asyncpg==0.31.0
attrs==26.1.0
Authlib==1.7.2
azure-ai-documentintelligence==1.0.2
azure-ai-formrecognizer==3.3.3
azure-ai-search-haystack==4.0.0
azure-common==1.1.28
azure-core==1.41.0
azure-doc-intelligence-haystack==1.0.0
azure-identity==1.25.3
azure-search-documents==12.0.0
babel==2.18.0
backoff==2.2.1
batched==0.1.5
bcrypt==5.0.0
beautifulsoup4==4.14.3
blis==1.3.3
boltons==25.0.0
boto3==1.42.90
boto3-extensions==0.23.0
botocore==1.42.90
bracex==2.6
brave-haystack==0.1.0
build==1.5.0
bytecode==0.17.0
catalogue==2.0.10
certifi==2026.5.20
cffi==2.0.0
chardet==7.4.3
charset-normalizer==3.4.7
chroma-haystack==4.3.0
chromadb==1.5.9
cint==1.0.0
click==8.2.0
cloudpathlib==0.24.0
cohere==5.21.1
cohere-haystack==4.2.0
colorlog==6.10.1
cometapi-haystack==2.1.0
confection==1.3.3
courlan==1.3.2
cryptography==46.0.7
cymem==2.0.13
dataclasses-json==0.6.7
datasets==4.8.5
dateparser==1.4.0
dc-haystack-utilities==2.7.7
dc-unified-logging==0.0.5
ddtrace==4.7.0
deepl==1.30.0
deepl-haystack==0.3.0
deepset-cloud-custom-nodes==2.0.299
deepset-cloud-sdk==1.7.5
defusedxml==0.7.1
Deprecated==1.3.1
deprecation==2.1.0
dill==0.4.1
diskcache==5.6.3
distro==1.9.0
dnspython==2.8.0
dockerfile-parse==2.0.1
docling==2.94.0
docling-core==2.77.0
docling-haystack==0.3.0
docling-ibm-models==3.13.2
docling-parse==5.11.0
docling-serve-haystack==1.0.0
docling-slim==2.94.0
docstring_parser==0.18.0
durationpy==0.10
e2b==2.21.1
e2b-haystack==1.0.0
elastic-transport==8.17.1
elasticsearch==8.19.3
elasticsearch-haystack==5.4.0
email-validator==2.3.0
emoji==2.15.0
envier==0.6.1
et_xmlfile==2.0.0
eval_type_backport==0.3.1
evaluate==0.4.6
Events==0.5
exceptiongroup==1.3.1
face==26.0.0
Faker==40.18.0
FalkorDB==1.6.1
falkordb-haystack==1.1.0
fastapi==0.135.3
fastapi-cli==0.0.24
fastapi-cloud-cli==0.17.1
fastapi-openai-compat==1.2.0
fastar==0.11.0
fastavro==1.12.2
fastembed==0.8.0
fastembed-haystack==1.4.1
ffmpeg-python==0.2.0
fickling==0.1.11
filelock==3.29.0
filetype==1.2.0
fire==0.7.1
firecrawl-haystack==1.1.0
firecrawl-py==4.27.1
flatbuffers==25.12.19
frozenlist==1.8.0
fsspec==2026.2.0
future==1.0.0
gitdb==4.0.12
github-haystack==1.2.0
GitPython==3.1.50
glom==25.12.0
google-api-core==2.30.3
google-auth==2.53.0
google-cloud-alloydb==0.9.0
google-cloud-alloydb-connector==1.13.0
google-genai==2.5.0
google-genai-haystack==3.1.0
googleapis-common-protos==1.75.0
gql==4.0.0
graphql-core==3.2.8
graphviz==0.21
greenlet==3.5.1
grpc-google-iam-v1==0.14.4
grpcio==1.78.0
grpcio-status==1.71.2
h11==0.16.0
h2==4.3.0
hayhooks==1.19.1
haystack-ai==2.29.0
haystack-experimental==0.19.0
hf-xet==1.5.0
hpack==4.1.0
html5lib==1.1
htmldate==1.9.4
httpcore==1.0.9
httptools==0.7.1
httpx==0.28.1
httpx-sse==0.4.3
huggingface_hub==0.36.2
hyperframe==6.1.0
idna==3.15
importlib_metadata==8.6.1
importlib_resources==7.1.0
iniconfig==2.3.0
installer==0.7.0
intervaltree==3.2.1
invoke==2.2.1
isodate==0.7.2
jina-haystack==0.5.1
Jinja2==3.1.6
jiter==0.15.0
jmespath==1.1.0
joblib==1.5.3
joserfc==1.6.5
jq==1.11.0
jsonlines==4.0.0
jsonpatch==1.33
jsonpointer==3.1.1
jsonref==1.1.0
jsonschema==4.26.0
jsonschema-specifications==2025.9.1
jusText==3.0.2
kaitaistruct==0.11
kubernetes==36.0.0
langchain==1.3.1
langchain-classic==1.0.7
langchain-community==0.4.1
langchain-core==1.4.0
langchain-openai==1.2.1
langchain-protocol==0.0.15
langchain-text-splitters==1.1.2
langdetect==1.0.9
langfuse==2.60.10
langfuse-haystack==2.2.0
langgraph==1.2.0
langgraph-checkpoint==4.1.0
langgraph-prebuilt==1.1.0
langgraph-sdk==0.3.14
langsmith==0.8.5
lara-haystack==1.0.0
lara-sdk==1.10.2
latex2mathml==3.81.0
lazy_imports==1.2.0
llama-cpp-haystack==1.1.0
llama-stack-api==0.7.1
llama-stack-haystack==1.0.0
llama_cpp_python==0.3.23
llama_stack==0.4.5
llvmlite==0.47.0
loguru==0.7.3
lxml==6.1.1
lxml_html_clean==0.4.5
magika==0.6.2
markdown-it-py==3.0.0
markdownify==1.2.2
markitdown==0.1.5
markitdown-haystack==1.0.0
marko==2.2.2
MarkupSafe==3.0.3
marshmallow==3.26.2
mcp==1.27.1
mcp-haystack==1.0.0
mdit-plain==1.0.1
mdurl==0.1.2
mem0ai==2.0.2
meta-llama-haystack==1.1.0
mistral-haystack==1.0.1
mistralai==1.9.11
mmh3==5.2.1
mongodb-atlas-haystack==3.2.1
more-itertools==11.0.2
mpire==2.10.2
mpmath==1.3.0
msal==1.36.0
msal-extensions==1.3.1
msgspec==0.21.1
msrest==0.7.1
multidict==6.7.1
multiprocess==0.70.19
murmurhash==1.0.15
mxbai-rerank==0.1.6
mypy_extensions==1.1.0
nest-asyncio==1.6.0
networkx==3.6.1
nltk==3.9.4
numba==0.65.1
numpy==1.26.4
nvidia-haystack==0.3.0
oauthlib==3.3.1
olefile==0.47
ollama==0.6.2
ollama-haystack==3.0.1
omegaconf==2.3.0
onnxruntime==1.26.0
openai==2.37.0
opencv-python==4.11.0.86
openinference-instrumentation==0.1.51
openinference-instrumentation-haystack==0.1.30
openinference-semantic-conventions==0.1.29
openpyxl==3.1.5
openrouter-haystack==0.2.0
opensearch-haystack==8.1.0
opensearch-protobufs==1.2.0
opensearch-py==3.2.0
opentelemetry-api==1.33.1
opentelemetry-exporter-otlp-proto-common==1.33.1
opentelemetry-exporter-otlp-proto-grpc==1.33.1
opentelemetry-exporter-otlp-proto-http==1.33.1
opentelemetry-instrumentation==0.54b1
opentelemetry-proto==1.33.1
opentelemetry-sdk==1.33.1
opentelemetry-semantic-conventions==0.54b1
oracle-haystack==0.2.0
oracledb==2.5.1
orjson==3.11.9
ormsgpack==1.12.2
overrides==7.7.0
packaging==24.2
pandas==3.0.3
pdf2image==1.17.0
pdfminer.six==20250506
pgvector==0.4.2
pgvector-haystack==6.3.0
phonenumbers==9.0.30
pika==1.3.2
pillow==12.2.0
pinecone==9.0.1
pinecone_haystack==5.1.0
platformdirs==4.9.6
pluggy==1.6.0
polars==1.40.1
polars-runtime-32==1.40.1
polyfactory==3.3.0
polyfile-weave==0.5.7
portalocker==3.2.0
posthog==7.15.1
preshed==3.0.13
presidio-haystack==2.1.0
presidio_analyzer==2.2.362
presidio_anonymizer==2.2.362
prompt_toolkit==3.0.52
propcache==0.5.2
proto-plus==1.28.0
protobuf==4.25.9
psutil==7.2.2
psycopg==3.3.4
psycopg-binary==3.3.4
psycopg2-binary==2.9.12
py_rust_stemmers==0.1.5
pyarrow==24.0.0
pyasn1==0.6.3
pyasn1_modules==0.4.2
pybase64==1.4.3
pyclipper==1.4.0
pycparser==3.0
pydantic==2.13.0
pydantic-extra-types==2.11.1
pydantic-settings==2.14.1
pydantic_core==2.46.0
Pygments==2.20.0
PyJWT==2.12.1
pylatexenc==2.10
pymongo==10.10.10.10
pyOpenSSL==26.2.0
pypdf==5.1.0
pypdfium2==5.8.0
PyPika==0.51.1
pyproject_hooks==1.2.0
pyrate-limiter==4.1.0
pytest==8.4.2
pytest-dotenv==0.5.2
python-dateutil==2.9.0.post0
python-docx==1.1.2
python-dotenv==1.2.2
python-iso639==2026.4.20
python-magic==0.4.27
python-multipart==0.0.29
python-oxmsg==0.0.2
python-pptx==1.0.2
python-rapidjson==1.23
pytz==2026.2
pyversity==0.2.0
pyversity-haystack==1.0.0
PyYAML==6.0.3
qdrant-client==1.18.0
qdrant-haystack==9.1.1
ragas==0.2.15
ragas-haystack==2.2.0
RapidFuzz==3.14.5
rapidocr==3.8.1
redis==7.4.0
referencing==0.37.0
regex==2026.5.9
requests==2.34.2
requests-file==3.0.1
requests-oauthlib==2.0.0
requests-toolbelt==1.0.0
rich==15.0.0
rich-toolkit==0.19.9
rignore==0.7.6
rpds-py==0.30.0
rtree==1.4.1
ruamel.yaml==0.19.1
s3transfer==0.16.1
safetensors==0.7.0
scikit-learn==1.8.0
scipy==1.17.1
semchunk==3.2.5
sentence-transformers==5.5.1
sentencepiece==0.2.1
sentry-sdk==2.60.0
setfit==1.1.3
setuptools==82.0.1
shapely==2.1.2
shellingham==1.5.4
six==1.17.0
smart_open==7.6.1
smmap==5.0.3
sniffio==1.3.1
snowflake-connector-python==4.5.0
snowflake-haystack==2.0.0
sortedcontainers==2.4.0
soupsieve==2.8.3
spacy==3.8.14
spacy-legacy==3.0.12
spacy-loggers==1.0.5
SQLAlchemy==2.0.49
sqlalchemy-haystack==0.1.0
srsly==2.5.3
sse-starlette==3.4.4
stackit-haystack==1.2.0
starlette==1.0.0
starlette-context==0.5.1
structlog==25.5.0
supabase-haystack==0.1.0
sympy==1.14.0
tabulate==0.10.0
tavily-haystack==0.1.0
tavily-python==0.7.24
tenacity==9.1.4
termcolor==3.3.0
thinc==8.3.13
threadpoolctl==3.6.0
tika==2.6.0
tiktoken==0.13.0
tld==0.13.2
tldextract==5.3.1
togetherai-haystack==2.0.0
tokenizers==0.21.4
toml==0.10.2
tomlkit==0.15.0
torch==2.8.0+cpu
torchvision==0.23.0+cpu
tornado==6.5.5
tqdm==4.67.3
trafilatura==2.0.0
transformers==4.55.4
tree-sitter==0.25.2
tree-sitter-c==0.24.2
tree-sitter-javascript==0.25.0
tree-sitter-python==0.25.0
tree-sitter-typescript==0.23.2
tritonclient==2.51.0
typer==0.21.2
types-requests==2.33.0.20260518
typing-inspect==0.9.0
typing-inspection==0.4.2
typing_extensions==4.15.0
tzdata==2026.2
tzlocal==5.3.1
unstructured==0.21.5
unstructured-client==0.42.3
unstructured-fileconverter-haystack==1.0.0
urllib3==2.7.0
uuid6==2025.0.1
uuid_utils==0.16.0
uvicorn==0.44.0
uvloop==0.22.1
validators==0.35.0
valkey-glide==2.4.0
valkey-glide-sync==2.4.0
valkey-haystack==0.2.0
vllm-haystack==1.1.0
voyage-embedders-haystack==1.5.0
voyageai==0.3.7
wandb==0.27.0
wasabi==1.1.3
watchfiles==1.2.0
wcmatch==10.1
wcwidth==0.7.0
weasel==1.0.0
weave==0.52.25
weave-haystack==2.0.0
weaviate-client==4.21.0
weaviate-haystack==6.0.0
webencodings==0.5.1
websocket-client==1.9.0
websockets==16.0
wrapt==1.17.3
xlsxwriter==3.2.9
xxhash==3.7.0
yarl==1.24.2
yaspin==3.4.0
zipp==4.1.0
zstandard==0.25.0
  1. Drag the Code component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. On the General tab:
    1. Enter your Python code in the code parameter. Write a class decorated with @component that exposes a run() method. The class must not define custom __init__ parameters.
    2. Define input variable names in input_names. These correspond to the parameters of your run() method.
    3. Define output variable names in output_names. These correspond to the values declared in @component.output_types.
  4. Go to the Advanced tab to configure a timeout if needed.
note

Code is best suited for pipelines where your code has no external dependencies and you don't need CI/CD versioning. If you need more control, consider creating a custom component instead.

You can save the component and reuse it across multiple pipelines. Saved Code components appear in the Your Custom Components section in the Component Library. For details, see Add a Code Component.

Connections

You define the component's inputs and outputs in its run() method and @component.output_types decorator. The inputs are the parameters of run() and the outputs are declared with @component.output_types. Code can connect with any component whose input and output socket types match those you declare in your code.

Usage Example

This is a query pipeline that masks sensitive information, like emails or phone numbers, before sending the data to an LLM. pii_redactor is a Code component with custom Python code that masks the sensitive information.

components:
pii_redactor:
type: deepset_cloud_custom_nodes.code.code_component.Code
init_parameters:
code: |
import re
from haystack import component

@component
class Code:
"""Masks personally identifiable information before LLM processing."""

@component.output_types(redacted_text=str, pii_found=bool)
def run(self, text: str) -> dict:
redacted = text
pii_found = False

# Email addresses
email_pattern = r'\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b'
if re.search(email_pattern, redacted):
pii_found = True
redacted = re.sub(email_pattern, '[EMAIL]', redacted)

# Phone numbers (various formats)
phone_pattern = r'\b(\+?1?[-.\s]?)?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}\b'
if re.search(phone_pattern, redacted):
pii_found = True
redacted = re.sub(phone_pattern, '[PHONE]', redacted)

return {"redacted_text": redacted, "pii_found": pii_found}

prompt_builder:
type: haystack.components.builders.prompt_builder.PromptBuilder
init_parameters:
template: |
Help the user with their request: {{ query }}

llm:
type: haystack.components.generators.openai.OpenAIGenerator
init_parameters:
model: gpt-4o-mini
api_key:
type: env_var
env_vars:
- OPENAI_API_KEY
strict: false

answer_builder:
type: haystack.components.builders.answer_builder.AnswerBuilder
init_parameters: {}

connections:
- sender: pii_redactor.redacted_text
receiver: prompt_builder.query
- sender: prompt_builder.prompt
receiver: llm.prompt
- sender: llm.replies
receiver: answer_builder.replies

inputs:
query:
- answer_builder.query
- pii_redactor.text

outputs:
answers: answer_builder.answers

max_runs_per_component: 100

metadata: {}

This is what the component looks like in the Builder:

Code Component in Builder

Parameters

Inputs

The inputs are dynamically defined by the parameters of the run() method in your code. Use input_names to declare which parameter names to expose.

Outputs

The outputs are dynamically defined by the @component.output_types decorator in your code. Use output_names to declare which output names to expose.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
codestrPython source that defines exactly one class decorated with @component. The class must not add custom __init__ parameters and must expose a run() method.
input_namesList[str]Names of the input variables for the component, corresponding to the parameters of the run() method.
output_namesList[str]Names of the output variables for the component, corresponding to the values declared in @component.output_types.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
Inputs defined in your codeDynamicInherited from the wrapped componentWhatever arguments your inline component declares become keyword arguments for run(). Set them the same way you would configure any other component parameter.