ray.serve.api.build(target: Union[ray.dag.class_node.ClassNode, ray.dag.function_node.FunctionNode]) ray.serve.application.Application[source]#

Builds a Serve application into a static application.

Takes in a ClassNode or FunctionNode and converts it to a Serve application consisting of one or more deployments. This is intended to be used for production scenarios and deployed via the Serve REST API or CLI, so there are some restrictions placed on the deployments: 1) All of the deployments must be importable. That is, they cannot be defined in __main__ or inline defined. The deployments will be imported in production using the same import path they were here. 2) All arguments bound to the deployment must be JSON-serializable.

The returned Application object can be exported to a dictionary or YAML config.


target (Union[ClassNode, FunctionNode]) – A ClassNode or FunctionNode that acts as the top level node of the DAG.


The static built Serve application

PublicAPI (alpha): This API is in alpha and may change before becoming stable.