Publish a Pipeline to a ServiceBeta
Publish a pipeline version to a service to make it available to external callers in a stable endpoint. You can publish the same pipeline version to multiple services. One service can only serve one pipeline version.
About This Task
Services let you separate your work in progress from what's live in production. Once you publish a pipeline version to a service, external callers can use it there in a reliable environment, while you can continue to iterate on the pipeline in the Builder. Your services live in Gateway, where you can manage them.
To learn more, see Gateway.
Prerequisites
- A pipeline version ready to be published.
- Read and write permissions to services.
Publish a Pipeline to a Service
- In the navigation, go to Pipelines and click the name of the pipeline you want to publish.
- In Builder, click Publish. This publishes the current version. To publish a previous version, restore it first.
- Choose how you want to publish and move to the next step.
- Create a service and publish to it.
- Publish to an existing service.
Deploying a Pipeline without a ServiceThis just deploys the pipeline without any service. This option is not recommended for production use where external apps call your pipeline. Every time you deploy a new pipeline version, the endpoint URL changes.Deploying a pipeline is required to test it in the Playground. For production use, we recommend publishing it to a service, where the endpoint URL stays the same, regardless of the pipeline version you publish.
- If you're publishing to a new service:
- Give your service a name and, optionally, a description and tags to easily identify it. You can add up to three tags to help you group and filter your services later.
- Configure the hosting settings for the service. By default, this section is collapsed and shows a one-line summary of the selected instance size and scaling preset. To change the settings, click Advanced hosting settings to expand the section:Select the Instance size, which sets how much compute each replica gets: Small, Medium (default), Large, or Extra large. Choose a larger size if your pipeline needs more compute per request. The scaling preset below sets how many replicas run.
Hosting settingsHosting determines
the instance size,the minimum and maximum number of replicas that must be available for the service,and idle timeout. Idle timeout is the period of inactivity after which the service becomes inactive to save resources. You can update these settings at any time from the Service Details page.
- High demand: Choose this option for production pipelines that require high availability and scalability.
- Low demand: Choose this option for testing and pipelines that are not used frequently.
- Custom: Configure your own hosting settings.
If your organization has set up fleet environments and the service uses serverless hosting, you can reuse an environment's hosting settings instead of configuring your own. To do this, choose Environment under Hosting and pick an environment. The service inherits that environment's size, replicas, and idle timeout, which appear read-only. Choose Custom to set the service's own hosting settings. For details, see Manage Fleet Environments.
- Review the pipeline version, update the message to describe the changes, and click Create service. The service is starting. Wait until it's ready to serve queries. You can view it in Gateway.
- If you're publishing to an existing service:
- Choose the service from the list and click Continue to comparison.
- Review the pipeline version, update the message to describe the changes, and click Publish. The pipeline version is published to the service and the service is starting. Wait until it's ready to serve queries. You can view it in Gateway.
Publish to a Service That Has No Pipeline Yet
When you create a service without a pipeline, its Overview tab shows a Publish your first pipeline section with two options side by side. Pick the one that matches how you work: publish a pipeline you built in the platform, or publish a Haystack pipeline or agent from your machine with a coding agent or the CLI. Either way, you publish to this service only.
- In the navigation, click Gateway and click the name of the service.
- On Overview, choose how to publish:
- Publish from the platform: Click Publish a pipeline, then choose the pipeline and version to publish. If you haven't built a pipeline yet, click No pipeline yet? Build one first to go to Pipelines.
- Use the CLI or a coding agent: Select With a coding agent or With the CLI, as described below.
Publish with a Coding Agent
Use this option if you want a coding agent, such as Claude Code or Cursor, to do the work. The prompt tells the agent to install the Haystack Enterprise CLI, deploy your local Haystack pipeline to this service, and check that it's serving. It's pre-filled with your workspace, the service name, and the service's deployment ID, so the agent publishes to this service and doesn't create a new one.
- Under Use the CLI or a coding agent, select With a coding agent.
- Click the copy icon to copy the prompt.
- Paste the prompt into your coding agent and run it from the project that contains your pipeline.
- When the agent asks you to log in, complete the login in your browser. You only need to log in once.
Publish with the CLI
Use this option if you prefer to run the commands yourself. Each step shows a command you can copy.
- Under Use the CLI or a coding agent, select With the CLI.
- Under Install the CLI, copy and run the install command.
- Under Log in, copy and run
haystack-enterprise login. This opens your browser so you can pick a workspace. On a remote machine, add--device. - Under Publish to this service, copy and run the command. Replace
<your_pipeline.py>with the Python file that defines your pipeline or agent. The command adds a new version to this service. A different service name would create a new service. - Under Check that it is serving, copy and run the command to confirm the service is serving.
Only Haystack pipelines and agents are supported. For all CLI options, see Deploy a Pipeline.
After you publish, the Overview tab shows Waiting for the first published version. This page updates automatically. When the first version arrives, the page replaces this section with the service's usual Pipeline card and deployment history. You don't need to refresh the page.
If you only have read access to services, the Overview tab shows a message that no pipeline is published yet and asks you to contact a builder in the workspace to publish one.
What To Do Next
- Click the service name to view and update its details.
- Publish a pipeline version to the service.
- Create an API key for the service to use it in your code.
- Call the service from your app, an OpenAI-compatible client, or an MCP client.
Related Information
Was this page helpful?