Functions allow you to execute code remotely on Modal’s infrastructure.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/modal-labs/modal-client/llms.txt
Use this file to discover all available pages before exploring further.
Referencing functions
FromName
References a Function from a deployed App by its name.Context for the operation
The name of the App containing the Function
The name of the Function (tag in the App)
*Function- The Function instanceerror- NotFoundError if the Function doesn’t exist
Function methods
Remote
Executes the Function remotely and waits for the result.Context for the operation
Positional arguments to pass to the Function. Use
nil or []any{} for no arguments.Keyword arguments to pass to the Function. Use
nil or map[string]any{} for no keyword arguments.any- The Function’s return value (deserialized from CBOR)error- Error if the Function fails or cannot be called
Requires the deployed Function to use Modal Python SDK 1.2 or newer with CBOR serialization support.
Spawn
Starts a Function execution asynchronously and returns immediately with a FunctionCall handle.Context for the operation
Positional arguments
Keyword arguments
*FunctionCall- A handle to the spawned Function executionerror- Error if spawning fails
GetCurrentStats
Returns current statistics about the Function’s execution.Context for the operation
*FunctionStats- Current statisticsBacklog(int) - Number of pending inputsNumTotalRunners(int) - Total number of running containers
error- Error if the request fails
UpdateAutoscaler
Overrides the autoscaler settings for this Function.Context for the operation
error- Error if the update fails
GetWebURL
Returns the web URL if this Function is a web endpoint.string- The web URL, or empty string if not a web endpoint
Function type
The unique identifier for the Function