UiPath Python SDK

2.10.48 · active · verified Mon Apr 13

The UiPath Python SDK provides programmatic interaction with UiPath Cloud Platform services, including processes, assets, buckets, context grounding, data services, and jobs. It also features a CLI for creation, packaging, and deployment of automations to the UiPath Cloud Platform. The library is actively developed, with minor releases (X.Y.0) potentially introducing breaking changes and patch releases (X.Y.Z) for bug fixes and new features, usually on a monthly or bi-monthly cadence.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize the UiPath SDK and interact with basic services like listing processes. It requires `UIPATH_URL` and `UIPATH_ACCESS_TOKEN` to be set as environment variables. The SDK provides access to services like `sdk.processes`, `sdk.assets`, `sdk.buckets`, `sdk.connections`, `sdk.context_grounding`, `sdk.jobs`, `sdk.queues`, `sdk.tasks`, and `sdk.api_client`.

import os
from uipath.platform import UiPath

# Configure environment variables (replace with your actual values or .env file)
UIPATH_URL = os.environ.get('UIPATH_URL', 'https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME')
UIPATH_ACCESS_TOKEN = os.environ.get('UIPATH_ACCESS_TOKEN', 'YOUR_TOKEN_HERE')

# Ensure environment variables are set for authentication
if not UIPATH_URL or not UIPATH_ACCESS_TOKEN:
    print("Please set UIPATH_URL and UIPATH_ACCESS_TOKEN environment variables.")
    exit(1)

os.environ['UIPATH_URL'] = UIPATH_URL
os.environ['UIPATH_ACCESS_TOKEN'] = UIPATH_ACCESS_TOKEN

try:
    # Initialize the SDK
    sdk = UiPath()
    print(f"Successfully initialized UiPath SDK for URL: {UIPATH_URL}")

    # Example: List available processes (requires appropriate permissions)
    # Note: Error handling for API calls should be implemented in production code
    processes = sdk.processes.list()
    print(f"Found {len(processes)} processes:")
    for p in processes:
        print(f"  - {p.name} (Key: {p.key})")

    # Example: Invoke a process (uncomment and modify for actual use)
    # job = sdk.processes.invoke(
    #     name="MyProcess",
    #     input_arguments={"param1": "value1", "param2": 42}
    # )
    # print(f"Process invoked, Job ID: {job.id}")

except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →