{"id":6624,"library":"fal","title":"fal: Serverless Python Framework","description":"fal is an easy-to-use Serverless Python Framework that enables developers to build, test, and deploy serverless applications and machine learning models on GPU-accelerated infrastructure. It offers a Python SDK for defining applications and a CLI for deployment and management. The library is actively maintained, with frequent releases, and is currently at version 1.72.1.","status":"active","version":"1.72.1","language":"python","source_language":"en","source_url":"https://github.com/fal-ai/fal","tags":["serverless","mlops","ai","gpu","cloud","framework"],"install":[{"cmd":"pip install fal","lang":"bash","label":"Install fal for app development and deployment"},{"cmd":"pip install fal-client","lang":"bash","label":"Install fal-client for consuming models and endpoints"}],"dependencies":[{"reason":"Used for calling fal Model APIs or your own deployed fal apps from Python code.","package":"fal-client","optional":true}],"imports":[{"note":"Used for defining serverless applications with fal.App and decorators.","symbol":"fal","correct":"import fal"},{"note":"Used for interacting with deployed fal models or applications as a client.","symbol":"fal_client","correct":"import fal_client"},{"note":"Used for programmatic management of fal apps, runners, keys, and secrets without the CLI or async/await. Introduced around October 2025.","symbol":"SyncServerlessClient","correct":"from fal.api import SyncServerlessClient"}],"quickstart":{"code":"import fal\nimport os\n\n# Ensure FAL_KEY is set as an environment variable (e.g., export FAL_KEY=\"YOUR_API_KEY\")\n# or authenticate via 'fal auth login' CLI command.\nfal_key = os.environ.get('FAL_KEY', '')\nif not fal_key:\n    print(\"Warning: FAL_KEY environment variable not set. Please authenticate via 'fal auth login' or set FAL_KEY.\")\n\nclass HelloApp(fal.App):\n    @fal.endpoint(\"/\")\n    def run(self) -> dict:\n        print(\"Processing Hello World request...\")\n        return {\"message\": \"Hello, World!\"}\n\n# To run locally for testing (requires fal CLI and authentication):\n# fal run your_app_file.py::HelloApp\n\n# To deploy to a persistent endpoint:\n# fal deploy your_app_file.py::HelloApp","lang":"python","description":"This quickstart demonstrates defining a simple 'Hello World' serverless application using `fal.App` and the `@fal.endpoint` decorator. It highlights the basic structure for a deployable application. Local testing and deployment are typically handled via the `fal` CLI after installing the `fal` package and authenticating."},"warnings":[{"fix":"Use `pip install fal` for app development/deployment, `pip install fal-client` for calling APIs. Import `fal` for app definition and `fal_client` for client interactions.","message":"The `fal` package (for building/deploying apps) and `fal-client` package (for calling models/endpoints) are distinct. Ensure you install and import the correct one for your use case.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Run `fal auth login` in your terminal. For client SDK usage, ensure `export FAL_KEY=\"your-api-key-here\"` is set in your environment or provide `api_key` argument to client constructors.","message":"Authentication is crucial. For development and deployment, use `fal auth login` via the CLI. For programmatic client calls, the `fal-client` library typically expects the `FAL_KEY` environment variable to be set, or it can be passed explicitly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Implement a `teardown()` method in your `fal.App` class to handle graceful cleanup within the 5-second grace period.","message":"Starting with `fal>=1.61.0`, runners now receive a `SIGTERM` signal with a 5-second grace period before `SIGKILL` when terminated. This affects app cleanup during shutdown.","severity":"breaking","affected_versions":">=1.61.0"},{"fix":"Execute `fal run your_app.py::MyApp --auth private` to enforce private authentication during local testing.","message":"When running apps locally with `fal run`, the default authentication mode is `public`. If you require API key authentication during local development, explicitly use the `--auth private` flag.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update any integrations that consume runner state information to correctly handle the new `IDLE` state. Refer to the 'Understanding Runners' guide in the fal documentation.","message":"The runner state model was updated around October 2025 to include an `IDLE` state. If you are programmatically monitoring or tracking runner states, your integrations might need updates.","severity":"gotcha","affected_versions":"Versions released after Oct 2025 (approximately >=1.60.0)"}],"env_vars":null,"search_vec":"'1.72.1':62 'acceler':32 'activ':52 'ai':65 'applic':24,41 'build':19 'cli':44 'cloud':67 'current':59 'defin':40 'deploy':22,46 'develop':17 'easi':9 'easy-to-us':8 'enabl':16 'fal':1,5 'framework':4,14,68 'frequent':55 'gpu':31,66 'gpu-acceler':30 'infrastructur':33 'learn':27 'librari':50 'machin':26 'maintain':53 'manag':48 'mlop':64 'model':28 'offer':35 'python':3,13,37 'releas':56 'sdk':38 'serverless':2,12,23,63 'test':20 'use':11 'version':61","created_at":"2026-04-15T18:35:54.379887+00:00","updated_at":"2026-04-16T14:55:27.440867+00:00","problems":[{"fix":"Install the Fal CLI using pip: `pip install fal`. If already installed, ensure your system's PATH includes the directory where pip installs executables.","cause":"The Fal CLI (Command Line Interface) is not installed on your system or is not included in your system's PATH environment variable.","error":"fal: command not found"},{"fix":"Authenticate interactively using `fal auth login` in your terminal. Alternatively, set your API key as an environment variable: `export FAL_KEY=\"your-api-key-here\"` (replace with your actual API key from the Fal dashboard).","cause":"The Fal CLI or client SDK cannot authenticate with the Fal platform. This is typically due to a missing, incorrect, expired, or improperly scoped API key, or the user has not logged in via the CLI.","error":"\"Authentication is required to access this application.\" or \"invalid key credentials\""},{"fix":"Install the necessary Fal Python package using pip: `pip install fal` or `pip install fal-client` if you are only using the client SDK.","cause":"The `fal` Python package (or `fal-client` if that's the specific import) is not installed in your active Python environment.","error":"ModuleNotFoundError: No module named 'fal'"},{"fix":"Carefully review your `requirements.txt` file for typos, ensure all package versions are compatible and explicitly pinned (e.g., `package==1.0.0`), and verify that all specified packages are available on PyPI or the specified alternative index.","cause":"During deployment, Fal attempts to install the dependencies listed in your `requirements.txt` file, and one or more packages failed to install, often due to incorrect package names, incompatible versions, or missing build dependencies for certain packages.","error":"Command '['pip', 'install', '-r', 'requirements.txt']' returned non-zero exit status X."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.76.0","cli_name":"fal","cli_version":"1.73.1","type":"library","homepage":"https://fal.ai","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/fal/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","ai-ml","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-06-28","next_check":"2026-07-28","install_tag":null}}