Skip to main content

AppWrapper

A Python library that wraps Superb AI app functions. Used as a decorator, it automatically handles the full lifecycle of app tasks: downloading input files, executing the function, validating results, uploading outputs, and reporting status.

Installation

pip install AppWrapper

Quick Start

Normal Mode (Production)

Communicates with the TOAD backend service. Required environment variables are automatically injected.

from app_wrapper import AppWrapper

@AppWrapper()
def my_app():
    # Your app logic here
    return {"type": "link", "url": "https://example.com/result"}

Local Mode

Test locally using direct AWS credentials without TOAD communication.

from app_wrapper import AppWrapper

@AppWrapper(
    LOCAL_MODE=True,
    AWS_ACCESS_KEY_ID="your-access-key",
    AWS_SECRET_ACCESS_KEY="your-secret-key",
    AWS_DEFAULT_REGION="ap-northeast-2",
)
def my_app():
    return {"type": "link", "url": "https://example.com/result"}

Result Format

App functions must return one of the following two types.

Link Type

Returns an external URL as the result.

{"type": "link", "url": "https://example.com/result"}

Download Type

Uploads a local file to S3 and delivers it as the result.

{"type": "download", "file_path": "/path/to/output/file.json"}

S3 File Download

Download additional S3 files within your app function.

from app_wrapper import AppWrapper

AppWrapper.download_from_s3(
    bucket="my-bucket",
    key="path/to/file.csv",
    download_path="/tmp/file.csv",
)

Environment Variables

Environment variables required in normal mode. These are automatically injected in production.

Variable Description
TOAD_HOST TOAD backend service host URL
TENANT_ID Tenant ID
TASK_ID Task ID
MAIN_APP_ID Main app ID
POD_FILE_PATH Input file download path
APP_INPUT_FILES List of input file S3 paths (Python list format string)

In local mode, pass AWS credentials directly to the AppWrapper constructor.

Parameter Description Default
AWS_ACCESS_KEY_ID AWS Access Key ""
AWS_SECRET_ACCESS_KEY AWS Secret Key ""
AWS_DEFAULT_REGION AWS Region ap-northeast-2

Architecture

app_wrapper/
├── __init__.py          # Public exports
├── app_wrapper.py       # AppWrapper - decorator & orchestrator
├── s3_client.py         # S3Client - S3 download/upload operations
├── status_manager.py    # StatusManager - task status & log reporting
├── result_schema.py     # Pydantic models for result validation
└── task_status.py       # Status enum (Complete, Processing, Failed, ...)

Dependencies

  • requests>=2.0.0
  • boto3>=1.13.4
  • pydantic>=2.0.0

Release files for AppWrapper 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for AppWrapper 0.3.0
File Size Uploaded
appwrapper-0.3.0.tar.gz 5.9 kB Details

Release files / appwrapper-0.3.0.tar.gz

Download URL appwrapper-0.3.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ba1e14209852c62f6b5dab8926fd5fa32d425dcd0ca3b25f12479fc31693f1f4
BLAKE2b-256 checksum
How to use checksums
986f9e4505a787b668a4605a407989a8bec7f96aa06ae335d896f664a9de2a63
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.18

1 release file

0.2.17

1 release file

0.2.16

1 release file

0.2.15

1 release file

0.2.14

1 release file

0.2.13

1 release file

0.2.12

1 release file

0.2.11

1 release file

0.2.10

1 release file

0.2.9

1 release file

0.2.8

1 release file

0.2.7

1 release file

0.2.6

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page