or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/modal@1.1.x
tile.json

tessl/pypi-modal

tessl install tessl/pypi-modal@1.1.0

Python client library for Modal, a serverless cloud computing platform that enables developers to run Python code in the cloud with on-demand access to compute resources.

Agent Success

Agent success rate when using this tile

85%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.6x

Baseline

Agent success rate without this tile

53%

task.mdevals/scenario-6/

Execution Context Logger

A utility that demonstrates the difference between local and remote execution in Modal by logging execution context information.

Capabilities

Context Detection

Write a program that uses Modal execution context functions to detect and log whether code is running in a local or remote environment. The program should run a simple function both locally and remotely, logging execution details.

  • When run locally using the local entrypoint, it prints "Running in local context" @test
  • When the Modal function executes remotely, it logs the function call ID and input ID @test
  • The local entrypoint invokes the remote function and displays its return value @test

Implementation

@generates

API

import modal

app = modal.App("context-logger")

@app.function()
def log_context(message: str) -> dict:
    """
    A Modal function that logs execution context information.

    Args:
        message: A message to include in the log

    Returns:
        A dictionary containing:
        - 'is_local': Boolean indicating if running locally
        - 'message': The input message
        - 'function_call_id': The function call ID (or None if local)
        - 'input_id': The input ID (or None if local)
    """
    pass

@app.local_entrypoint()
def main():
    """
    Local entrypoint that demonstrates the difference between
    local and remote execution contexts.
    """
    pass

Dependencies { .dependencies }

modal { .dependency }

Provides serverless cloud compute capabilities and execution context functions.