Skip to main content

PPIO Sandbox SDK - Python library for PPIO Agent Sandbox

Project description

PPIO Sandbox SDK for Python

Python SDK for PPIO Sandbox environments, providing code execution, desktop automation, and cloud computing capabilities, which is compatible with ppio.

Please read the documentation for more information.

Installation

pip install ppio-sandbox

Features

  • 🚀 Code Interpreter: Execute Python, JavaScript, and other languages in isolated environments
  • 🖥️ Desktop Automation: Control desktop applications and GUI interactions
  • ☁️ Cloud Computing: Scalable sandbox environments for various computing tasks
  • 📊 Data Visualization: Built-in charting and visualization capabilities
  • 🔧 File System Operations: Complete file system management and monitoring

Quick Start

Authentication

You can get the PPIO API key by refer to this documentation.

Core

The basic package provides a way to interact with the sandbox environment.

from ppio_sandbox.core import Sandbox
import os

# Using the official template `base` by default
sandbox = Sandbox.create(
    template="base",
    api_key=os.getenv("PPIO_API_KEY", "")
)

# File operations
sandbox.files.write('/tmp/test.txt', 'Hello, World!')
content = sandbox.files.read('/tmp/test.txt')

# Command execution
result = sandbox.commands.run('ls -la /tmp')
print(result.stdout)

sandbox.kill()

Code Interpreter

The Code Interpreter sandbox provides a Jupyter-like environment for executing code using the official code-interpreter-v1 template.

from ppio_sandbox.code_interpreter import Sandbox
import os

sandbox = Sandbox.create(
    api_key=os.getenv("PPIO_API_KEY", "")
)

# Execute Python code
result = sandbox.run_code('print("Hello, World!")')
print(result.logs)

sandbox.kill()

Desktop

The Desktop sandbox allows you to control desktop environments programmatically using the official desktop template.

from ppio_sandbox.desktop import Sandbox
import os

desktop = Sandbox.create(
    api_key=os.getenv("PPIO_API_KEY", "")
)

# Take a screenshot
screenshot = desktop.screenshot()

# Automate mouse and keyboard
desktop.left_click(100, 200)
desktop.press('Return')
desktop.write('Hello, World!')

desktop.kill()

Development

Install

poetry install --with dev --extras "all" 

Test

make test
make test-core
make test-code-interpreter
make test-desktop

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

ppio_sandbox-2.0.0a3.tar.gz (416.8 kB view details)

Uploaded Source

Built Distribution

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

ppio_sandbox-2.0.0a3-py3-none-any.whl (555.3 kB view details)

Uploaded Python 3

File details

Details for the file ppio_sandbox-2.0.0a3.tar.gz.

File metadata

  • Download URL: ppio_sandbox-2.0.0a3.tar.gz
  • Upload date:
  • Size: 416.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.13 Linux/6.17.0-1010-azure

File hashes

Hashes for ppio_sandbox-2.0.0a3.tar.gz
Algorithm Hash digest
SHA256 a79550c7391d24b04477e0a95322d1a28184a69f752ec7bc2b95e12df4ec30a5
MD5 0fd3620575b8959991246007152e7102
BLAKE2b-256 c0cce0ddebafb1e5754157e05024eac9d9ceb57dcf89550476f2eed8e35aaa1b

See more details on using hashes here.

File details

Details for the file ppio_sandbox-2.0.0a3-py3-none-any.whl.

File metadata

  • Download URL: ppio_sandbox-2.0.0a3-py3-none-any.whl
  • Upload date:
  • Size: 555.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.13 Linux/6.17.0-1010-azure

File hashes

Hashes for ppio_sandbox-2.0.0a3-py3-none-any.whl
Algorithm Hash digest
SHA256 29b000a60a04a5d2329af5f0fe696a25221305f7838ed2c3074517e0118c9ae8
MD5 3e3272c34055573bb03af80a2793442a
BLAKE2b-256 f07139fc5f16697cf750bc3e6a988dec9f34d6d26ca5f4e3212e7c01c5359b0b

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