Skip to content

Commit 7779d86

Browse files
committed
feat: add pydantic ai integration
1 parent b6f58f0 commit 7779d86

59 files changed

Lines changed: 7567 additions & 5 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/lint-packages.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,69 @@ jobs:
220220
working-directory: packages/uipath-google-adk
221221
run: uv run ruff format --check .
222222

223+
lint-pydantic-ai:
224+
name: Lint uipath-pydantic-ai
225+
needs: detect-changed-packages
226+
runs-on: ubuntu-latest
227+
steps:
228+
- name: Check if package changed
229+
id: check
230+
run: |
231+
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'test-core-dev-version') }}" == "true" ]]; then
232+
echo "skip=true" >> $GITHUB_OUTPUT
233+
echo "reason=custom-version-testing" >> $GITHUB_OUTPUT
234+
elif echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath-pydantic-ai")' > /dev/null; then
235+
echo "skip=false" >> $GITHUB_OUTPUT
236+
else
237+
echo "skip=true" >> $GITHUB_OUTPUT
238+
echo "reason=no-changes" >> $GITHUB_OUTPUT
239+
fi
240+
241+
- name: Skip
242+
if: steps.check.outputs.skip == 'true'
243+
run: |
244+
if [[ "${{ steps.check.outputs.reason }}" == "custom-version-testing" ]]; then
245+
echo "Skipping - custom version testing enabled"
246+
else
247+
echo "Skipping - no changes to uipath-pydantic-ai"
248+
fi
249+
250+
- name: Checkout
251+
if: steps.check.outputs.skip != 'true'
252+
uses: actions/checkout@v4
253+
254+
- name: Setup uv
255+
if: steps.check.outputs.skip != 'true'
256+
uses: astral-sh/setup-uv@v5
257+
with:
258+
enable-cache: true
259+
260+
- name: Setup Python
261+
if: steps.check.outputs.skip != 'true'
262+
uses: actions/setup-python@v5
263+
with:
264+
python-version-file: "packages/uipath-pydantic-ai/.python-version"
265+
266+
- name: Install dependencies
267+
if: steps.check.outputs.skip != 'true'
268+
working-directory: packages/uipath-pydantic-ai
269+
run: uv sync --all-extras
270+
271+
- name: Check static types
272+
if: steps.check.outputs.skip != 'true'
273+
working-directory: packages/uipath-pydantic-ai
274+
run: uv run mypy --config-file pyproject.toml .
275+
276+
- name: Check linting
277+
if: steps.check.outputs.skip != 'true'
278+
working-directory: packages/uipath-pydantic-ai
279+
run: uv run ruff check .
280+
281+
- name: Check formatting
282+
if: steps.check.outputs.skip != 'true'
283+
working-directory: packages/uipath-pydantic-ai
284+
run: uv run ruff format --check .
285+
223286
lint-agent-framework:
224287
name: Lint uipath-agent-framework
225288
needs: detect-changed-packages

.github/workflows/publish-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,4 @@ jobs:
212212
- name: Publish
213213
run: uv publish --index testpypi
214214
env:
215-
UV_PUBLISH_TOKEN: ${{ matrix.package == 'uipath-openai-agents' && secrets.TEST_PYPI_TOKEN_OPENAI_AGENTS || matrix.package == 'uipath-google-adk' && secrets.TEST_PYPI_TOKEN_GOOGLE_ADK || matrix.package == 'uipath-agent-framework' && secrets.TEST_PYPI_TOKEN_AGENT_FRAMEWORK || secrets.TEST_PYPI_TOKEN }}
215+
UV_PUBLISH_TOKEN: ${{ matrix.package == 'uipath-openai-agents' && secrets.TEST_PYPI_TOKEN_OPENAI_AGENTS || matrix.package == 'uipath-google-adk' && secrets.TEST_PYPI_TOKEN_GOOGLE_ADK || matrix.package == 'uipath-agent-framework' && secrets.TEST_PYPI_TOKEN_AGENT_FRAMEWORK || matrix.package == 'uipath-pydantic-ai' && secrets.TEST_PYPI_TOKEN_PYDANTIC_AI || secrets.TEST_PYPI_TOKEN }}

.github/workflows/test-packages.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,55 @@ jobs:
179179
working-directory: packages/uipath-google-adk
180180
run: uv run pytest
181181

182+
test-pydantic-ai:
183+
name: Test (uipath-pydantic-ai, ${{ matrix.python-version }}, ${{ matrix.os }})
184+
needs: detect-changed-packages
185+
runs-on: ${{ matrix.os }}
186+
strategy:
187+
fail-fast: false
188+
matrix:
189+
python-version: ["3.11", "3.12", "3.13"]
190+
os: [ubuntu-latest, windows-latest]
191+
steps:
192+
- name: Check if package changed
193+
id: check
194+
shell: bash
195+
run: |
196+
if echo '${{ needs.detect-changed-packages.outputs.packages }}' | jq -e 'index("uipath-pydantic-ai")' > /dev/null; then
197+
echo "skip=false" >> $GITHUB_OUTPUT
198+
else
199+
echo "skip=true" >> $GITHUB_OUTPUT
200+
fi
201+
202+
- name: Skip
203+
if: steps.check.outputs.skip == 'true'
204+
shell: bash
205+
run: echo "Skipping - no changes to uipath-pydantic-ai"
206+
207+
- name: Checkout
208+
if: steps.check.outputs.skip != 'true'
209+
uses: actions/checkout@v4
210+
211+
- name: Setup uv
212+
if: steps.check.outputs.skip != 'true'
213+
uses: astral-sh/setup-uv@v5
214+
215+
- name: Setup Python
216+
if: steps.check.outputs.skip != 'true'
217+
uses: actions/setup-python@v5
218+
with:
219+
python-version: ${{ matrix.python-version }}
220+
221+
- name: Install dependencies
222+
if: steps.check.outputs.skip != 'true'
223+
working-directory: packages/uipath-pydantic-ai
224+
run: uv sync --all-extras --python ${{ matrix.python-version }}
225+
226+
- name: Run tests
227+
if: steps.check.outputs.skip != 'true'
228+
working-directory: packages/uipath-pydantic-ai
229+
run: uv run pytest
230+
182231
test-agent-framework:
183232
name: Test (uipath-agent-framework, ${{ matrix.python-version }}, ${{ matrix.os }})
184233
needs: detect-changed-packages

packages/uipath-agent-framework/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ To properly use the CLI for packaging and publishing, your project should includ
116116

117117
### Developer Tools
118118

119-
Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive terminal application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts.
119+
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.
120120

121121
### Setting Up a Development Environment
122122

packages/uipath-google-adk/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ To properly use the CLI for packaging and publishing, your project should includ
110110

111111
### Developer Tools
112112

113-
Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive terminal application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts.
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.
114114

115115
### Setting Up a Development Environment
116116

packages/uipath-llamaindex/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ To properly use the CLI for packaging and publishing, your project should includ
110110

111111
### Developer Tools
112112

113-
Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive terminal application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts.
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.
114114

115115
### Setting Up a Development Environment
116116

packages/uipath-openai-agents/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ To properly use the CLI for packaging and publishing, your project should includ
110110

111111
### Developer Tools
112112

113-
Check out [uipath-dev](https://github.com/uipath/uipath-dev-python) - an interactive terminal application for building, testing, and debugging UiPath Python runtimes, agents, and automation scripts.
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.
114114

115115
### Setting Up a Development Environment
116116

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.11
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# UiPath PydanticAI Python SDK
2+
3+
[![PyPI - Version](https://img.shields.io/pypi/v/uipath-pydantic-ai)](https://pypi.org/project/uipath-pydantic-ai/)
4+
[![PyPI downloads](https://img.shields.io/pypi/dm/uipath-pydantic-ai.svg)](https://pypi.org/project/uipath-pydantic-ai/)
5+
[![Python versions](https://img.shields.io/pypi/pyversions/uipath-pydantic-ai.svg)](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.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
[project]
2+
name = "uipath-pydantic-ai"
3+
version = "0.0.1"
4+
description = "Python SDK that enables developers to build and deploy PydanticAI agents to the UiPath Cloud Platform"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = [
8+
"pydantic-ai>=1.63.0, <2.0.0",
9+
"openinference-instrumentation-pydantic-ai>=0.1.12",
10+
"uipath>=2.10.2, <2.11.0",
11+
"uipath-runtime>=0.9.2, <0.10.0",
12+
]
13+
classifiers = [
14+
"Intended Audience :: Developers",
15+
"Topic :: Software Development :: Build Tools",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
"Programming Language :: Python :: 3.13",
19+
]
20+
maintainers = [
21+
{ name = "Cristian Pufu", email = "cristian.pufu@uipath.com" }
22+
]
23+
24+
[project.entry-points."uipath.middlewares"]
25+
register = "uipath_pydantic_ai.middlewares:register_middleware"
26+
27+
[project.entry-points."uipath.runtime.factories"]
28+
pydantic-ai = "uipath_pydantic_ai.runtime:register_runtime_factory"
29+
30+
[project.urls]
31+
Homepage = "https://uipath.com"
32+
Repository = "https://github.com/UiPath/uipath-integrations-python"
33+
34+
[build-system]
35+
requires = ["hatchling"]
36+
build-backend = "hatchling.build"
37+
38+
[dependency-groups]
39+
dev = [
40+
"mypy>=1.14.1",
41+
"ruff>=0.9.4",
42+
"pytest>=7.4.0",
43+
"pytest-cov>=4.1.0",
44+
"pytest-mock>=3.11.1",
45+
"pre-commit>=4.1.0",
46+
"pytest-asyncio>=1.0.0",
47+
]
48+
49+
[tool.ruff]
50+
line-length = 88
51+
indent-width = 4
52+
53+
[tool.ruff.lint]
54+
select = ["E", "F", "B", "I"]
55+
56+
[tool.ruff.lint.per-file-ignores]
57+
"*" = ["E501"]
58+
59+
[tool.ruff.format]
60+
quote-style = "double"
61+
indent-style = "space"
62+
skip-magic-trailing-comma = false
63+
line-ending = "auto"
64+
65+
[tool.mypy]
66+
plugins = [
67+
"pydantic.mypy"
68+
]
69+
exclude = [
70+
"samples/.*",
71+
"testcases/.*"
72+
]
73+
follow_imports = "silent"
74+
warn_redundant_casts = true
75+
warn_unused_ignores = false
76+
disallow_any_generics = true
77+
check_untyped_defs = true
78+
no_implicit_reexport = true
79+
disallow_untyped_defs = false
80+
81+
[[tool.mypy.overrides]]
82+
module = "pydantic_ai"
83+
ignore_missing_imports = true
84+
ignore_errors = true
85+
86+
[tool.pytest.ini_options]
87+
testpaths = ["tests"]
88+
python_files = "test_*.py"
89+
addopts = "-ra -q"
90+
asyncio_default_fixture_loop_scope = "function"
91+
asyncio_mode = "auto"
92+
93+
[[tool.uv.index]]
94+
name = "testpypi"
95+
url = "https://test.pypi.org/simple/"
96+
publish-url = "https://test.pypi.org/legacy/"
97+
explicit = true

0 commit comments

Comments
 (0)