Quickstart
Learn how to deploy a Haystack pipeline you built locally to Haystack Enterprise Platform using the SDK. This quickstart guides you through how to validate, run, and deploy a pipeline in under five minutes. You'll learn how to deploy a pipeline as a service and iterate on it.
Prerequisites
- Install the SDK.
- A local Haystack pipeline.
- A Haystack Platform API key. Get one from API Keys in Haystack Enterprise Platform. For help, see Generate an API key.
The SDK loads your pipeline with the interpreter from the nearest .venv or venv directory above your pipeline file. If your project environment lives somewhere else, add --python /path/to/python to the validate, run, and deploy commands.
Step 1: Log In
Run this command to log in to your Haystack Platform workspace:
haystack-enterprise login
Paste your API key, then choose a default workspace. The SDK saves both, so you log in once.
For information on the settings the SDK saves and how to change them, see Set Up Configuration.
Result: The SDK is connected to your workspace.
Step 2: Validate the Pipeline
Run the validate command to convert your pipeline into deployable YAML and send it to the Haystack Platform for checking. It doesn't deploy the pipeline.
haystack-enterprise validate pipeline.py
Validation prints warnings and errors. Blocking errors also make the command exit with a non-zero code, which is what a CI job checks. When you see Pipeline is valid., your pipeline is ready to deploy.
The first validation for each haystack-ai version takes longer, because the platform builds an environment for that version. Later validations are faster because they reuse the environment.
Result: If the pipeline is valid, you'll see Pipeline is valid. in your terminal.
Step 3: Run the Pipeline
Query your pipeline to see the output in your terminal:
haystack-enterprise run pipeline.py --query "What is deepset?"
The platform runs your pipeline in a sandbox and prints the results in your terminal. This still deploys nothing. Use run to check the output before you create a service.
Result: You can see your pipeline's output in your terminal.
Step 4: Deploy the Pipeline
Run the deploy command to deploy your pipeline as a service with a stable endpoint:
haystack-enterprise deploy pipeline.py my-service
Running this command does the following:
- Creates the
my-serviceservice, if it doesn't exist yet. - Pushes your pipeline to this service as a new revision.
- Activates that revision.
You may be asked which input socket receives the query and which output socket returns the answer. Sockets are the named inputs and outputs of your pipeline's components. If your socket names already make the choice clear, the SDK figures it out on its own.
When the service starts serving requests, deploy prints its chat completions endpoint:
POST https://api.cloud.deepset.ai/api/v1/workspaces/<workspace>/deployments/<deployment-id>/chat/completions
The endpoint is OpenAI-compatible, so any OpenAI client can call it. Set the client's base_url to everything up to and including /deployments/<deployment-id>.
Result: Your pipeline serves requests at its own endpoint.
Step 5: Check the Service Status
Check the service any time:
haystack-enterprise service-status my-service
Result: For a running service, you'll see its status, endpoint, and other details.
Iterate on Your Pipeline
Edit your pipeline file and repeat steps 2 to 4. Each deploy creates a new revision, so your changes go out incrementally.
Summary
You validated a local Haystack pipeline against the platform, ran it in the sandbox to check its output, and deployed it as a service. You also know which command to repeat after each edit.
Next Steps
- Deploy a Pipeline: the full flow, including managed services, prototype links, and the io-config file.
- Upload Files: get documents into a workspace.
- CLI Reference: every command and flag.
Was this page helpful?