|
| 1 | +# UiPath Python SDK |
| 2 | + |
| 3 | +[](https://pypi.org/project/uipath/) |
| 4 | +[](https://img.shields.io/pypi/v/uipath) |
| 5 | +[](https://pypi.org/project/uipath/) |
| 6 | + |
| 7 | +A Python SDK that enables programmatic interaction with UiPath Cloud Platform services including processes, assets, buckets, context grounding, data services, jobs, and more. The package also features a CLI for creation, packaging, and deployment of automations to UiPath Cloud Platform. |
| 8 | + |
| 9 | +Use the [UiPath LangChain SDK](https://github.com/UiPath/uipath-langchain-python) to pack and publish LangGraph Agents. |
| 10 | + |
| 11 | +Check out other [UiPath Integrations](https://github.com/UiPath/uipath-integrations-python) to pack and publish agents built with LlamaIndex, OpenAI Agents, Google ADK, and more. |
| 12 | + |
| 13 | +This [quickstart guide](https://uipath.github.io/uipath-python/) walks you through deploying your first agent to UiPath Cloud Platform. |
| 14 | + |
| 15 | +## Table of Contents |
| 16 | + |
| 17 | +- [Installation](#installation) |
| 18 | +- [Configuration](#configuration) |
| 19 | + - [Environment Variables](#environment-variables) |
| 20 | +- [Basic Usage](#basic-usage) |
| 21 | +- [Available Services](#available-services) |
| 22 | +- [Examples](#examples) |
| 23 | + - [Buckets Service](#buckets-service) |
| 24 | + - [Context Grounding Service](#context-grounding-service) |
| 25 | +- [Command Line Interface (CLI)](#command-line-interface-cli) |
| 26 | + - [Authentication](#authentication) |
| 27 | + - [Initialize a Project](#initialize-a-project) |
| 28 | + - [Debug a Project](#debug-a-project) |
| 29 | + - [Package a Project](#package-a-project) |
| 30 | + - [Publish a Package](#publish-a-package) |
| 31 | +- [Project Structure](#project-structure) |
| 32 | +- [Development](#development) |
| 33 | + - [Setting Up a Development Environment](#setting-up-a-development-environment) |
| 34 | + |
| 35 | +## Installation |
| 36 | + |
| 37 | +```bash |
| 38 | +pip install uipath |
| 39 | +``` |
| 40 | + |
| 41 | +using `uv`: |
| 42 | + |
| 43 | +```bash |
| 44 | +uv add uipath |
| 45 | +``` |
| 46 | + |
| 47 | +## Configuration |
| 48 | + |
| 49 | +### Environment Variables |
| 50 | + |
| 51 | +Create a `.env` file in your project root with the following variables: |
| 52 | + |
| 53 | +``` |
| 54 | +UIPATH_URL=https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME |
| 55 | +UIPATH_ACCESS_TOKEN=YOUR_TOKEN_HERE |
| 56 | +``` |
| 57 | + |
| 58 | +## Basic Usage |
| 59 | + |
| 60 | +```python |
| 61 | +from uipath.platform import UiPath |
| 62 | +# Initialize the SDK |
| 63 | +sdk = UiPath() |
| 64 | +# Execute a process |
| 65 | +job = sdk.processes.invoke( |
| 66 | + name="MyProcess", |
| 67 | + input_arguments={"param1": "value1", "param2": 42} |
| 68 | +) |
| 69 | +# Work with assets |
| 70 | +asset = sdk.assets.retrieve(name="MyAsset") |
| 71 | +``` |
| 72 | + |
| 73 | +## Available Services |
| 74 | + |
| 75 | +The SDK provides access to various UiPath services: |
| 76 | + |
| 77 | +- `sdk.processes` - Manage and execute UiPath automation processes |
| 78 | + |
| 79 | +- `sdk.assets` - Work with assets (variables, credentials) stored in UiPath |
| 80 | + |
| 81 | +- `sdk.buckets` - Manage cloud storage containers for automation files |
| 82 | + |
| 83 | +- `sdk.connections` - Handle connections to external systems |
| 84 | + |
| 85 | +- `sdk.context_grounding` - Work with semantic contexts for AI-enabled automation |
| 86 | + |
| 87 | +- `sdk.jobs` - Monitor and manage automation jobs |
| 88 | + |
| 89 | +- `sdk.queues` - Work with transaction queues |
| 90 | + |
| 91 | +- `sdk.tasks` - Work with Action Center |
| 92 | + |
| 93 | +- `sdk.api_client` - Direct access to the API client for custom requests |
| 94 | + |
| 95 | +## Examples |
| 96 | + |
| 97 | +### Buckets Service |
| 98 | + |
| 99 | +```python |
| 100 | +# Download a file from a bucket |
| 101 | +sdk.buckets.download( |
| 102 | + bucket_key="my-bucket", |
| 103 | + blob_file_path="path/to/file.xlsx", |
| 104 | + destination_path="local/path/file.xlsx" |
| 105 | +) |
| 106 | +``` |
| 107 | + |
| 108 | +### Context Grounding Service |
| 109 | + |
| 110 | +```python |
| 111 | +# Search for contextual information |
| 112 | +results = sdk.context_grounding.search( |
| 113 | + name="my-knowledge-index", |
| 114 | + query="How do I process an invoice?", |
| 115 | + number_of_results=5 |
| 116 | +) |
| 117 | +``` |
| 118 | + |
| 119 | +## Command Line Interface (CLI) |
| 120 | + |
| 121 | +The SDK also provides a command-line interface for creating, packaging, and deploying automations: |
| 122 | + |
| 123 | +### Authentication |
| 124 | + |
| 125 | +```bash |
| 126 | +uipath auth |
| 127 | +``` |
| 128 | + |
| 129 | +This command opens a browser for authentication and creates/updates your `.env` file with the proper credentials. |
| 130 | + |
| 131 | +### Initialize a Project |
| 132 | + |
| 133 | +```bash |
| 134 | +uipath init |
| 135 | +``` |
| 136 | + |
| 137 | +The `uipath.json` file should include your entry points in the `functions` section: |
| 138 | +```json |
| 139 | +{ |
| 140 | + "functions": { |
| 141 | + "main": "main.py:main" |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +Running `uipath init` will process these function definitions and create the corresponding `entry-points.json` file needed for deployment. |
| 147 | + |
| 148 | +For more details on the configuration format, see the [UiPath configuration specifications](specs/README.md). |
| 149 | + |
| 150 | +### Debug a Project |
| 151 | + |
| 152 | +```bash |
| 153 | +uipath run ENTRYPOINT [INPUT] |
| 154 | +``` |
| 155 | + |
| 156 | +Executes a Python script with the provided JSON input arguments. |
| 157 | + |
| 158 | +### Package a Project |
| 159 | + |
| 160 | +```bash |
| 161 | +uipath pack |
| 162 | +``` |
| 163 | + |
| 164 | +Packages your project into a `.nupkg` file that can be deployed to UiPath. |
| 165 | + |
| 166 | +**Note:** Your `pyproject.toml` must include: |
| 167 | + |
| 168 | +- A description field (avoid characters: &, <, >, ", ', ;) |
| 169 | +- Author information |
| 170 | + |
| 171 | +Example: |
| 172 | + |
| 173 | +```toml |
| 174 | +description = "Your package description" |
| 175 | +authors = [{name = "Your Name", email = "your.email@example.com"}] |
| 176 | +``` |
| 177 | + |
| 178 | +### Publish a Package |
| 179 | + |
| 180 | +```bash |
| 181 | +uipath publish |
| 182 | +``` |
| 183 | + |
| 184 | +Publishes the most recently created package to your UiPath Orchestrator. |
| 185 | + |
| 186 | +## Project Structure |
| 187 | + |
| 188 | +To properly use the CLI for packaging and publishing, your project should include: |
| 189 | + |
| 190 | +- A `pyproject.toml` file with project metadata |
| 191 | +- A `uipath.json` file with your function definitions (e.g., `"functions": {"main": "main.py:main"}`) |
| 192 | +- A `entry-points.json` file (generated by `uipath init`) |
| 193 | +- A `bindings.json` file (generated by `uipath init`) to configure resource overrides |
| 194 | +- Any Python files needed for your automation |
| 195 | + |
| 196 | + |
| 197 | +## Development |
| 198 | + |
| 199 | +### Tools |
| 200 | + |
| 201 | +Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts. |
| 202 | + |
| 203 | +### Contributions |
| 204 | + |
| 205 | +Please read our [contribution guidelines](https://github.com/UiPath/uipath-integrations-python/blob/main/CONTRIBUTING.md) before submitting a pull request. |
| 206 | + |
0 commit comments