Create a ServiceBeta
A service runs your pipeline and serves queries. Services decouple the pipeline from the endpoint that serves it. This way, you can continue to iterate on the pipeline in the Builder while keeping a stable and reliable endpoint for external callers. You create and manage services in Gateway.
About This Task
A service is a stable endpoint that exposes a published pipeline version to your callers. You can set the hosting settings for the service to control how it scales and how long it stays active.
A single service can have one pipeline version published to it. You can publish a new version to a service at any time and the endpoint URL stays the same. You can publish a single pipeline version to multiple services.
When you create a service through the API without setting deployment_mode, the service runs in serverless mode. Callers that relied on the earlier managed default now get a serverless service. If you need a managed service, set deployment_mode to MANAGED in the request. For details, see the Create Deployment API reference.
Each replica of a service gets this compute, depending on the instance size you select in step 4. Choose a larger size if your pipeline needs more CPU or memory per replica:
- Small: 1 vCPU, 2 GiB memory
- Medium: 1 vCPU, 4 GiB memory
- Large: 2 vCPU, 8 GiB memory
- Extra large: 4 vCPU, 16 GiB memory
Indexes use the same size names but get different compute. For details, see Configure Index Settings.
To learn more, see Gateway.
Prerequisites
You must have read and write permissions to services to perform this task. For details, see User Roles and Permissions.
Create a Service
- In the navigation, go to Gateway > Create service.
- Give your service a name and, optionally, a description to easily identify it. The name must be unique in the workspace. Names are case-sensitive, so
Supportandsupportare different names. - Optional: Add up to three tags to label the service.
- Configure the hosting settings for the service. You can keep the defaults or change them by clicking Advanced hosting settings:
-
Select the Instance size, which sets how much compute each replica gets. You can only choose sizes enabled for your organization. For details, see Managing Compute Settings. It's separate from the scaling preset below, which sets how many replicas run.
- Select the Scaling preset, which sets how many replicas run.
Hosting determines
Create a Service with the CLI
If your pipeline is in code, you can create the service and publish your first version in one step with the Haystack Enterprise SDK. Only Haystack pipelines and agents are supported.
- In Gateway, on the Create service page, click Have a pipeline in code? Create the service with the CLI instead. If your workspace has no services yet, click Create with the CLI in the empty state.
- In the Create a service with the CLI drawer, select With a coding agent or With the CLI.
- Copy the prompt or the commands and run them. Replace
my-servicewith your service name and<your_pipeline.py>with the Python file that defines your pipeline or agent.
The first run creates a new service with your pipeline as its first version. The service starts with default hosting settings, which you can change later in the service settings. The command fails if the service name is already taken. To publish an update later, run it again with --no-create instead of --create.
What To Do Next
- Click the service name to view active deployments and update service settings.
- Publish a pipeline version to the service.
- Call the service from your app, an OpenAI-compatible client, or an MCP client.
Related Information
Was this page helpful?