Classes
App
Inherits from: BaseServable
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
_allow_init | bool | False | - |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
requirements | ClassVar[list[str]] | [] | List of pip packages to install in the environment. Supports standard pip syntax including version specifiers. Example: ["numpy==1.24.0", "torch\>=2.0.0"] |
local_python_modules | ClassVar[list[str]] | [] | List of local Python module names to include in the deployment. Use for custom code not available on PyPI. Example: ["my_utils", "models"] |
machine_type | ClassVar[str | list[str]] | 'S' | Compute instance type for your application. CPU options: ‘XS’, ‘S’ (default), ‘M’, ‘L’. GPU options: ‘GPU-A6000’, ‘GPU-A100’, ‘GPU-H100’, ‘GPU-H200’, ‘GPU-B200’. Use a string for a single type, or a list to define fallback types (tried in order until one is available). Example: "GPU-A100" or ["GPU-H100", "GPU-A100"] |
num_gpus | ClassVar[int | None] | None | Number of GPUs to allocate. Only applies to GPU machine types. |
regions | ClassVar[Optional[list[str]]] | None | Allowed regions for deployment. None means any region. Example: ["us-east", "eu-west"] |
host_kwargs | ClassVar[dict[str, Any]] | \{'_scheduler': 'nomad', '_scheduler_options': \{'storage_region': 'us-east'\}, 'resolver': 'uv', 'keep_alive': 60\} | Advanced configuration dictionary passed to the host. For internal use. Prefer using class attributes instead. |
app_name | ClassVar[Optional[str]] | None | Custom name for the application. Defaults to class name. |
app_auth | ClassVar[Optional[AuthModeLiteral]] | None | Authentication mode. Options: ‘private’ (API key required), ‘public’ (no auth), ‘shared’ (shareable link). |
app_files | ClassVar[list[str]] | [] | List of files/directories to include in deployment. Example: ["./models", "./config.yaml"] |
app_files_ignore | ClassVar[list[str]] | ['\\.pyc$', '__pycache__/', '\\.git/', '\\.DS_Store$'] | Regex patterns to exclude from deployment. Default excludes .pyc, __pycache__, .git, .DS_Store. |
app_files_context_dir | ClassVar[Optional[str]] | None | Base directory for resolving app_files paths. Defaults to the directory containing the app file. |
request_timeout | ClassVar[Optional[int]] | None | Maximum seconds for a single request. None for default. |
startup_timeout | ClassVar[Optional[int]] | None | Maximum seconds for app startup/setup. None for default. |
min_concurrency | ClassVar[Optional[int]] | None | Minimum warm instances to keep running. Set to 1+ to avoid cold starts. Default is 0 (scale to zero). |
max_concurrency | ClassVar[Optional[int]] | None | Maximum instances to scale up to. |
concurrency_buffer | ClassVar[Optional[int]] | None | Additional instances to keep warm above current load. |
concurrency_buffer_perc | ClassVar[Optional[int]] | None | Percentage buffer of instances above current load. |
scaling_delay | ClassVar[Optional[int]] | None | Seconds to wait for a request to be picked up by a runner before triggering a scale up. Useful for apps with slow startup times. |
max_multiplexing | ClassVar[Optional[int]] | None | Maximum concurrent requests per instance. |
kind | ClassVar[Optional[str]] | None | Deployment kind. For internal use. |
image | ClassVar[Optional[ContainerImage]] | None | Custom container image for the application. Use ContainerImage to specify a Dockerfile. |
local_file_path | ClassVar[Optional[str]] | None | - |
skip_retry_conditions | ClassVar[Optional[list[RetryConditionLiteral]]] | None | - |
isolate_channel | async_grpc.Channel | None | None | - |
Properties
Properties
| Name | Type | Description | |
|---|---|---|---|
current_request | `fal.app.RequestContext | None` | - |
Methods
Methods
collect_routes
dict[RouteSignature, Callable[Ellipsis, Any]]get_endpoints
list[str]get_health_check_config
Optional[ApplicationHealthCheckConfig]health
lifespan
| Parameter | Type | Default | Description |
|---|---|---|---|
app | FastAPI | - | - |
provide_hints
list[str]setup
teardown
HealthCheck
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
start_period_seconds | Optional[int] | None | Minimum time the runner has been running before considering the runner unhealthy when health check fails. To prevent the health check from failing too early, this will be replaced by startup_timeout of the application if it’s less than it. Defaults to 30. |
timeout_seconds | Optional[int] | None | Timeout in seconds for the health check request. Defaults to 5 seconds. |
failure_threshold | Optional[int] | None | Number of consecutive failures before considering the runner as unhealthy. Defaults to 3. |
call_regularly | Optional[bool] | None | Perform health check every 15s. If false, only do it when the x-fal-runner-health-check header is present. Defaults to True. |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
start_period_seconds | Optional[int] | None | - |
timeout_seconds | Optional[int] | None | - |
failure_threshold | Optional[int] | None | - |
call_regularly | Optional[bool] | None | - |
FalServerlessKeyCredentials
Inherits from: Credentials
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
key_id | str | - | - |
key_secret | str | - | - |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
key_id | str | - | - |
key_secret | str | - | - |
ContainerImage
Constructor Parameters
Constructor Parameters
| Name | Type | Default | Description |
|---|---|---|---|
dockerfile_str | str | - | - |
build_args | dict[str, str] | \<factory\> | - |
registries | dict[str, dict[str, str]] | \<factory\> | - |
builder | Optional[Literal[depot, service, worker]] | None | - |
compression | str | 'gzip' | - |
force_compression | bool | False | - |
secrets | dict[str, str] | \<factory\> | - |
context_dir | PathLike | $PWD | - |
dockerignore | Optional[list[str]] | None | - |
dockerignore_path | Optional[PathLike] | None | - |
Class Variables
Class Variables
| Name | Type | Default | Description |
|---|---|---|---|
dockerfile_str | str | - | - |
build_args | dict[str, str] | - | - |
registries | dict[str, dict[str, str]] | - | - |
builder | Optional[Literal[depot, service, worker]] | None | - |
compression | str | 'gzip' | - |
force_compression | bool | False | - |
secrets | dict[str, str] | - | - |
context_dir | PathLike | $PWD | - |
dockerignore | Optional[list[str]] | None | - |
dockerignore_path | Optional[PathLike] | None | - |
Methods
Methods
add_dockerignore
| Parameter | Type | Default | Description |
|---|---|---|---|
patterns | Optional[list[str]] | None | List of gitignore-style patterns |
path | Optional[PathLike] | None | Path to a .dockerignore file |
NoneTypeRaises:ValueError: If both patterns and path are provided, or neither
from_dockerfile
| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | - | - |
kwargs | - | - | - |
ContainerImagefrom_dockerfile_str
| Parameter | Type | Default | Description |
|---|---|---|---|
text | str | - | - |
kwargs | - | - | - |
ContainerImageget_copy_add_sources
list[str]to_dict
dictFunctions
function
| Parameter | Type | Default | Description |
|---|---|---|---|
kind | str | 'virtualenv' | - |
host | fal.api.api.Host | None | None | - |
local_python_modules | list[str] | None | None | - |
config | Any | - | - |
cached
| Parameter | Type | Default | Description |
|---|---|---|---|
func | Callable[ArgsT, ReturnT] | - | - |
Callable[ArgsT, ReturnT]
endpoint
| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | - | - |
is_websocket | bool | False | - |
health_check | fal.sdk.HealthCheck | None | None | - |
Callable[EndpointT, EndpointT]
realtime
| Parameter | Type | Default | Description |
|---|---|---|---|
path | str | - | - |
buffering | int | None | None | - |
session_timeout | float | None | None | - |
input_modal | Any | None | \<object object at 0x10060e030\> | - |
max_batch_size | int | 1 | - |
Callable[EndpointT, EndpointT]
sync_dir
| Parameter | Type | Default | Description |
|---|---|---|---|
local_dir | str | pathlib.Path | - | - |
remote_dir | str | - | - |
force_upload | - | False | - |
str