|
| 1 | +# UiPath PydanticAI Python SDK |
| 2 | + |
| 3 | +[](https://pypi.org/project/uipath-pydantic-ai/) |
| 4 | +[](https://pypi.org/project/uipath-pydantic-ai/) |
| 5 | +[](https://pypi.org/project/uipath-pydantic-ai/) |
| 6 | + |
| 7 | +A Python SDK that enables developers to build and deploy PydanticAI agents to the UiPath Cloud Platform. It provides programmatic interaction with UiPath Cloud Platform services. |
| 8 | + |
| 9 | +This package is an extension to the [UiPath Python SDK](https://github.com/UiPath/uipath-python) and implements the [UiPath Runtime Protocol](https://github.com/UiPath/uipath-runtime-python). |
| 10 | + |
| 11 | +Check out these [sample projects](https://github.com/UiPath/uipath-integrations-python/tree/main/packages/uipath-pydantic-ai/samples) to see the SDK in action. |
| 12 | + |
| 13 | +## Requirements |
| 14 | + |
| 15 | +- Python 3.11 or higher |
| 16 | +- UiPath Automation Cloud account |
| 17 | + |
| 18 | +## Installation |
| 19 | + |
| 20 | +```bash |
| 21 | +pip install uipath-pydantic-ai |
| 22 | +``` |
| 23 | + |
| 24 | +using `uv`: |
| 25 | + |
| 26 | +```bash |
| 27 | +uv add uipath-pydantic-ai |
| 28 | +``` |
| 29 | + |
| 30 | +## Configuration |
| 31 | + |
| 32 | +### Environment Variables |
| 33 | + |
| 34 | +Create a `.env` file in your project root with the following variables: |
| 35 | + |
| 36 | +``` |
| 37 | +UIPATH_URL=https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME |
| 38 | +UIPATH_ACCESS_TOKEN=YOUR_TOKEN_HERE |
| 39 | +``` |
| 40 | + |
| 41 | +## Command Line Interface (CLI) |
| 42 | + |
| 43 | +The SDK provides a command-line interface for creating, packaging, and deploying PydanticAI Agents: |
| 44 | + |
| 45 | +### Authentication |
| 46 | + |
| 47 | +```bash |
| 48 | +uipath auth |
| 49 | +``` |
| 50 | + |
| 51 | +This command opens a browser for authentication and creates/updates your `.env` file with the proper credentials. |
| 52 | + |
| 53 | +### Initialize a Project |
| 54 | + |
| 55 | +```bash |
| 56 | +uipath init |
| 57 | +``` |
| 58 | + |
| 59 | +Running `uipath init` will process the agent definitions in the `pydantic_ai.json` file and create the corresponding `entry-points.json` file needed for deployment. |
| 60 | + |
| 61 | +For more details on the configuration format, see the [UiPath configuration specifications](https://github.com/UiPath/uipath-python/blob/main/specs/README.md). |
| 62 | + |
| 63 | +### Debug a Project |
| 64 | + |
| 65 | +```bash |
| 66 | +uipath run AGENT [INPUT] |
| 67 | +``` |
| 68 | + |
| 69 | +Executes the agent with the provided JSON input arguments. |
| 70 | + |
| 71 | +### Package a Project |
| 72 | + |
| 73 | +```bash |
| 74 | +uipath pack |
| 75 | +``` |
| 76 | + |
| 77 | +Packages your project into a `.nupkg` file that can be deployed to UiPath. |
| 78 | + |
| 79 | +**Note:** Your `pyproject.toml` must include: |
| 80 | + |
| 81 | +- A description field (avoid characters: &, <, >, ", ', ;) |
| 82 | +- Author information |
| 83 | + |
| 84 | +Example: |
| 85 | + |
| 86 | +```toml |
| 87 | +description = "Your package description" |
| 88 | +authors = [{name = "Your Name", email = "your.email@example.com"}] |
| 89 | +``` |
| 90 | + |
| 91 | +### Publish a Package |
| 92 | + |
| 93 | +```bash |
| 94 | +uipath publish |
| 95 | +``` |
| 96 | + |
| 97 | +Publishes the most recently created package to your UiPath Orchestrator. |
| 98 | + |
| 99 | +## Project Structure |
| 100 | + |
| 101 | +To properly use the CLI for packaging and publishing, your project should include: |
| 102 | + |
| 103 | +- A `pyproject.toml` file with project metadata |
| 104 | +- A `pydantic_ai.json` file with your agent definitions (e.g., `"agents": {"agent": "main.py:agent"}`) |
| 105 | +- A `entry-points.json` file (generated by `uipath init`) |
| 106 | +- A `bindings.json` file (generated by `uipath init`) to configure resource overrides |
| 107 | +- Any Python files needed for your automation |
| 108 | + |
| 109 | +## Development |
| 110 | + |
| 111 | +### Developer Tools |
| 112 | + |
| 113 | +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. |
| 114 | + |
| 115 | +### Setting Up a Development Environment |
| 116 | + |
| 117 | +Please read our [contribution guidelines](https://github.com/UiPath/uipath-integrations-python/blob/main/packages/uipath-pydantic-ai/CONTRIBUTING.md) before submitting a pull request. |
| 118 | + |
| 119 | +### Special Thanks |
| 120 | + |
| 121 | +A huge thank-you to the open-source community and the maintainers of the libraries that make this project possible: |
| 122 | + |
| 123 | +- [PydanticAI](https://github.com/pydantic/pydantic-ai) for providing a powerful, type-safe framework for building AI agents. |
| 124 | +- [OpenInference](https://github.com/Arize-ai/openinference) for observability and instrumentation support. |
| 125 | +- [Pydantic](https://github.com/pydantic/pydantic) for reliable, typed configuration and validation. |
0 commit comments