Skip to main content

Client SDK for App World — RL & Eval environments for Android apps

Project description

App World SDK

Lightweight Python client for the App World platform — RL training and evaluation on real Android apps, with a standard Gymnasium interface.

Installation

pip install appworld-sdk

Requirements: Python >= 3.11

Quick Start

from appworld_sdk import AppWorldClient

client = AppWorldClient(api_key="YOUR_API_KEY", base_url="https://api.appworld.dev")

# Browse available tasks
tasks = client.list_tasks()

# Allocate device resources
env_info = client.create_environment(task_ids=["FennoteCreateNote"])
env_id = env_info["id"]

# Get a Gymnasium-compatible environment
env = client.make_env(env_id=env_id, env_type="eval")

# Run a task
obs, info = env.reset(task_name="FennoteCreateNote")
done = False
while not done:
    action = {"action_type": 0, "x": 0.5, "y": 0.5, "text": "", "direction": 0}
    obs, reward, terminated, truncated, info = env.step(action)
    done = terminated or truncated

env.close()

Environment Types

Type Class Actions Use Case
"rl" RemoteAppWorldEnv 5 discrete (tap, swipe, etc.) RL training
"eval" RemoteAppWorldEvalEnv 7 (incl. text input) Agent evaluation

Client-Side Eval with Custom Agents

Implement the BaseAgent protocol to run evaluations where LLM calls stay on your side — your model API key never leaves the local process.

from appworld_sdk import AppWorldClient, BaseAgent

class MyAgent:
    def predict(self, *, screenshot, goal, **kwargs) -> dict:
        # Your model inference here
        return {"action_type": 0, "x": 0.5, "y": 0.5, "text": "", "direction": 0}

client = AppWorldClient(api_key="YOUR_API_KEY")
env_info = client.create_environment(task_ids=["FennoteCreateNote", "FennoteDeleteNote"])

result = client.run_local_eval(
    env_id=env_info["id"],
    tasks=["FennoteCreateNote", "FennoteDeleteNote"],
    agent=MyAgent(),
    max_steps=15,
)

print(f"Success rate: {result.success_rate:.0%}")
print(f"Avg steps: {result.avg_steps:.1f}")

Server-Side Eval

Let the platform handle LLM calls:

result = client.run_eval(
    env_id=env_info["id"],
    tasks=["FennoteCreateNote"],
    model_provider="anthropic",
    model_api_key="YOUR_MODEL_KEY",
    model_name="claude-sonnet-4-20250514",
)
print(f"Success rate: {result.success_rate}")

API Reference

AppWorldClient(api_key, base_url, timeout)

Method Description
list_apps(**filters) List available apps
list_tasks(**filters) List available tasks
get_task(task_id) Get task details
create_environment(task_ids, name) Allocate device resources
delete_environment(env_id) Release resources
make_env(env_id, env_type) Create Gymnasium env
run_eval(...) Server-side evaluation
run_local_eval(...) Client-side evaluation

Exceptions

Exception HTTP Meaning
AppWorldError Base exception
AppWorldAPIError any Server returned an error
EnvironmentNotReady 503 Device not available
SessionExpired 410 Session closed or timed out

License

Apache 2.0 — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

appworld_sdk-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

appworld_sdk-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file appworld_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: appworld_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for appworld_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 649eb71f63046b0c072899c0fc79efb78c695e6be5841ef3c72850bdbbb1e44e
MD5 ac1293accbff91c074f792891909e785
BLAKE2b-256 95130107930ff81a726ca9e105bac2632391deaff486961c0958c26e60259174

See more details on using hashes here.

File details

Details for the file appworld_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: appworld_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for appworld_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fc84e3187d4571e651afd0c6163db886f5950763ba97eae222f92f19ba290157
MD5 bb1f8b0be3dddea6ce3786c1d1340481
BLAKE2b-256 c8cd75cffeea7dfa93d9ae1780870d986167210933d3cd79000a9fb6b46ba751

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page