Skip to main content

Pig Docs

Pig is an API to launch and automate Windows apps. Plug this SDK into your AI Agent apps to give them a computer!


Warning: This API and associated infrastructure are currently in alpha and will likely undergo changes.

Getting Started

Step 1: Install the Python SDK

pip install pig-python

Step 2: Start Piglet

The Piglet is a process that runs on your Windows machine to drive the automations.

Follow this guide to download it, and start it with the command:

# Start the Piglet server (exposes localhost:3000)
piglet

Step 3: Call It Locally

The SDK can be used from the same Windows machine to send automations to Piglet.

from pig import Client
client = Client()

# Select your local machine
machine = client.machines.local()

# Start a connection and send a workflow
with machine.connect() as conn:
    conn.key("super")                     # Press Windows key
    conn.type("hello world!")             # Type text

Step 4: Call It Over The Internet (Using Pig)

Your Piglet can be controlled over the internet by subscribing it as a machine in Pig's API.

Get your API key here

# Start Piglet pointing to Pig's control server
piglet --control-host piglet.pig.dev --pig-secret-key SK-YOUR_API_KEY

This will register your Piglet as a machine in Pig's API.

Now, from any computer, you can send automations to your connected Piglet.

Use the pig CLI to see your connected machines:

# List available machines
pig ls
ID                         state    Created
-------------------------  -------  ----------------
M-6HNGAXR-NT0B3VA-P33Q0R2  RUNNING  2025-02-10 23:31

And send an automation to it by specifying the machine ID.

from pig import Client
client = Client()

# Select your remote machine
machine = client.machines.get("M-6HNGAXR-NT0B3VA-P33Q0R2")

# Start a connection and send a workflow
with machine.connect() as conn:
    conn.key("super")                     # Press Windows key
    conn.type("hello world!")             # Type text

API Reference

Machine Management

# Get your local machine
machine = client.machines.local()

# Get a remote machine by ID
machine = client.machines.get("M-ABCD123")

Connection APIs

# All operations should use the context manager pattern
with machine.connect() as conn:
    # Keyboard
    conn.type("Hello World")              # Type text
    conn.key("super")                     # Press Windows key
    conn.key("ctrl+c ctrl+v")             # Key combinations
    
    # Mouse
    conn.mouse_move(x=100, y=100)         # Move cursor
    conn.left_click()                     # Click at current position
    conn.left_click(x=100, y=100)         # Move and click
    conn.right_click(x=100, y=100)        # Right click
    conn.double_click(x=100, y=100)       # Double click
    conn.left_click_drag(x=200, y=200)    # Click and drag
    
    # Screen
    image = conn.screenshot()             # Take screenshot
    x, y = conn.cursor_position()         # Get cursor position
    w, h = conn.dimensions()              # Get machine dimensions
    
    # Control
    conn.yield_control()                  # Give control to human
    conn.await_control()                  # Wait for control back

CLI Reference

# List all machines
pig ls

# Example output:
ID                         state    Created
-------------------------  -------  ----------------
M-6HNGAXR-NT0B3VA-P33Q0R2  RUNNING  2025-02-10 23:31

Download files

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

Source Distribution

pig_python-0.1.2.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

pig_python-0.1.2-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file pig_python-0.1.2.tar.gz.

File metadata

  • Download URL: pig_python-0.1.2.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pig_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 18e6d587b949ba6e2589e2eb3347045c8b5fc290ee7e7a8109acc3480109f1d6
MD5 3c9a705bf464186b23b626811a231ec4
BLAKE2b-256 41012fef5fb4916589c003f61bbeb3cad02537906f18d6c337c174af7b45d278

See more details on using hashes here.

File details

Details for the file pig_python-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pig_python-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for pig_python-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b4b78472130fc7e06f54989648a980960d175e8cbb1080d0af3c9b0d05312ba
MD5 a22411679a14e94436cb47563ab7432a
BLAKE2b-256 80c5962d4fbbb36322970a4b6aecc30b595f0f7641c66ad67f860e832d0d173c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

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