From 9a92123080d6ea328492aa229efb184542beb265 Mon Sep 17 00:00:00 2001 From: radu-mocanu Date: Mon, 11 May 2026 15:39:03 +0300 Subject: [PATCH] chore: slim uipath init output to a single AGENTS.md --- .github/workflows/build-package.yml | 24 +- .github/workflows/cd.yml | 1 + .github/workflows/ci.yml | 6 - .github/workflows/test-packages.yml | 115 +-- .gitignore | 4 + CLAUDE.md | 2 +- packages/uipath-core/pyproject.toml | 23 +- packages/uipath-platform/pyproject.toml | 23 +- packages/uipath/CLAUDE.md | 8 +- packages/uipath/justfile | 5 +- packages/uipath/pyproject.toml | 25 +- packages/uipath/scripts/update_agents_md.py | 671 ------------- packages/uipath/src/uipath/_cli/cli_init.py | 74 +- .../uipath/src/uipath/_resources/AGENTS.md | 24 +- .../uipath/src/uipath/_resources/CLAUDE.md | 2 +- .../src/uipath/_resources/CLI_REFERENCE.md | 948 ------------------ .../uipath/_resources/REQUIRED_STRUCTURE.md | 64 -- .../src/uipath/_resources/SDK_REFERENCE.md | 816 --------------- packages/uipath/src/uipath/_resources/eval.md | 287 ------ .../uipath/src/uipath/_resources/new-agent.md | 103 -- .../uipath/tests/cli/test_init_agents_md.py | 276 +++-- packages/uipath/uv.lock | 2 +- 22 files changed, 222 insertions(+), 3281 deletions(-) delete mode 100644 packages/uipath/scripts/update_agents_md.py delete mode 100644 packages/uipath/src/uipath/_resources/CLI_REFERENCE.md delete mode 100644 packages/uipath/src/uipath/_resources/REQUIRED_STRUCTURE.md delete mode 100644 packages/uipath/src/uipath/_resources/SDK_REFERENCE.md delete mode 100644 packages/uipath/src/uipath/_resources/eval.md delete mode 100644 packages/uipath/src/uipath/_resources/new-agent.md diff --git a/.github/workflows/build-package.yml b/.github/workflows/build-package.yml index 54cd05352..eb77829ca 100644 --- a/.github/workflows/build-package.yml +++ b/.github/workflows/build-package.yml @@ -15,6 +15,8 @@ on: secrets: APPLICATIONINSIGHTS_CONNECTION_STRING: required: false + REPO_ACCESS: + required: false permissions: contents: read @@ -44,9 +46,27 @@ jobs: - name: Install dependencies run: uv sync --all-extras - - name: Update AGENTS.md + - name: Clone plugin repos for llms-full.txt + if: inputs.package == 'uipath' + working-directory: . + run: | + git clone https://x-access-token:${{ secrets.REPO_ACCESS }}@github.com/UiPath/uipath-langchain-python plugins/uipath-langchain-python + git clone https://x-access-token:${{ secrets.REPO_ACCESS }}@github.com/UiPath/uipath-integrations-python plugins/uipath-integrations-python + git clone https://x-access-token:${{ secrets.REPO_ACCESS }}@github.com/UiPath/uipath-mcp-python plugins/uipath-mcp-python + + - name: Symlink plugin docs if: inputs.package == 'uipath' - run: uv run python scripts/update_agents_md.py + run: | + ln -s ../../../plugins/uipath-langchain-python/docs docs/langchain + ln -s ../../../plugins/uipath-integrations-python/packages/uipath-llamaindex/docs docs/llamaindex + ln -s ../../../plugins/uipath-integrations-python/packages/uipath-openai-agents/docs docs/openai-agents + ln -s ../../../plugins/uipath-mcp-python/docs docs/mcp + + - name: Build docs and embed llms-full.txt + if: inputs.package == 'uipath' + run: | + uv run mkdocs build --clean + cp site/llms-full.txt src/uipath/_resources/llms-full.txt - name: Replace connection string placeholder if: inputs.package == 'uipath' diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 82aa4ccb2..0e9449937 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -166,6 +166,7 @@ jobs: needs-relock: true secrets: APPLICATIONINSIGHTS_CONNECTION_STRING: ${{ secrets.APPLICATIONINSIGHTS_CONNECTION_STRING }} + REPO_ACCESS: ${{ secrets.REPO_ACCESS }} publish-uipath: name: Publish uipath diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8be2b6b53..5e05e9c73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,9 +4,6 @@ on: pull_request: branches: - main - push: - branches: - - main permissions: contents: read @@ -21,9 +18,6 @@ jobs: test: uses: ./.github/workflows/test-packages.yml - secrets: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} check-versions: - if: github.event_name == 'pull_request' uses: ./.github/workflows/check-version-availability.yml diff --git a/.github/workflows/test-packages.yml b/.github/workflows/test-packages.yml index 5bc300c2f..dab4b8d7c 100644 --- a/.github/workflows/test-packages.yml +++ b/.github/workflows/test-packages.yml @@ -2,9 +2,6 @@ name: Test Packages on: workflow_call: - secrets: - SONAR_TOKEN: - required: false permissions: contents: read @@ -80,31 +77,10 @@ jobs: run: uv sync --all-extras --python ${{ matrix.python-version }} - name: Run tests - if: steps.check.outputs.skip != 'true' && !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13') + if: steps.check.outputs.skip != 'true' working-directory: packages/uipath-core run: uv run pytest - - name: Run tests with coverage - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' - working-directory: packages/uipath-core - run: uv run pytest --cov-report=xml --cov-report=html --tb=short - - - name: Upload coverage HTML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-html-uipath-core - path: packages/uipath-core/htmlcov/ - retention-days: 30 - - - name: Upload coverage XML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-xml-uipath-core - path: packages/uipath-core/coverage.xml - retention-days: 30 - test-uipath-platform: name: Test (uipath-platform, ${{ matrix.python-version }}, ${{ matrix.os }}) needs: detect-changed-packages @@ -150,31 +126,10 @@ jobs: run: uv sync --all-extras --python ${{ matrix.python-version }} - name: Run tests - if: steps.check.outputs.skip != 'true' && !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13') + if: steps.check.outputs.skip != 'true' working-directory: packages/uipath-platform run: uv run pytest - - name: Run tests with coverage - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' - working-directory: packages/uipath-platform - run: uv run pytest --cov-report=xml --cov-report=html --tb=short - - - name: Upload coverage HTML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-html-uipath-platform - path: packages/uipath-platform/htmlcov/ - retention-days: 30 - - - name: Upload coverage XML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-xml-uipath-platform - path: packages/uipath-platform/coverage.xml - retention-days: 30 - e2e-uipath-platform: name: E2E (uipath-platform, memory) needs: detect-changed-packages @@ -270,76 +225,12 @@ jobs: run: uv sync --all-extras --python ${{ matrix.python-version }} - name: Run tests - if: steps.check.outputs.skip != 'true' && !(matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13') + if: steps.check.outputs.skip != 'true' working-directory: packages/uipath run: uv run pytest - - name: Run tests with coverage - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' - working-directory: packages/uipath - run: uv run pytest --cov-report=xml --cov-report=html --tb=short - - - name: Upload coverage HTML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-html-uipath - path: packages/uipath/htmlcov/ - retention-days: 30 - - - name: Upload coverage XML report - if: steps.check.outputs.skip != 'true' && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.13' && always() - uses: actions/upload-artifact@v4 - with: - name: coverage-xml-uipath - path: packages/uipath/coverage.xml - retention-days: 30 - continue-on-error: true - sonarcloud: - name: SonarCloud - needs: [test-uipath-core, test-uipath-platform, test-uipath] - runs-on: ubuntu-latest - if: always() && needs.test-uipath-core.result != 'failure' && needs.test-uipath-platform.result != 'failure' && needs.test-uipath.result != 'failure' - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Download uipath-core coverage - uses: actions/download-artifact@v4 - continue-on-error: true - with: - name: coverage-xml-uipath-core - path: packages/uipath-core - - - name: Download uipath-platform coverage - uses: actions/download-artifact@v4 - continue-on-error: true - with: - name: coverage-xml-uipath-platform - path: packages/uipath-platform - - - name: Download uipath coverage - uses: actions/download-artifact@v4 - continue-on-error: true - with: - name: coverage-xml-uipath - path: packages/uipath - - - name: Rewrite coverage XML to repo-relative paths - run: | - sed -i 's|src|packages/uipath-core/src|g' packages/uipath-core/coverage.xml || true - sed -i 's|src|packages/uipath-platform/src|g' packages/uipath-platform/coverage.xml || true - sed -i 's|src|packages/uipath/src|g' packages/uipath/coverage.xml || true - - - name: SonarCloud Scan - uses: SonarSource/sonarqube-scan-action@2f77a1ec69fb1d595b06f35ab27e97605bdef703 # v5 - env: - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - test-gate: name: Test needs: [test-uipath-core, test-uipath-platform, test-uipath, e2e-uipath-platform] diff --git a/.gitignore b/.gitignore index 6b24bbd06..a20556ebd 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,7 @@ samples/**/entry-points.json samples/**/uv.lock testcases/**/uv.lock + +# llms-full.txt is regenerated by `mkdocs build` during the wheel build (CD). +# It ships in the wheel but is not tracked in the repo. +packages/uipath/src/uipath/_resources/llms-full.txt diff --git a/CLAUDE.md b/CLAUDE.md index 365bc7d39..621528721 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -28,7 +28,7 @@ cd packages/uipath && uv sync --all-extras just lint # ruff check + custom httpx linter just format # ruff format --check just validate # lint + format -just build # validate + update-agents-md + uv build +just build # validate + uv build just install # uv sync --all-extras ``` diff --git a/packages/uipath-core/pyproject.toml b/packages/uipath-core/pyproject.toml index 8a001489b..cb188084e 100644 --- a/packages/uipath-core/pyproject.toml +++ b/packages/uipath-core/pyproject.toml @@ -95,30 +95,15 @@ warn_required_dynamic_aliases = true [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" -addopts = "-ra -q --cov=src --cov-report=term-missing" +addopts = "-ra -q --cov=src/uipath --cov-report=term-missing" asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" -[tool.coverage.run] -source = ["src"] -relative_files = true -omit = [ - "*/tests/*", - "*/__pycache__/*", - "*/site-packages/*", - "*/conftest.py", -] - [tool.coverage.report] show_missing = true -precision = 2 -exclude_lines = [ - "pragma: no cover", - "def __repr__", - "raise NotImplementedError", - "if TYPE_CHECKING:", - "@(abc\\.)?abstractmethod", -] + +[tool.coverage.run] +source = ["src"] [[tool.uv.index]] name = "testpypi" diff --git a/packages/uipath-platform/pyproject.toml b/packages/uipath-platform/pyproject.toml index 80546ec3a..1220b386a 100644 --- a/packages/uipath-platform/pyproject.toml +++ b/packages/uipath-platform/pyproject.toml @@ -98,33 +98,18 @@ warn_required_dynamic_aliases = true [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" -addopts = "-ra -q --cov=src --cov-report=term-missing -m 'not e2e'" +addopts = "-ra -q --cov=src/uipath --cov-report=term-missing -m 'not e2e'" asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" markers = [ "e2e: end-to-end tests against real ECS/LLMOps (requires UIPATH_URL, UIPATH_ACCESS_TOKEN, UIPATH_FOLDER_KEY)", ] -[tool.coverage.run] -source = ["src"] -relative_files = true -omit = [ - "*/tests/*", - "*/__pycache__/*", - "*/site-packages/*", - "*/conftest.py", -] - [tool.coverage.report] show_missing = true -precision = 2 -exclude_lines = [ - "pragma: no cover", - "def __repr__", - "raise NotImplementedError", - "if TYPE_CHECKING:", - "@(abc\\.)?abstractmethod", -] + +[tool.coverage.run] +source = ["src"] [tool.uv.sources] uipath-core = { path = "../uipath-core", editable = true } diff --git a/packages/uipath/CLAUDE.md b/packages/uipath/CLAUDE.md index 9b4c372c2..21cf76840 100644 --- a/packages/uipath/CLAUDE.md +++ b/packages/uipath/CLAUDE.md @@ -15,7 +15,7 @@ uv sync --all-extras # Install dependencies just lint # ruff check + custom httpx linter just format # ruff format --check just validate # lint + format -just build # validate + update-agents-md + uv build +just build # validate + uv build just install # uv sync --all-extras just test-lint-httpx # Test the custom httpx linter @@ -31,9 +31,9 @@ mypy src tests # Type check `scripts/lint_httpx_client.py` enforces httpx client usage patterns. Run with `just lint` or `python scripts/lint_httpx_client.py`. -### AGENTS.md Generation +### Bundled `llms-full.txt` -`scripts/update_agents_md.py` auto-generates `src/uipath/_resources/AGENTS.md` from agent definitions. Run via `just build` or `just update-agents-md`. +`src/uipath/_resources/llms-full.txt` is regenerated during CD: `build-package.yml` clones the plugin repos, runs `mkdocs build`, and copies `site/llms-full.txt` into `_resources/` before `uv build`. The file is gitignored (build artifact only). `uipath init --with-offline-docs` copies it to `.uipath/llms-full.txt` for users who explicitly opt in. ## CLI Architecture (`src/uipath/_cli/`) @@ -95,7 +95,7 @@ Application Insights tracking: `track()`, `track_event()`, `is_telemetry_enabled ## Bundled Resources (`src/uipath/_resources/`) -Documentation files bundled with the package: `AGENTS.md` (auto-generated), `CLAUDE.md`, `CLI_REFERENCE.md`, `SDK_REFERENCE.md`, `REQUIRED_STRUCTURE.md`, `eval.md`, `new-agent.md`. +`AGENTS.md` (template emitted by `uipath init`) and `llms-full.txt` (offline SDK/CLI reference, regenerated by `mkdocs build` during CD; copied into `.uipath/llms-full.txt` when `uipath init --with-offline-docs` is used). ## Test Structure diff --git a/packages/uipath/justfile b/packages/uipath/justfile index a9304f8ca..28f6467d6 100644 --- a/packages/uipath/justfile +++ b/packages/uipath/justfile @@ -11,10 +11,7 @@ format: validate: lint format -update-agents-md: validate - python scripts/update_agents_md.py - -build: update-agents-md +build: validate uv build install: diff --git a/packages/uipath/pyproject.toml b/packages/uipath/pyproject.toml index 3302e528e..8fbb2495d 100644 --- a/packages/uipath/pyproject.toml +++ b/packages/uipath/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "uipath" -version = "2.10.62" +version = "2.10.63" description = "Python SDK and CLI for UiPath Platform, enabling programmatic interaction with automation services, process management, and deployment tools." readme = { file = "README.md", content-type = "text/markdown" } requires-python = ">=3.11" @@ -137,30 +137,15 @@ warn_required_dynamic_aliases = true [tool.pytest.ini_options] testpaths = ["tests"] python_files = "test_*.py" -addopts = "-ra -q --cov=src --cov-report=term-missing" +addopts = "-ra -q --cov" asyncio_default_fixture_loop_scope = "function" asyncio_mode = "auto" -[tool.coverage.run] -source = ["src"] -relative_files = true -omit = [ - "*/tests/*", - "*/__pycache__/*", - "*/site-packages/*", - "*/conftest.py", -] - [tool.coverage.report] show_missing = true -precision = 2 -exclude_lines = [ - "pragma: no cover", - "def __repr__", - "raise NotImplementedError", - "if TYPE_CHECKING:", - "@(abc\\.)?abstractmethod", -] + +[tool.coverage.run] +source = ["src"] [tool.uv.sources] uipath-core = { path = "../uipath-core", editable = true } diff --git a/packages/uipath/scripts/update_agents_md.py b/packages/uipath/scripts/update_agents_md.py deleted file mode 100644 index dfd85dd92..000000000 --- a/packages/uipath/scripts/update_agents_md.py +++ /dev/null @@ -1,671 +0,0 @@ -#!/usr/bin/env python3 -"""Script to update AGENTS.md reference files with complete library documentation. - -This script extracts information from the uipath SDK and CLI commands and updates -the AGENTS.md reference files with comprehensive documentation including -- API Reference (SDK services and methods) -- CLI Commands Reference -""" - -import inspect -import sys -from io import StringIO -from pathlib import Path -from typing import Any - -sys.path.insert(0, str(Path(__file__).parent.parent / "src")) - -import click - - -def get_command_help(command: click.Command, command_name: str) -> dict[str, Any]: - """Extract help information from a Click command. - - Args: - command: The Click command to extract help from - command_name: The name of the command - - Returns: - Dictionary with command information - """ - help_text = command.help or "No description available." - params = [] - for param in command.params: - param_info = { - "name": param.name, - "type": type(param).__name__, - "help": getattr(param, "help", "") or "", - "required": param.required, - } - - if isinstance(param, click.Option): - param_info["opts"] = param.opts - param_info["is_flag"] = param.is_flag - if param.default is not None and not param.is_flag: - param_info["default"] = param.default - elif isinstance(param, click.Argument): - param_info["opts"] = [param.name] - - params.append(param_info) - - return { - "name": command_name, - "help": help_text, - "params": params, - } - - -def extract_method_signature(method: Any, include_types: bool = True) -> str: - """Extract a clean method signature from a method object. - - Args: - method: The method to extract signature from - include_types: Whether to include type annotations - - Returns: - String representation of the method signature - """ - try: - sig = inspect.signature(method) - params = [] - for name, param in sig.parameters.items(): - if name in ("self", "cls"): - continue - - param_str = name - if include_types and param.annotation != inspect.Parameter.empty: - type_str = str(param.annotation) - type_str = type_str.replace("", "") - type_str = type_str.replace("typing.", "") - param_str = f"{name}: {type_str}" - - if param.default != inspect.Parameter.empty: - if param.kind == inspect.Parameter.VAR_POSITIONAL: - param_str = f"*{name}" - elif param.kind == inspect.Parameter.VAR_KEYWORD: - param_str = f"**{name}" - elif param.default is None: - param_str = f"{param_str}=None" - elif isinstance(param.default, str): - param_str = f'{param_str}="{param.default}"' - elif isinstance(param.default, bool): - param_str = f"{param_str}={param.default}" - else: - param_str = f"{param_str}={param.default}" - else: - if param.kind == inspect.Parameter.VAR_POSITIONAL: - param_str = f"*{name}" - elif param.kind == inspect.Parameter.VAR_KEYWORD: - param_str = f"**{name}" - - params.append(param_str) - return f"({', '.join(params)})" - except Exception: - return "()" - - -def get_first_line(docstring: str) -> str: - """Get the first meaningful line from a docstring. - - Args: - docstring: The docstring to process - - Returns: - First line of the docstring - """ - if not docstring: - return "" - lines = docstring.strip().split("\n") - for line in lines: - stripped = line.strip() - if ( - stripped - and not stripped.startswith("Args:") - and not stripped.startswith("Returns:") - ): - return stripped - return "" - - -def get_service_methods(service_class: type) -> list[tuple[str, Any]]: - """Extract public methods from a service class. - - Args: - service_class: The service class to extract methods from - - Returns: - List of tuples (method_name, method_object) for public methods - """ - methods = [] - for name in dir(service_class): - if name.startswith("_"): - continue - attr = getattr(service_class, name, None) - if callable(attr) and hasattr(attr, "__doc__") and attr.__doc__: - methods.append((name, attr)) - return methods - - -def generate_quick_api_docs() -> str: - """Generate API Reference documentation for SDK. - - Returns: - Markdown string with SDK API documentation - """ - from functools import cached_property - - from uipath.platform import UiPath - - output = StringIO() - output.write("\n## API Reference\n\n") - output.write( - "This section provides a comprehensive reference for all UiPath SDK services and methods. " - "Each service is documented with complete method signatures, including parameter types and return types.\n\n" - ) - - output.write("### SDK Initialization\n\n") - output.write("Initialize the UiPath SDK client\n\n") - output.write("```python\n") - output.write("from uipath.platform import UiPath\n\n") - output.write("# Initialize with environment variables\n") - output.write("sdk = UiPath()\n\n") - output.write("# Or with explicit credentials\n") - output.write( - 'sdk = UiPath(base_url="https://cloud.uipath.com/...", secret="your_token")\n' - ) - output.write("```\n\n") - - uipath_properties = [] - for name in dir(UiPath): - if name.startswith("_"): - continue - attr = getattr(UiPath, name, None) - if isinstance(attr, (property, cached_property)): - uipath_properties.append(name) - - uipath_properties.sort() - - for service_name in uipath_properties: - try: - service_property = getattr(UiPath, service_name) - if not isinstance(service_property, (property, cached_property)): - continue - - # Get the function object (property uses .fget, cached_property uses .func) - if isinstance(service_property, cached_property): - func = service_property.func - else: - func = service_property.fget # type: ignore[assignment] - - if func is None: - continue - - service_doc = func.__doc__ - - description = ( - service_doc.strip().split("\n")[0] - if service_doc - else f"{service_name.replace('_', ' ').title()} service" - ) - - return_annotation = None - property_sig = inspect.signature(func) - return_annotation = property_sig.return_annotation - - output.write(f"### {service_name.replace('_', ' ').title()}\n\n") - output.write(f"{description}\n\n") - output.write("```python\n") - - if return_annotation and return_annotation != inspect.Signature.empty: - service_class = return_annotation - methods = get_service_methods(service_class) - - if methods: - for method_name, method in methods: - try: - if callable(method): - method_sig = extract_method_signature(method) - doc = get_first_line(inspect.getdoc(method) or "") - - return_type = "" - try: - sig = inspect.signature(method) - if sig.return_annotation != inspect.Signature.empty: - return_type_str = str(sig.return_annotation) - return_type_str = return_type_str.replace( - "", "") - return_type = f" -> {return_type_str}" - except Exception: - pass - - output.write(f"# {doc}\n" if doc else "") - output.write( - f"sdk.{service_name}.{method_name}{method_sig}{return_type}\n\n" - ) - except Exception: - continue - else: - output.write(f"# Access {service_name} service methods\n") - output.write(f"service = sdk.{service_name}\n\n") - - output.write("```\n\n") - except Exception: - continue - - return output.getvalue() - - -def generate_cli_docs() -> str: - """Generate CLI documentation markdown. - - Returns: - Markdown string with CLI commands documentation - """ - from uipath._cli.cli_eval import eval - from uipath._cli.cli_init import init - from uipath._cli.cli_run import run - - commands = [ - ("init", init), - ("run", run), - ("eval", eval), - ] - - output = StringIO() - output.write("\n## CLI Commands Reference\n\n") - output.write( - "The UiPath Python SDK provides a comprehensive CLI for managing coded agents and automation projects. " - "All commands should be executed with `uv run uipath `.\n\n" - ) - - output.write("### Command Overview\n\n") - output.write("| Command | Purpose | When to Use |\n") - output.write("|---------|---------|-------------|\n") - output.write( - "| `init` | Initialize agent project | Creating a new agent or updating schema |\n" - ) - output.write("| `run` | Execute agent | Running agent locally or testing |\n") - output.write( - "| `eval` | Evaluate agent | Testing agent performance with evaluation sets |\n\n" - ) - - output.write("---\n\n") - - for cmd_name, cmd in commands: - cmd_info = get_command_help(cmd, cmd_name) - - output.write(f"### `uipath {cmd_name}`\n\n") - output.write(f"**Description:** {cmd_info['help']}\n\n") - - arguments = [p for p in cmd_info["params"] if p["type"] == "Argument"] - options = [p for p in cmd_info["params"] if p["type"] == "Option"] - - if arguments: - output.write("**Arguments:**\n\n") - output.write("| Argument | Required | Description |\n") - output.write("|----------|----------|-------------|\n") - for arg in arguments: - required = "Yes" if arg.get("required") else "No" - help_text = arg["help"] if arg["help"] else "N/A" - output.write(f"| `{arg['name']}` | {required} | {help_text} |\n") - output.write("\n") - - if options: - output.write("**Options:**\n\n") - output.write("| Option | Type | Default | Description |\n") - output.write("|--------|------|---------|-------------|\n") - for opt in options: - opts_str = ", ".join(f"`{o}`" for o in opt.get("opts", [])) - - if opt.get("is_flag"): - opt_type = "flag" - default = "false" - elif opt.get("default") is not None: - opt_type = "value" - default_val = opt["default"] - if isinstance(default_val, str): - default = f'`"{default_val}"`' - else: - default = f"`{default_val}`" - else: - opt_type = "value" - default = "none" - - help_text = opt["help"] if opt["help"] else "N/A" - output.write(f"| {opts_str} | {opt_type} | {default} | {help_text} |\n") - output.write("\n") - - output.write("**Usage Examples:**\n\n") - - if cmd_name == "init": - output.write("```bash\n") - output.write("# Initialize a new agent project\n") - output.write("uv run uipath init\n\n") - output.write("# Initialize with specific entrypoint\n") - output.write("uv run uipath init main.py\n\n") - output.write("# Initialize and infer bindings from code\n") - output.write("uv run uipath init --infer-bindings\n") - output.write("```\n\n") - output.write( - "**When to use:** Run this command when you've modified the Input/Output models and need to regenerate the `uipath.json` schema file.\n\n" - ) - - elif cmd_name == "run": - output.write("```bash\n") - output.write("# Run agent with inline JSON input\n") - output.write( - 'uv run uipath run main.py \'{"query": "What is the weather?"}\'\n\n' - ) - output.write("# Run agent with input from file\n") - output.write("uv run uipath run main.py --file input.json\n\n") - output.write("# Run agent and save output to file\n") - output.write( - 'uv run uipath run agent \'{"task": "Process data"}\' --output-file result.json\n\n' - ) - output.write("# Run agent with debugging enabled\n") - output.write( - 'uv run uipath run main.py \'{"input": "test"}\' --debug --debug-port 5678\n\n' - ) - output.write("# Resume agent execution from previous state\n") - output.write("uv run uipath run --resume\n") - output.write("```\n\n") - output.write( - "**When to use:** Run this command to execute your agent locally for development, testing, or debugging. Use `--debug` flag to attach a debugger for step-by-step debugging.\n\n" - ) - - elif cmd_name == "eval": - output.write("```bash\n") - output.write("# Run evaluation with auto-discovered files\n") - output.write("uv run uipath eval\n\n") - output.write("# Run evaluation with specific entrypoint and eval set\n") - output.write("uv run uipath eval main.py eval_set.json\n\n") - output.write("# Run evaluation without reporting results\n") - output.write("uv run uipath eval --no-report\n\n") - output.write("# Run evaluation with custom number of workers\n") - output.write("uv run uipath eval --workers 4\n\n") - output.write("# Save evaluation output to file\n") - output.write("uv run uipath eval --output-file eval_results.json\n") - output.write("```\n\n") - output.write( - "**When to use:** Run this command to test your agent's performance against a predefined evaluation set. This helps validate agent behavior and measure quality metrics.\n\n" - ) - - output.write("---\n\n") - - output.write("### Common Workflows\n\n") - output.write("**1. Creating a New Agent:**\n") - output.write("```bash\n") - output.write("# Step 1: Initialize project\n") - output.write("uv run uipath init\n\n") - output.write("# Step 2: Run agent to test\n") - output.write('uv run uipath run main.py \'{"input": "test"}\'\n\n') - output.write("# Step 3: Evaluate agent performance\n") - output.write("uv run uipath eval\n") - output.write("```\n\n") - - output.write("**2. Development & Testing:**\n") - output.write("```bash\n") - output.write("# Run with debugging\n") - output.write('uv run uipath run main.py \'{"input": "test"}\' --debug\n\n') - output.write("# Test with input file\n") - output.write( - "uv run uipath run main.py --file test_input.json --output-file test_output.json\n" - ) - output.write("```\n\n") - - output.write("**3. Schema Updates:**\n") - output.write("```bash\n") - output.write("# After modifying Input/Output models, regenerate schema\n") - output.write("uv run uipath init --infer-bindings\n") - output.write("```\n\n") - - output.write("### Configuration File (uipath.json)\n\n") - output.write( - "The `uipath.json` file is automatically generated by `uipath init` and defines your agent's schema and bindings.\n\n" - ) - - output.write("**Structure:**\n\n") - output.write("```json\n") - output.write("{\n") - output.write(' "entryPoints": [\n') - output.write(" {\n") - output.write(' "filePath": "agent",\n') - output.write(' "uniqueId": "uuid-here",\n') - output.write(' "type": "agent",\n') - output.write(' "input": {\n') - output.write(' "type": "object",\n') - output.write(' "properties": { ... },\n') - output.write(' "description": "Input schema",\n') - output.write(' "required": [ ... ]\n') - output.write(" },\n") - output.write(' "output": {\n') - output.write(' "type": "object",\n') - output.write(' "properties": { ... },\n') - output.write(' "description": "Output schema",\n') - output.write(' "required": [ ... ]\n') - output.write(" }\n") - output.write(" }\n") - output.write(" ],\n") - output.write(' "bindings": {\n') - output.write(' "version": "2.0",\n') - output.write(' "resources": []\n') - output.write(" }\n") - output.write("}\n") - output.write("```\n\n") - - output.write("**When to Update:**\n\n") - output.write( - "1. **After Modifying Input/Output Models**: Run `uv run uipath init --infer-bindings` to regenerate schemas\n" - ) - output.write( - "2. **Changing Entry Point**: Update `filePath` if you rename or move your main file\n" - ) - output.write( - "3. **Manual Schema Adjustments**: Edit `input.jsonSchema` or `output.jsonSchema` directly if needed\n" - ) - output.write( - "4. **Bindings Updates**: The `bindings` section maps the exported graph variable - update if you rename your graph\n\n" - ) - - output.write("**Important Notes:**\n\n") - output.write("- The `uniqueId` should remain constant for the same agent\n") - output.write('- Always use `type: "agent"` for LangGraph agents\n') - output.write("- The `jsonSchema` must match your Pydantic models exactly\n") - output.write( - "- Re-run `uipath init --infer-bindings` instead of manual edits when possible\n\n" - ) - - return output.getvalue() - - -def generate_service_cli_docs() -> str: - """Generate documentation for service CLI commands. - - Returns: - Markdown string with service CLI commands documentation - """ - from uipath._cli import cli - - output = StringIO() - output.write("\n## Service Commands Reference\n\n") - output.write( - "The UiPath CLI provides commands for interacting with UiPath platform services. " - "These commands allow you to manage buckets, assets, jobs, and other resources.\n\n" - ) - - # With LazyGroup, we need to use list_commands() and get_command() - # Create a fake context for the CLI - ctx = click.Context(cli) - - # Get all command names and filter for service groups - all_command_names = cli.list_commands(ctx) - - service_groups = [] - for name in sorted(all_command_names): - if name not in [ - "init", - "run", - "eval", - "new", - "pack", - "publish", - "deploy", - "auth", - "invoke", - "push", - "pull", - "dev", - "add", - "register", - "debug", - ]: - cmd = cli.get_command(ctx, name) - if isinstance(cmd, click.Group): - service_groups.append((name, cmd)) - - if not service_groups: - return "" - - for service_name, service_group in service_groups: - output.write(f"### `uipath {service_name}`\n\n") - output.write(f"{service_group.help or 'Manage ' + service_name}\n\n") - - # Document subcommands - use list_commands/get_command for lazy groups - service_ctx = click.Context(service_group, parent=ctx) - - if hasattr(service_group, "list_commands"): - subcommand_names = service_group.list_commands(service_ctx) - elif hasattr(service_group, "commands"): - subcommand_names = list(service_group.commands.keys()) - else: - subcommand_names = [] - - if subcommand_names: - output.write("**Subcommands:**\n\n") - - for subcmd_name in sorted(subcommand_names): - # Get the subcommand - if hasattr(service_group, "get_command"): - subcmd = service_group.get_command(service_ctx, subcmd_name) - elif hasattr(service_group, "commands"): - subcmd = service_group.commands.get(subcmd_name) - else: - continue - - if subcmd is None: - continue - - # Handle nested groups (e.g., buckets files) - if isinstance(subcmd, click.Group): - output.write(f"#### `uipath {service_name} {subcmd_name}`\n\n") - output.write(f"{subcmd.help or f'{subcmd_name} commands'}\n\n") - - # Get nested commands - nested_ctx = click.Context(subcmd, parent=service_ctx) - if hasattr(subcmd, "list_commands"): - nested_cmd_names = subcmd.list_commands(nested_ctx) - elif hasattr(subcmd, "commands"): - nested_cmd_names = list(subcmd.commands.keys()) - else: - nested_cmd_names = [] - - for nested_name in sorted(nested_cmd_names): - if hasattr(subcmd, "get_command"): - nested_cmd = subcmd.get_command(nested_ctx, nested_name) - elif hasattr(subcmd, "commands"): - nested_cmd = subcmd.commands.get(nested_name) - else: - continue - - if nested_cmd is None: - continue - - cmd_info = get_command_help( - nested_cmd, - f"{service_name} {subcmd_name} {nested_name}", - ) - _write_command_doc(output, cmd_info, service_name, subcmd_name) - else: - cmd_info = get_command_help(subcmd, f"{service_name} {subcmd_name}") - _write_command_doc(output, cmd_info, service_name) - - output.write("---\n\n") - - return output.getvalue() - - -def _write_command_doc( - output: StringIO, cmd_info: dict[str, Any], *path_parts: str -) -> None: - """Write command documentation to output stream. - - Args: - output: StringIO buffer to write to - cmd_info: Command information dict - path_parts: Command path parts (e.g., "buckets", "files") - """ - full_path = " ".join(path_parts + (cmd_info["name"].split()[-1],)) - - output.write(f"**`uipath {full_path}`**\n\n") - output.write(f"{cmd_info['help']}\n\n") - - arguments = [p for p in cmd_info["params"] if p["type"] == "Argument"] - options = [p for p in cmd_info["params"] if p["type"] == "Option"] - - if arguments: - output.write("Arguments:\n") - for arg in arguments: - required = " (required)" if arg.get("required") else "" - help_text = arg["help"] if arg["help"] else "N/A" - output.write(f"- `{arg['name']}`{required}: {help_text}\n") - output.write("\n") - - if options: - output.write("Options:\n") - for opt in options: - opts_str = ", ".join(f"`{o}`" for o in opt.get("opts", [])) - help_text = opt["help"] if opt["help"] else "" - - if opt.get("default") is not None and not opt.get("is_flag"): - default = opt["default"] - if isinstance(default, str): - help_text += f" (default: `{default}`)" - else: - help_text += f" (default: `{default}`)" - - output.write(f"- {opts_str}: {help_text}\n") - output.write("\n") - - -def generate_agents_md_reference_files() -> None: - """Generate separate reference files.""" - resources_dir = Path(__file__).parent.parent / "src" / "uipath" / "_resources" - - sdk_reference_path = resources_dir / "SDK_REFERENCE.md" - cli_reference_path = resources_dir / "CLI_REFERENCE.md" - - api_docs = generate_quick_api_docs() - cli_docs = generate_cli_docs() - service_cli_docs = generate_service_cli_docs() - - with open(sdk_reference_path, "w", encoding="utf-8") as f: - f.write(api_docs.lstrip("\n")) - - with open(cli_reference_path, "w", encoding="utf-8") as f: - f.write(cli_docs.lstrip("\n")) - if service_cli_docs: - f.write(service_cli_docs) - - -def main(): - """Main function.""" - try: - generate_agents_md_reference_files() - except Exception as e: - print(f"Error updating AGENTS.md reference files: {e}", file=sys.stderr) - sys.exit(1) - - -if __name__ == "__main__": - main() diff --git a/packages/uipath/src/uipath/_cli/cli_init.py b/packages/uipath/src/uipath/_cli/cli_init.py index 80396d8ff..84c9f135f 100644 --- a/packages/uipath/src/uipath/_cli/cli_init.py +++ b/packages/uipath/src/uipath/_cli/cli_init.py @@ -125,39 +125,44 @@ def generate_agent_md_file( return False -def generate_agent_md_files(target_directory: str, no_agents_md_override: bool) -> None: - """Generate AGENTS.md related files and Claude Code skills. +def generate_agent_md_files( + target_directory: str, + no_agents_md_override: bool, + with_offline_docs: bool = False, +) -> None: + """Generate AGENTS.md (plus a CLAUDE.md shim) and optionally bundle the offline reference. Args: target_directory: The directory where the files should be created. - no_agents_md_override: Whether to override existing files. + no_agents_md_override: When True, do not overwrite existing AGENTS.md/CLAUDE.md. + with_offline_docs: When True, copy llms-full.txt to .uipath/ as an offline fallback. """ - agent_dir = os.path.join(target_directory, ".agent") - os.makedirs(agent_dir, exist_ok=True) - claude_commands_dir = os.path.join(target_directory, ".claude", "commands") - os.makedirs(claude_commands_dir, exist_ok=True) - - files_to_create = { - target_directory: ["AGENTS.md", "CLAUDE.md"], - agent_dir: ["CLI_REFERENCE.md", "REQUIRED_STRUCTURE.md", "SDK_REFERENCE.md"], - claude_commands_dir: ["new-agent.md", "eval.md"], - } - - any_overridden = False - for directory, filenames in files_to_create.items(): - for filename in filenames: - if generate_agent_md_file(directory, filename, no_agents_md_override): - any_overridden = True + overridden = generate_agent_md_file( + target_directory, "AGENTS.md", no_agents_md_override + ) + generate_agent_md_file(target_directory, "CLAUDE.md", no_agents_md_override) - if any_overridden: - console.success( - f"{Action.UPDATED.value} {click.style('AGENTS.md', fg='cyan')} files and Claude Code skills." - ) - return + if with_offline_docs: + uipath_dir = os.path.join(target_directory, ".uipath") + os.makedirs(uipath_dir, exist_ok=True) + try: + source = importlib.resources.files("uipath._resources").joinpath( + "llms-full.txt" + ) + with importlib.resources.as_file(source) as s_path: + shutil.copy(s_path, os.path.join(uipath_dir, "llms-full.txt")) + except (FileNotFoundError, ModuleNotFoundError): + pass + else: + agents_path = os.path.join(target_directory, "AGENTS.md") + with open(agents_path, "a", encoding="utf-8") as f: + f.write( + "\n3. If neither of the above is reachable, read " + "`.uipath/llms-full.txt` (offline fallback bundled with this project).\n" + ) - console.success( - f"{Action.CREATED.value} {click.style('AGENTS.md', fg='cyan')} files and Claude Code skills." - ) + action = Action.UPDATED.value if overridden else Action.CREATED.value + console.success(f"{action} {click.style('AGENTS.md', fg='cyan')} file.") def write_bindings_file(bindings: Bindings) -> Path: @@ -413,10 +418,17 @@ def _display_entrypoint_graphs(entry_point_schemas: list[UiPathRuntimeSchema]) - is_flag=True, required=False, default=False, - help="Won't override existing .agent files and AGENTS.md file.", + help="Won't override an existing AGENTS.md file.", +) +@click.option( + "--with-offline-docs", + is_flag=True, + required=False, + default=False, + help="Bundle the offline SDK/CLI reference at .uipath/llms-full.txt for use when neither the UiPath skills nor the live docs URL are reachable.", ) @track_command("initialize") -def init(no_agents_md_override: bool) -> None: +def init(no_agents_md_override: bool, with_offline_docs: bool) -> None: """Initialize the project.""" with console.spinner("Initializing UiPath project ..."): current_directory = os.getcwd() @@ -519,6 +531,8 @@ async def initialize() -> list[UiPathRuntimeSchema]: _display_entrypoint_graphs(entry_point_schemas) return - generate_agent_md_files(current_directory, no_agents_md_override) + generate_agent_md_files( + current_directory, no_agents_md_override, with_offline_docs + ) _display_entrypoint_graphs(entry_point_schemas) diff --git a/packages/uipath/src/uipath/_resources/AGENTS.md b/packages/uipath/src/uipath/_resources/AGENTS.md index b83142f0f..896982055 100644 --- a/packages/uipath/src/uipath/_resources/AGENTS.md +++ b/packages/uipath/src/uipath/_resources/AGENTS.md @@ -1,21 +1,9 @@ -# Agent Code Patterns Reference +# UiPath Project -This document provides practical code patterns for building UiPath coded agents using the UiPath Python SDK. +For SDK and CLI knowledge, follow this order: ---- +1. Run `uip skills install` (install the CLI first if needed: `npm install -g @uipath/cli`). + Recommended skills: `uipath-agents`, `uipath-platform`. -## Documentation Structure - -This documentation is split into multiple files for efficient context loading. Load only the files you need: - -1. **@.agent/REQUIRED_STRUCTURE.md** - Agent structure patterns and templates - - **When to load:** Creating a new agent or understanding required patterns - - **Contains:** Required Pydantic models (Input, Output), SDK initialization patterns, standard agent template - -2. **@.agent/SDK_REFERENCE.md** - Complete SDK API reference - - **When to load:** Calling UiPath SDK methods, working with services (actions, assets, jobs, etc.) - - **Contains:** All SDK services and methods with full signatures and type annotations - -3. **@.agent/CLI_REFERENCE.md** - CLI commands documentation - - **When to load:** Working with `uipath init`, `uipath run`, or `uipath eval` commands - - **Contains:** Command syntax, options, usage examples, and workflows +2. If `uip` is unavailable, fetch `https://uipath.github.io/uipath-python/llms.txt` + and follow the linked sections on demand. diff --git a/packages/uipath/src/uipath/_resources/CLAUDE.md b/packages/uipath/src/uipath/_resources/CLAUDE.md index eef4bd20c..43c994c2d 100644 --- a/packages/uipath/src/uipath/_resources/CLAUDE.md +++ b/packages/uipath/src/uipath/_resources/CLAUDE.md @@ -1 +1 @@ -@AGENTS.md \ No newline at end of file +@AGENTS.md diff --git a/packages/uipath/src/uipath/_resources/CLI_REFERENCE.md b/packages/uipath/src/uipath/_resources/CLI_REFERENCE.md deleted file mode 100644 index ff4009b22..000000000 --- a/packages/uipath/src/uipath/_resources/CLI_REFERENCE.md +++ /dev/null @@ -1,948 +0,0 @@ -## CLI Commands Reference - -The UiPath Python SDK provides a comprehensive CLI for managing coded agents and automation projects. All commands should be executed with `uv run uipath `. - -### Command Overview - -| Command | Purpose | When to Use | -|---------|---------|-------------| -| `init` | Initialize agent project | Creating a new agent or updating schema | -| `run` | Execute agent | Running agent locally or testing | -| `eval` | Evaluate agent | Testing agent performance with evaluation sets | - ---- - -### `uipath init` - -**Description:** Initialize the project. - -**Options:** - -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `--no-agents-md-override` | flag | false | Won't override existing .agent files and AGENTS.md file. | - -**Usage Examples:** - -```bash -# Initialize a new agent project -uv run uipath init - -# Initialize with specific entrypoint -uv run uipath init main.py - -# Initialize and infer bindings from code -uv run uipath init --infer-bindings -``` - -**When to use:** Run this command when you've modified the Input/Output models and need to regenerate the `uipath.json` schema file. - ---- - -### `uipath run` - -**Description:** Execute the project. - -**Arguments:** - -| Argument | Required | Description | -|----------|----------|-------------| -| `entrypoint` | No | N/A | -| `input` | No | N/A | - -**Options:** - -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `--resume` | flag | false | Resume execution from a previous state | -| `-f`, `--file` | value | `Sentinel.UNSET` | File path for the .json input | -| `--input-file` | value | `Sentinel.UNSET` | Alias for '-f/--file' arguments | -| `--output-file` | value | `Sentinel.UNSET` | File path where the output will be written | -| `--trace-file` | value | `Sentinel.UNSET` | File path where the trace spans will be written (JSON Lines format) | -| `--state-file` | value | `Sentinel.UNSET` | File path where the state file is stored for persisting execution state. If not provided, a temporary file will be used. | -| `--debug` | flag | false | Enable debugging with debugpy. The process will wait for a debugger to attach. | -| `--debug-port` | value | `5678` | Port for the debug server (default: 5678) | -| `--keep-state-file` | flag | false | Keep the temporary state file even when not resuming and no job id is provided | - -**Usage Examples:** - -```bash -# Run agent with inline JSON input -uv run uipath run main.py '{"query": "What is the weather?"}' - -# Run agent with input from file -uv run uipath run main.py --file input.json - -# Run agent and save output to file -uv run uipath run agent '{"task": "Process data"}' --output-file result.json - -# Run agent with debugging enabled -uv run uipath run main.py '{"input": "test"}' --debug --debug-port 5678 - -# Resume agent execution from previous state -uv run uipath run --resume -``` - -**When to use:** Run this command to execute your agent locally for development, testing, or debugging. Use `--debug` flag to attach a debugger for step-by-step debugging. - ---- - -### `uipath eval` - -**Description:** Run an evaluation set against the agent. - - Args: - entrypoint: Path to the agent script to evaluate (optional, will auto-discover if not specified) - eval_set: Path to the evaluation set JSON file (optional, will auto-discover if not specified) - eval_ids: Optional list of evaluation IDs - eval_set_run_id: Custom evaluation set run ID (optional, will generate UUID if not specified) - workers: Number of parallel workers for running evaluations - no_report: Do not report the evaluation results - enable_mocker_cache: Enable caching for LLM mocker responses - report_coverage: Report evaluation coverage - model_settings_id: Model settings ID to override agent settings - trace_file: File path where traces will be written in JSONL format - max_llm_concurrency: Maximum concurrent LLM requests - input_overrides: Input field overrides mapping (direct field override with deep merge) - resume: Resume execution from a previous suspended state - - -**Arguments:** - -| Argument | Required | Description | -|----------|----------|-------------| -| `entrypoint` | No | N/A | -| `eval_set` | No | N/A | - -**Options:** - -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `--eval-set-run-id` | value | `Sentinel.UNSET` | Custom evaluation set run ID (if not provided, a UUID will be generated) | -| `--no-report` | flag | false | Do not report the evaluation results | -| `--workers` | value | `1` | Number of parallel workers for running evaluations (default: 1) | -| `--output-file` | value | `Sentinel.UNSET` | File path where the output will be written | -| `--enable-mocker-cache` | flag | false | Enable caching for LLM mocker responses | -| `--report-coverage` | flag | false | Report evaluation coverage | -| `--model-settings-id` | value | `"default"` | Model settings ID from evaluation set to override agent settings (default: 'default') | -| `--trace-file` | value | `Sentinel.UNSET` | File path where traces will be written in JSONL format | -| `--max-llm-concurrency` | value | `20` | Maximum concurrent LLM requests (default: 20) | -| `--resume` | flag | false | Resume execution from a previous suspended state | -| `--verbose` | flag | false | Include agent execution output (trace, result) in the output file | - -**Usage Examples:** - -```bash -# Run evaluation with auto-discovered files -uv run uipath eval - -# Run evaluation with specific entrypoint and eval set -uv run uipath eval main.py eval_set.json - -# Run evaluation without reporting results -uv run uipath eval --no-report - -# Run evaluation with custom number of workers -uv run uipath eval --workers 4 - -# Save evaluation output to file -uv run uipath eval --output-file eval_results.json -``` - -**When to use:** Run this command to test your agent's performance against a predefined evaluation set. This helps validate agent behavior and measure quality metrics. - ---- - -### Common Workflows - -**1. Creating a New Agent:** -```bash -# Step 1: Initialize project -uv run uipath init - -# Step 2: Run agent to test -uv run uipath run main.py '{"input": "test"}' - -# Step 3: Evaluate agent performance -uv run uipath eval -``` - -**2. Development & Testing:** -```bash -# Run with debugging -uv run uipath run main.py '{"input": "test"}' --debug - -# Test with input file -uv run uipath run main.py --file test_input.json --output-file test_output.json -``` - -**3. Schema Updates:** -```bash -# After modifying Input/Output models, regenerate schema -uv run uipath init --infer-bindings -``` - -### Configuration File (uipath.json) - -The `uipath.json` file is automatically generated by `uipath init` and defines your agent's schema and bindings. - -**Structure:** - -```json -{ - "entryPoints": [ - { - "filePath": "agent", - "uniqueId": "uuid-here", - "type": "agent", - "input": { - "type": "object", - "properties": { ... }, - "description": "Input schema", - "required": [ ... ] - }, - "output": { - "type": "object", - "properties": { ... }, - "description": "Output schema", - "required": [ ... ] - } - } - ], - "bindings": { - "version": "2.0", - "resources": [] - } -} -``` - -**When to Update:** - -1. **After Modifying Input/Output Models**: Run `uv run uipath init --infer-bindings` to regenerate schemas -2. **Changing Entry Point**: Update `filePath` if you rename or move your main file -3. **Manual Schema Adjustments**: Edit `input.jsonSchema` or `output.jsonSchema` directly if needed -4. **Bindings Updates**: The `bindings` section maps the exported graph variable - update if you rename your graph - -**Important Notes:** - -- The `uniqueId` should remain constant for the same agent -- Always use `type: "agent"` for LangGraph agents -- The `jsonSchema` must match your Pydantic models exactly -- Re-run `uipath init --infer-bindings` instead of manual edits when possible - - -## Service Commands Reference - -The UiPath CLI provides commands for interacting with UiPath platform services. These commands allow you to manage buckets, assets, jobs, and other resources. - -### `uipath assets` - -Manage UiPath assets. - - Assets are key-value pairs that store configuration data, credentials, - and settings used by automation processes. - - \b - Examples: - # List all assets in a folder - uipath assets list --folder-path "Shared" - - # List with filter - uipath assets list --filter "ValueType eq 'Text'" - - # List with ordering - uipath assets list --orderby "Name asc" - - -**Subcommands:** - -**`uipath assets list`** - -List assets in a folder. - - \b - Examples: - uipath assets list - uipath assets list --folder-path "Shared" - uipath assets list --filter "ValueType eq 'Text'" - uipath assets list --filter "Name eq 'MyAsset'" - uipath assets list --orderby "Name asc" - uipath assets list --top 50 --skip 100 - - -Options: -- `--filter`: OData $filter expression (default: `Sentinel.UNSET`) -- `--orderby`: OData $orderby expression (default: `Sentinel.UNSET`) -- `--top`: Maximum number of items to return (default: 100, max: 1000) (default: `100`) -- `--skip`: Number of items to skip (default: `0`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - ---- - -### `uipath buckets` - -Manage UiPath storage buckets and files. - -Buckets are cloud storage containers for files used by automation processes. - - -Bucket Operations: - list - List all buckets - create - Create a new bucket - delete - Delete a bucket - retrieve - Get bucket details - exists - Check if bucket exists - - -File Operations (use 'buckets files' subcommand): - files list - List files in a bucket - files search - Search files using glob patterns - files upload - Upload a file to a bucket - files download - Download a file from a bucket - files delete - Delete a file from a bucket - files exists - Check if a file exists - - -Examples: -  - # Bucket operations with explicit folder - uipath buckets list --folder-path "Shared" - uipath buckets create my-bucket --description "Data storage" - uipath buckets exists my-bucket - uipath buckets delete my-bucket --confirm -  - # Using environment variable for folder context - export UIPATH_FOLDER_PATH="Shared" - uipath buckets list - uipath buckets create my-bucket --description "Data storage" -  - # File operations - uipath buckets files list my-bucket - uipath buckets files search my-bucket "*.pdf" - uipath buckets files upload my-bucket ./data.csv remote/data.csv - uipath buckets files download my-bucket data.csv ./local.csv - uipath buckets files delete my-bucket old-data.csv --confirm - uipath buckets files exists my-bucket data.csv - - -**Subcommands:** - -**`uipath buckets create`** - -Create a new Bucket. - -Examples: - uipath buckets create my-resource - uipath buckets create my-resource --folder-path Shared - - -Arguments: -- `name` (required): N/A - -Options: -- `--description`: Bucket description -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets delete`** - -Delete a bucket. - -  - Examples: - uipath buckets delete my-bucket --confirm - uipath buckets delete my-bucket --dry-run - - -Arguments: -- `name` (required): N/A - -Options: -- `--confirm`: Skip confirmation prompt -- `--dry-run`: Show what would be deleted without deleting -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets exists`** - -Check if a Bucket exists. - -Examples: - uipath buckets exists my-resource - uipath buckets exists my-resource --folder-path Shared - - -Arguments: -- `name` (required): N/A - -Options: -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -#### `uipath buckets files` - -Manage files within buckets. - -  - Examples: -  - # List files in a bucket - uipath buckets files list my-bucket -  - # Search for files with glob pattern - uipath buckets files search my-bucket "*.pdf" -  - # Upload a file - uipath buckets files upload my-bucket ./data.csv remote/data.csv -  - # Download a file - uipath buckets files download my-bucket data.csv ./local.csv -  - # Delete a file - uipath buckets files delete my-bucket old-data.csv --confirm -  - # Check if file exists - uipath buckets files exists my-bucket data.csv - - -**`uipath buckets files delete`** - -Delete a file from a bucket. - -  - Arguments: - BUCKET_NAME: Name of the bucket - FILE_PATH: Path to file in bucket - -  - Examples: - uipath buckets files delete my-bucket old-data.csv --confirm - uipath buckets files delete reports archive/old.pdf --dry-run - - -Arguments: -- `bucket_name` (required): N/A -- `file_path` (required): N/A - -Options: -- `--confirm`: Skip confirmation prompt -- `--dry-run`: Show what would be deleted -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets files download`** - -Download a file from a bucket. - -  - Arguments: - BUCKET_NAME: Name of the bucket - REMOTE_PATH: Path to file in bucket - LOCAL_PATH: Local destination path - -  - Examples: - uipath buckets files download my-bucket data.csv ./downloads/data.csv - uipath buckets files download reports monthly/report.pdf ./report.pdf - - -Arguments: -- `bucket_name` (required): N/A -- `remote_path` (required): N/A -- `local_path` (required): N/A - -Options: -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets files exists`** - -Check if a file exists in a bucket. - -  - Arguments: - BUCKET_NAME: Name of the bucket - FILE_PATH: Path to file in bucket - -  - Examples: - uipath buckets files exists my-bucket data.csv - uipath buckets files exists reports monthly/report.pdf - - -Arguments: -- `bucket_name` (required): N/A -- `file_path` (required): N/A - -Options: -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets files list`** - -List files in a bucket. - -  - Arguments: - BUCKET_NAME: Name of the bucket - -  - Examples: - uipath buckets files list my-bucket - uipath buckets files list my-bucket --prefix "data/" - uipath buckets files list reports --limit 10 --format json - uipath buckets files list my-bucket --all - - -Arguments: -- `bucket_name` (required): N/A - -Options: -- `--prefix`: Filter files by prefix (default: ``) -- `--limit`: Maximum number of files to return (default: `Sentinel.UNSET`) -- `--offset`: Number of files to skip (default: `0`) -- `--all`: Fetch all files (auto-paginate) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets files search`** - -Search for files using glob patterns. - - Uses the GetFiles API which supports glob patterns like *.pdf or data_*.csv. - -  - Arguments: - BUCKET_NAME: Name of the bucket - PATTERN: Glob pattern to match files (e.g., "*.pdf", "data_*.csv") - -  - Examples: - uipath buckets files search my-bucket "*.pdf" - uipath buckets files search reports "*.csv" --recursive - uipath buckets files search my-bucket "data_*.json" --prefix "archive/" - - -Arguments: -- `bucket_name` (required): N/A -- `pattern` (required): N/A - -Options: -- `--prefix`: Directory path to search in (default: ``) -- `--recursive`: Search subdirectories recursively -- `--limit`: Maximum number of files to return (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets files upload`** - -Upload a file to a bucket. - -  - Arguments: - BUCKET_NAME: Name of the bucket - LOCAL_PATH: Local file to upload - REMOTE_PATH: Destination path in bucket - -  - Examples: - uipath buckets files upload my-bucket ./data.csv remote/data.csv - uipath buckets files upload reports ./report.pdf monthly/report.pdf - - -Arguments: -- `bucket_name` (required): N/A -- `local_path` (required): N/A -- `remote_path` (required): N/A - -Options: -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets list`** - -List all Buckets. - -Examples: - uipath buckets list - uipath buckets list --folder-path Shared - - -Options: -- `--limit`: Maximum number of items to return (default: `Sentinel.UNSET`) -- `--offset`: Number of items to skip (default: `0`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath buckets retrieve`** - -Retrieve a bucket by name or key. - -  - Examples: - uipath buckets retrieve --name "my-bucket" - uipath buckets retrieve --key "abc-123-def-456" --format json - - -Options: -- `--name`: Bucket name (default: `Sentinel.UNSET`) -- `--key`: Bucket key (UUID) (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - ---- - -### `uipath context-grounding` - -Manage UiPath Context Grounding indexes. - - Context Grounding indexes store and search contextual information - used to enhance AI-enabled automation processes. - -  - Two index types: - Regular - Persistent, backed by bucket or connection, created via 'create' - Ephemeral - Temporary, no Orchestrator folder, created from local files via 'create-ephemeral' - -  - Examples: - uipath context-grounding list --folder-path "Shared" - - -**Subcommands:** - -#### `uipath context-grounding batch-transform` - -Manage Batch Transform tasks. - - Batch Transform processes and transforms CSV files from context - grounding indexes. - -  - Examples: - uipath context-grounding batch-transform start --help - - -**`uipath context-grounding batch-transform download`** - -Download a Batch Transform result file. - -  - Examples: - uipath context-grounding batch-transform download --task-id abc-123 --output-file result.csv - - -Options: -- `--task-id`: ID of the Batch Transform task (default: `Sentinel.UNSET`) -- `--output-file`: Local destination path for the result file (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding batch-transform retrieve`** - -Retrieve a Batch Transform task status. - -  - Examples: - uipath context-grounding batch-transform retrieve --task-id abc-123-def-456 - - -Options: -- `--task-id`: ID of the Batch Transform task (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding batch-transform start`** - -Start a Batch Transform task on an index. - - The index must contain CSV files. Only one file is processed per task. - -  - Two ways to specify the index: - Regular index: --index-name + --folder-path - Ephemeral index: --index-id - -  - --columns-file is a JSON array defining output columns: - [ - {"name": "entity", "description": "Extracted entity name"}, - {"name": "category", "description": "Entity category"} - ] - -  - Examples: - uipath context-grounding batch-transform start --index-name my-index --task-name my-task --prompt "Extract" --columns-file cols.json - uipath context-grounding batch-transform start --index-id abc-123 --task-name my-task --prompt "Extract" --columns-file cols.json - - -Options: -- `--index-name`: Name of the context grounding index (default: `Sentinel.UNSET`) -- `--index-id`: ID of the context grounding index (ephemeral indexes only) (default: `Sentinel.UNSET`) -- `--task-name`: Name for the Batch Transform task (default: `Sentinel.UNSET`) -- `--prompt`: Task prompt describing what to process (default: `Sentinel.UNSET`) -- `--columns-file`: JSON file defining output columns (see format above) (default: `Sentinel.UNSET`) -- `--target-file`: Specific file name to target in the index (default: `Sentinel.UNSET`) -- `--prefix`: Storage bucket folder path prefix for filtering files (default: `Sentinel.UNSET`) -- `--web-search`: Enable web search grounding -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding create`** - -Create a new context grounding index (persistent). - - The created index lives in an Orchestrator folder. Ingestion must be - triggered separately after creation. - -  - Two ways to specify the data source: - --bucket-source Bucket name for bucket-backed indexes - --source-file JSON file for connections (use 'source-schema' to see formats) - -  - Examples: - uipath context-grounding create --index-name my-index --bucket-source my-bucket - uipath context-grounding create --index-name my-index --source-file config.json - - -Options: -- `--index-name`: Name of the index to create (default: `Sentinel.UNSET`) -- `--source-file`: JSON file with connection source configuration (Google Drive, OneDrive, Dropbox, Confluence) (default: `Sentinel.UNSET`) -- `--bucket-source`: Bucket name for bucket-backed indexes (default: `Sentinel.UNSET`) -- `--description`: Description of the index (default: ``) -- `--extraction-strategy`: Extraction strategy (default: LLMV4) (default: `LLMV4`) -- `--file-type`: File type filter (e.g., 'pdf', 'txt') (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding create-ephemeral`** - -Create an ephemeral index from local files (temporary). - - Uploads files as attachments and creates a temporary index. Reference it - in other commands with --index-id (no folder, no name). Ingestion starts - automatically. Poll with 'retrieve --index-id ' until - lastIngestionStatus is Successful before starting a task. - -  - Supported file types: - DeepRAG: PDF, TXT - BatchRAG: CSV - -  - Examples: - uipath context-grounding create-ephemeral --usage DeepRAG --files doc1.pdf --files doc2.pdf - uipath context-grounding create-ephemeral --usage BatchRAG --files data.csv - - -Options: -- `--usage`: Task type for the ephemeral index (default: `Sentinel.UNSET`) -- `--files`: Local file paths to upload as attachments (repeatable) (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -#### `uipath context-grounding deep-rag` - -Manage Deep RAG tasks. - - Deep RAG performs multi-document research and synthesis on context - grounding indexes. - -  - Examples: - uipath context-grounding deep-rag start --help - - -**`uipath context-grounding deep-rag retrieve`** - -Retrieve a Deep RAG task result (status, summary, citations). - -  - Examples: - uipath context-grounding deep-rag retrieve --task-id abc-123-def-456 - - -Options: -- `--task-id`: ID of the Deep RAG task (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding deep-rag start`** - -Start a Deep RAG task on an index. - -  - Two ways to specify the index: - Regular index: --index-name + --folder-path - Ephemeral index: --index-id - -  - Examples: - uipath context-grounding deep-rag start --index-name my-index --folder-path Shared --task-name my-task --prompt "Summarize" - uipath context-grounding deep-rag start --index-id abc-123 --task-name my-task --prompt "Summarize" - - -Options: -- `--index-name`: Name of the context grounding index (default: `Sentinel.UNSET`) -- `--index-id`: ID of the context grounding index (ephemeral indexes only) (default: `Sentinel.UNSET`) -- `--task-name`: Name for the Deep RAG task (default: `Sentinel.UNSET`) -- `--prompt`: Task prompt describing what to research (default: `Sentinel.UNSET`) -- `--glob-pattern`: Glob pattern to filter files in the index (default: **) (default: `**`) -- `--citation-mode`: Citation mode (default: Skip) (default: `Skip`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding delete`** - -Delete a context grounding index. - -  - Examples: - uipath context-grounding delete --index-name my-index --confirm - uipath context-grounding delete --index-name my-index --dry-run - - -Options: -- `--index-name`: Name of the index to delete (default: `Sentinel.UNSET`) -- `--confirm`: Skip confirmation prompt -- `--dry-run`: Show what would be deleted without deleting -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding ingest`** - -Trigger ingestion on a context grounding index. - - Ingestion runs asynchronously. Use 'retrieve' to poll lastIngestionStatus - until it reaches Successful or Failed. - -  - Examples: - uipath context-grounding ingest --index-name my-index --folder-path "Shared" - - -Options: -- `--index-name`: Name of the index to ingest (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding list`** - -List all context grounding indexes. - -  - Examples: - uipath context-grounding list --folder-path "Shared" - - -Options: -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding retrieve`** - -Retrieve a context grounding index. - -  - Two ways to specify the index: - Regular index: --index-name + --folder-path - Ephemeral index: --index-id - -  - Examples: - uipath context-grounding retrieve --index-name my-index --folder-path "Shared" - uipath context-grounding retrieve --index-id abc-123-def-456 --format json - - -Options: -- `--index-name`: Name of the index to retrieve (default: `Sentinel.UNSET`) -- `--index-id`: ID of the index to retrieve (ephemeral indexes only) (default: `Sentinel.UNSET`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding search`** - -Search a context grounding index (regular indexes only). - -  - Examples: - uipath context-grounding search --index-name my-index --query "What is the revenue?" - uipath context-grounding search --index-name my-index --query "results" --limit 5 - - -Options: -- `--index-name`: Name of the index to search (default: `Sentinel.UNSET`) -- `--query`: Search query in natural language (default: `Sentinel.UNSET`) -- `--limit`: Maximum number of results (default: 10) (default: `10`) -- `--threshold`: Minimum similarity threshold (default: 0.0) (default: `0.0`) -- `--search-mode`: Search mode (default: Semantic) (default: `Semantic`) -- `--folder-path`: Folder path (e.g., "Shared"). Can also be set via UIPATH_FOLDER_PATH environment variable. (default: `Sentinel.UNSET`) -- `--folder-key`: Folder key (UUID) (default: `Sentinel.UNSET`) -- `--format`: Output format (overrides global) (default: `Sentinel.UNSET`) -- `--output`, `-o`: Output file (overrides global) (default: `Sentinel.UNSET`) - -**`uipath context-grounding source-schema`** - -Show JSON source file formats for connection-backed indexes. - - Use this to see the required fields for --source-file when creating - an index backed by Google Drive, OneDrive, Dropbox, or Confluence. - -  - Examples: - uipath context-grounding source-schema --type google_drive - - -Options: -- `--type`: Show schema for a specific source type (omit to show all) (default: `Sentinel.UNSET`) - ---- - diff --git a/packages/uipath/src/uipath/_resources/REQUIRED_STRUCTURE.md b/packages/uipath/src/uipath/_resources/REQUIRED_STRUCTURE.md deleted file mode 100644 index 832fe51bf..000000000 --- a/packages/uipath/src/uipath/_resources/REQUIRED_STRUCTURE.md +++ /dev/null @@ -1,64 +0,0 @@ -## Required Agent Structure - -**IMPORTANT**: All UiPath coded agents MUST follow this standard structure unless explicitly specified otherwise by the user. - -### Required Components - -Every agent implementation MUST include these two Pydantic models: - -```python -from pydantic import BaseModel - -class Input(BaseModel): - """Define input fields that the agent accepts""" - # Add your input fields here - pass - -class Output(BaseModel): - """Define output fields that the agent returns""" - # Add your output fields here - pass -``` - -### SDK Initialization - -```python -from uipath.platform import UiPath - -# Initialize with environment variables -uipath = UiPath() - -# With explicit credentials -uipath = UiPath(base_url="https://cloud.uipath.com/...", secret="your_token") - -# Or with client_id and client_secret -uipath = UiPath( - client_id=UIPATH_CLIENT_ID, - client_secret=UIPATH_CLIENT_SECRET, - scope=UIPATH_SCOPE, - base_url=UIPATH_URL -) -``` - -### Standard Agent Template - -Every agent should follow this basic structure: - -```python -from uipath.platform import UiPath -from pydantic import BaseModel - -# 1. Define Input, and Output models -class Input(BaseModel): - field: str - -class Output(BaseModel): - result: str - -# 2. Initialize with environment variables -uipath = UiPath() - -# 3. Define the main function (the main function can be named "main", "run" or "execute") -def main(input_data: Input) -> Output: - pass -``` diff --git a/packages/uipath/src/uipath/_resources/SDK_REFERENCE.md b/packages/uipath/src/uipath/_resources/SDK_REFERENCE.md deleted file mode 100644 index d92dcfded..000000000 --- a/packages/uipath/src/uipath/_resources/SDK_REFERENCE.md +++ /dev/null @@ -1,816 +0,0 @@ -## API Reference - -This section provides a comprehensive reference for all UiPath SDK services and methods. Each service is documented with complete method signatures, including parameter types and return types. - -### SDK Initialization - -Initialize the UiPath SDK client - -```python -from uipath.platform import UiPath - -# Initialize with environment variables -sdk = UiPath() - -# Or with explicit credentials -sdk = UiPath(base_url="https://cloud.uipath.com/...", secret="your_token") -``` - -### Agenthub - -Agenthub service - -```python -# Fetch available models from LLM Gateway discovery endpoint. -sdk.agenthub.get_available_llm_models(headers: dict[str, Any] | None=None) -> list[uipath.platform.agenthub.agenthub.LlmModel] - -# Asynchronously fetch available models from LLM Gateway discovery endpoint. -sdk.agenthub.get_available_llm_models_async(headers: dict[str, Any] | None=None) -> list[uipath.platform.agenthub.agenthub.LlmModel] - -# Start a system agent job. -sdk.agenthub.invoke_system_agent(agent_name: str, entrypoint: str, input_arguments: dict[str, Any] | None=None, folder_key: str | None=None, folder_path: str | None=None, headers: dict[str, Any] | None=None) -> str - -# Asynchronously start a system agent and return the job. -sdk.agenthub.invoke_system_agent_async(agent_name: str, entrypoint: str, input_arguments: dict[str, Any] | None=None, folder_key: str | None=None, folder_path: str | None=None, headers: dict[str, Any] | None=None) -> str - -``` - -### Api Client - -Api Client service - -```python -# Access api_client service methods -service = sdk.api_client - -``` - -### Assets - -Assets service - -```python -# List assets using OData API with offset-based pagination. -sdk.assets.list(folder_path: Optional[str]=None, folder_key: Optional[str]=None, filter: Optional[str]=None, orderby: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.assets.Asset] - -# Asynchronously list assets using OData API with offset-based pagination. -sdk.assets.list_async(folder_path: Optional[str]=None, folder_key: Optional[str]=None, filter: Optional[str]=None, orderby: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.assets.Asset] - -# Retrieve an asset by its name. -sdk.assets.retrieve(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.orchestrator.assets.UserAsset | uipath.platform.orchestrator.assets.Asset - -# Asynchronously retrieve an asset by its name. -sdk.assets.retrieve_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.orchestrator.assets.UserAsset | uipath.platform.orchestrator.assets.Asset - -# Gets a specified Orchestrator credential. -sdk.assets.retrieve_credential(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.Optional[str] - -# Asynchronously gets a specified Orchestrator credential. -sdk.assets.retrieve_credential_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.Optional[str] - -# Update an asset's value. -sdk.assets.update(robot_asset: uipath.platform.orchestrator.assets.UserAsset, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously update an asset's value. -sdk.assets.update_async(robot_asset: uipath.platform.orchestrator.assets.UserAsset, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -``` - -### Attachments - -Attachments service - -```python -# Delete an attachment. -sdk.attachments.delete(key: uuid.UUID, folder_key: str | None=None, folder_path: str | None=None) -> None - -# Delete an attachment asynchronously. -sdk.attachments.delete_async(key: uuid.UUID, folder_key: str | None=None, folder_path: str | None=None) -> None - -# Download an attachment. -sdk.attachments.download(key: uuid.UUID, destination_path: str, folder_key: str | None=None, folder_path: str | None=None) -> str - -# Download an attachment asynchronously. -sdk.attachments.download_async(key: uuid.UUID, destination_path: str, folder_key: str | None=None, folder_path: str | None=None) -> str - -# Get the BlobFileAccess information for an attachment. -sdk.attachments.get_blob_file_access_uri(key: uuid.UUID, folder_key: str | None=None, folder_path: str | None=None) -> uipath.platform.attachments.attachments.BlobFileAccessInfo - -# Get the BlobFileAccess information for an attachment asynchronously. -sdk.attachments.get_blob_file_access_uri_async(key: uuid.UUID, folder_key: str | None=None, folder_path: str | None=None) -> uipath.platform.attachments.attachments.BlobFileAccessInfo - -# Open an attachment. -sdk.attachments.open(attachment: uipath.platform.attachments.attachments.Attachment, mode: typing.Iterator[typing.Tuple[uipath.platform.attachments.attachments.Attachment, httpx.Response]] - -# Open an attachment asynchronously. -sdk.attachments.open_async(attachment: uipath.platform.attachments.attachments.Attachment, mode: typing.AsyncIterator[typing.Tuple[uipath.platform.attachments.attachments.Attachment, httpx.Response]] - -# Upload a file or content to UiPath as an attachment. -sdk.attachments.upload(name: str, content: str | bytes | None=None, source_path: str | None=None, folder_key: str | None=None, folder_path: str | None=None) -> uuid.UUID - -# Upload a file or content to UiPath as an attachment asynchronously. -sdk.attachments.upload_async(name: str, content: str | bytes | None=None, source_path: str | None=None, folder_key: str | None=None, folder_path: str | None=None) -> uuid.UUID - -``` - -### Automation Tracker - -Automation Tracker service - -```python -# End tracking an operation within a transaction. -sdk.automation_tracker.end_operation(transaction_id: str, operation_id: str, name: str, fingerprint: str, parent_operation: Optional[str]=None, status: None - -# End tracking an operation within a transaction (async). -sdk.automation_tracker.end_operation_async(transaction_id: str, operation_id: str, name: str, fingerprint: str, parent_operation: Optional[str]=None, status: None - -# End tracking a business transaction. -sdk.automation_tracker.end_transaction(transaction_id: str, name: str, reference: str, fingerprint: str, status: None - -# End tracking a business transaction (async). -sdk.automation_tracker.end_transaction_async(transaction_id: str, name: str, reference: str, fingerprint: str, status: None - -# Start tracking an operation within a transaction. -sdk.automation_tracker.start_operation(transaction_id: str, operation_id: str, name: str, fingerprint: str, parent_operation: Optional[str]=None, status: None - -# Start tracking an operation within a transaction (async). -sdk.automation_tracker.start_operation_async(transaction_id: str, operation_id: str, name: str, fingerprint: str, parent_operation: Optional[str]=None, status: None - -# Start tracking a business transaction. -sdk.automation_tracker.start_transaction(transaction_id: str, name: str, reference: str, fingerprint: str, status: None - -# Start tracking a business transaction (async). -sdk.automation_tracker.start_transaction_async(transaction_id: str, name: str, reference: str, fingerprint: str, status: None - -``` - -### Buckets - -Buckets service - -```python -# Create a new bucket. -sdk.buckets.create(name: str, description: Optional[str]=None, identifier: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> uipath.platform.orchestrator.buckets.Bucket - -# Async version of create(). -sdk.buckets.create_async(name: str, description: Optional[str]=None, identifier: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> uipath.platform.orchestrator.buckets.Bucket - -# Delete a bucket. -sdk.buckets.delete(name: Optional[str]=None, key: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> None - -# Async version of delete(). -sdk.buckets.delete_async(name: Optional[str]=None, key: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> None - -# Delete a file from a bucket. -sdk.buckets.delete_file(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Delete a file from a bucket asynchronously. -sdk.buckets.delete_file_async(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Download a file from a bucket. -sdk.buckets.download(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, destination_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Download a file from a bucket asynchronously. -sdk.buckets.download_async(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, destination_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Check if bucket exists. -sdk.buckets.exists(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Async version of exists(). -sdk.buckets.exists_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Check if a file exists in a bucket. -sdk.buckets.exists_file(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Async version of exists_file(). -sdk.buckets.exists_file_async(name: Optional[str]=None, key: Optional[str]=None, blob_file_path: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Get files using OData GetFiles API with offset-based pagination. -sdk.buckets.get_files(name: Optional[str]=None, key: Optional[str]=None, prefix: str="", recursive: bool=False, file_name_glob: Optional[str]=None, skip: int=0, top: int=500, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.BucketFile] - -# Async version of get_files() with offset-based pagination. -sdk.buckets.get_files_async(name: Optional[str]=None, key: Optional[str]=None, prefix: str="", recursive: bool=False, file_name_glob: Optional[str]=None, skip: int=0, top: int=500, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.BucketFile] - -# List buckets using OData API with offset-based pagination. -sdk.buckets.list(folder_path: Optional[str]=None, folder_key: Optional[str]=None, name: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.Bucket] - -# Async version of list() with offset-based pagination. -sdk.buckets.list_async(folder_path: Optional[str]=None, folder_key: Optional[str]=None, name: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.Bucket] - -# List files in a bucket using cursor-based pagination. -sdk.buckets.list_files(name: Optional[str]=None, key: Optional[str]=None, prefix: str="", take_hint: int=500, continuation_token: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.BucketFile] - -# Async version of list_files() with cursor-based pagination. -sdk.buckets.list_files_async(name: Optional[str]=None, key: Optional[str]=None, prefix: str="", take_hint: int=500, continuation_token: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.buckets.BucketFile] - -# Retrieve bucket information by its name. -sdk.buckets.retrieve(name: Optional[str]=None, key: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.orchestrator.buckets.Bucket - -# Asynchronously retrieve bucket information by its name. -sdk.buckets.retrieve_async(name: Optional[str]=None, key: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.orchestrator.buckets.Bucket - -# Upload a file to a bucket. -sdk.buckets.upload(key: Optional[str]=None, name: Optional[str]=None, blob_file_path: str, content_type: Optional[str]=None, source_path: Optional[str]=None, content: Union[str, bytes, NoneType]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Upload a file to a bucket asynchronously. -sdk.buckets.upload_async(key: Optional[str]=None, name: Optional[str]=None, blob_file_path: str, content_type: Optional[str]=None, source_path: Optional[str]=None, content: Union[str, bytes, NoneType]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -``` - -### Connections - -Connections service - -```python -# Invoke an activity synchronously. -sdk.connections.invoke_activity(activity_metadata: uipath.platform.connections.connections.ActivityMetadata, connection_id: str, activity_input: Dict[str, Any]) -> typing.Any - -# Invoke an activity asynchronously. -sdk.connections.invoke_activity_async(activity_metadata: uipath.platform.connections.connections.ActivityMetadata, connection_id: str, activity_input: Dict[str, Any]) -> typing.Any - -# Lists all connections with optional filtering. -sdk.connections.list(name: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None, connector_key: Optional[str]=None, skip: Optional[int]=None, top: Optional[int]=None) -> typing.List[uipath.platform.connections.connections.Connection] - -# Asynchronously lists all connections with optional filtering. -sdk.connections.list_async(name: Optional[str]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None, connector_key: Optional[str]=None, skip: Optional[int]=None, top: Optional[int]=None) -> typing.List[uipath.platform.connections.connections.Connection] - -# Synchronously retrieve connection API metadata. -sdk.connections.metadata(element_instance_id: int, connector_key: str, tool_path: str, parameters: Optional[Dict[str, str]]=None, schema_mode: bool=True, max_jit_depth: int=5) -> uipath.platform.connections.connections.ConnectionMetadata - -# Asynchronously retrieve connection API metadata. -sdk.connections.metadata_async(element_instance_id: int, connector_key: str, tool_path: str, parameters: Optional[Dict[str, str]]=None, schema_mode: bool=True, max_jit_depth: int=5) -> uipath.platform.connections.connections.ConnectionMetadata - -# Retrieve connection details by its key. -sdk.connections.retrieve(key: str) -> uipath.platform.connections.connections.Connection - -# Asynchronously retrieve connection details by its key. -sdk.connections.retrieve_async(key: str) -> uipath.platform.connections.connections.Connection - -# Retrieve event payload from UiPath Integration Service. -sdk.connections.retrieve_event_payload(event_args: uipath.platform.connections.connections.EventArguments) -> typing.Dict[str, typing.Any] - -# Retrieve event payload from UiPath Integration Service. -sdk.connections.retrieve_event_payload_async(event_args: uipath.platform.connections.connections.EventArguments) -> typing.Dict[str, typing.Any] - -# Retrieve an authentication token for a connection. -sdk.connections.retrieve_token(key: str, token_type: uipath.platform.connections.connections.ConnectionToken - -# Asynchronously retrieve an authentication token for a connection. -sdk.connections.retrieve_token_async(key: str, token_type: uipath.platform.connections.connections.ConnectionToken - -``` - -### Context Grounding - -Context Grounding service - -```python -# Add content to the index. -sdk.context_grounding.add_to_index(name: str, blob_file_path: str, content_type: Optional[str]=None, content: Union[str, bytes, NoneType]=None, source_path: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, ingest_data: bool=True) -> None - -# Asynchronously add content to the index. -sdk.context_grounding.add_to_index_async(name: str, blob_file_path: str, content_type: Optional[str]=None, content: Union[str, bytes, NoneType]=None, source_path: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, ingest_data: bool=True) -> None - -# Create a new ephemeral context grounding index. -sdk.context_grounding.create_ephemeral_index(usage: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Create a new ephemeral context grounding index. -sdk.context_grounding.create_ephemeral_index_async(usage: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Create a new context grounding index. -sdk.context_grounding.create_index(name: str, source: Union[uipath.platform.context_grounding.context_grounding_payloads.BucketSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.GoogleDriveSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.DropboxSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.OneDriveSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.ConfluenceSourceConfig], description: Optional[str]=None, extraction_strategy: Optional[str]=None, embeddings_enabled: Optional[bool]=None, is_encrypted: Optional[bool]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Create a new context grounding index. -sdk.context_grounding.create_index_async(name: str, source: Union[uipath.platform.context_grounding.context_grounding_payloads.BucketSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.GoogleDriveSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.DropboxSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.OneDriveSourceConfig, uipath.platform.context_grounding.context_grounding_payloads.ConfluenceSourceConfig], description: Optional[str]=None, extraction_strategy: Optional[str]=None, embeddings_enabled: Optional[bool]=None, is_encrypted: Optional[bool]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Delete a context grounding index by its name. -sdk.context_grounding.delete_by_name(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Asynchronously delete a context grounding index by its name. -sdk.context_grounding.delete_by_name_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Delete a context grounding index. -sdk.context_grounding.delete_index(index: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Asynchronously delete a context grounding index. -sdk.context_grounding.delete_index_async(index: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Downloads the Batch Transform result file to the specified path. -sdk.context_grounding.download_batch_transform_result(id: str, destination_path: str, validate_status: bool=True, index_name: str | None=None) -> None - -# Asynchronously downloads the Batch Transform result file to the specified path. -sdk.context_grounding.download_batch_transform_result_async(id: str, destination_path: str, validate_status: bool=True, index_name: str | None=None) -> None - -# Trigger ingestion on a context grounding index by its name. -sdk.context_grounding.ingest_by_name(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Asynchronously trigger ingestion on a context grounding index by its name. -sdk.context_grounding.ingest_by_name_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Ingest data into the context grounding index. -sdk.context_grounding.ingest_data(index: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# Asynchronously ingest data into the context grounding index. -sdk.context_grounding.ingest_data_async(index: uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> None - -# List all context grounding indexes in a folder. -sdk.context_grounding.list(folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# Asynchronously list all context grounding indexes in a folder. -sdk.context_grounding.list_async(folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# List all context grounding indexes in a folder. -sdk.context_grounding.list_indexes(folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# Asynchronously list all context grounding indexes in a folder. -sdk.context_grounding.list_indexes_async(folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# Retrieve context grounding index information by its name. -sdk.context_grounding.retrieve(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Retrieve all context grounding indexes across all folders. -sdk.context_grounding.retrieve_across_folders(name: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# Asynchronously retrieve all context grounding indexes across all folders. -sdk.context_grounding.retrieve_across_folders_async(name: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex] - -# Asynchronously retrieve context grounding index information by its name. -sdk.context_grounding.retrieve_async(name: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uipath.platform.context_grounding.context_grounding_index.ContextGroundingIndex - -# Retrieves a Batch Transform task status. -sdk.context_grounding.retrieve_batch_transform(id: str, index_name: str | None=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformResponse - -# Asynchronously retrieves a Batch Transform task status. -sdk.context_grounding.retrieve_batch_transform_async(id: str, index_name: str | None=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformResponse - -# Retrieve context grounding index information by its ID. -sdk.context_grounding.retrieve_by_id(id: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.Any - -# Retrieve asynchronously context grounding index information by its ID. -sdk.context_grounding.retrieve_by_id_async(id: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.Any - -# Retrieves a Deep RAG task. -sdk.context_grounding.retrieve_deep_rag(id: str, index_name: str | None=None) -> uipath.platform.context_grounding.context_grounding.DeepRagResponse - -# Asynchronously retrieves a Deep RAG task. -sdk.context_grounding.retrieve_deep_rag_async(id: str, index_name: str | None=None) -> uipath.platform.context_grounding.context_grounding.DeepRagResponse - -# Search for contextual information within a specific index. -sdk.context_grounding.search(name: str, query: str, number_of_results: int=10, threshold: Optional[float]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding.ContextGroundingQueryResponse] - -# Search asynchronously for contextual information within a specific index. -sdk.context_grounding.search_async(name: str, query: str, number_of_results: int=10, threshold: Optional[float]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[uipath.platform.context_grounding.context_grounding.ContextGroundingQueryResponse] - -# Starts a Batch Transform, task on the targeted index. -sdk.context_grounding.start_batch_transform(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], output_columns: List[uipath.platform.context_grounding.context_grounding.BatchTransformOutputColumn], storage_bucket_folder_path_prefix: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, target_file_name: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, enable_web_search_grounding: bool=False, index_name: str | None=None, index_id: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]]=None, folder_key: str | None=None, folder_path: str | None=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformCreationResponse - -# Asynchronously starts a Batch Transform, task on the targeted index. -sdk.context_grounding.start_batch_transform_async(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], output_columns: List[uipath.platform.context_grounding.context_grounding.BatchTransformOutputColumn], storage_bucket_folder_path_prefix: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, target_file_name: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, enable_web_search_grounding: bool=False, index_name: str | None=None, index_id: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]]=None, folder_key: str | None=None, folder_path: str | None=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformCreationResponse - -# Asynchronously starts a Batch Transform, task on the targeted index. -sdk.context_grounding.start_batch_transform_ephemeral(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], output_columns: List[uipath.platform.context_grounding.context_grounding.BatchTransformOutputColumn], storage_bucket_folder_path_prefix: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, enable_web_search_grounding: bool=False, index_id: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]]=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformCreationResponse - -# Asynchronously starts a Batch Transform, task on the targeted index. -sdk.context_grounding.start_batch_transform_ephemeral_async(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], output_columns: List[uipath.platform.context_grounding.context_grounding.BatchTransformOutputColumn], storage_bucket_folder_path_prefix: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]=None, enable_web_search_grounding: bool=False, index_id: Optional[Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=512)])]]=None) -> uipath.platform.context_grounding.context_grounding.BatchTransformCreationResponse - -# Starts a Deep RAG task on the targeted index. -sdk.context_grounding.start_deep_rag(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], glob_pattern: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='*', metadata=[MaxLen(max_length=512)])]="**", citation_mode: uipath.platform.context_grounding.context_grounding.DeepRagCreationResponse - -# Asynchronously starts a Deep RAG task on the targeted index. -sdk.context_grounding.start_deep_rag_async(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], glob_pattern: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='*', metadata=[MaxLen(max_length=512)])]="**", citation_mode: uipath.platform.context_grounding.context_grounding.DeepRagCreationResponse - -# Asynchronously starts a Deep RAG task on the targeted index. -sdk.context_grounding.start_deep_rag_ephemeral(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], glob_pattern: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='*', metadata=[MaxLen(max_length=512)])]="**", citation_mode: uipath.platform.context_grounding.context_grounding.DeepRagCreationResponse - -# Asynchronously starts a Deep RAG task on the targeted index. -sdk.context_grounding.start_deep_rag_ephemeral_async(name: str, prompt: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MaxLen(max_length=250000)])], glob_pattern: Annotated[str, FieldInfo(annotation=NoneType, required=False, default='*', metadata=[MaxLen(max_length=512)])]="**", citation_mode: uipath.platform.context_grounding.context_grounding.DeepRagCreationResponse - -# Perform a unified search on a context grounding index. -sdk.context_grounding.unified_search(name: str, query: str, search_mode: uipath.platform.context_grounding.context_grounding.UnifiedQueryResult - -# Asynchronously perform a unified search on a context grounding index. -sdk.context_grounding.unified_search_async(name: str, query: str, search_mode: uipath.platform.context_grounding.context_grounding.UnifiedQueryResult - -``` - -### Conversational - -Conversational service - -```python -# Access conversational service methods -service = sdk.conversational - -``` - -### Documents - -Documents service - -```python -# Classify a document using a DU Modern project. -sdk.documents.classify(project_type: typing.List[uipath.platform.documents.documents.ClassificationResult] - -# Asynchronously version of the [`classify`][uipath.platform.documents._documents_service.DocumentsService.classify] method. -sdk.documents.classify_async(project_type: typing.List[uipath.platform.documents.documents.ClassificationResult] - -# Create a validate classification action for a document based on the classification results. More details about validation actions can be found in the [official documentation](https://docs.uipath.com/ixp/automation-cloud/latest/user-guide/validating-classifications). -sdk.documents.create_validate_classification_action(classification_results: List[uipath.platform.documents.documents.ClassificationResult], action_title: str, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_catalog: Optional[str]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.ValidateClassificationAction - -# Asynchronous version of the [`create_validation_action`][uipath.platform.documents._documents_service.DocumentsService.create_validate_classification_action] method. -sdk.documents.create_validate_classification_action_async(classification_results: List[uipath.platform.documents.documents.ClassificationResult], action_title: str, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_catalog: Optional[str]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.ValidateClassificationAction - -# Create a validate extraction action for a document based on the extraction response. More details about validation actions can be found in the [official documentation](https://docs.uipath.com/ixp/automation-cloud/latest/user-guide/validating-extractions). -sdk.documents.create_validate_extraction_action(extraction_response: uipath.platform.documents.documents.ExtractionResponse, action_title: str, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_catalog: Optional[str]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.ValidateExtractionAction - -# Asynchronous version of the [`create_validation_action`][uipath.platform.documents._documents_service.DocumentsService.create_validate_extraction_action] method. -sdk.documents.create_validate_extraction_action_async(extraction_response: uipath.platform.documents.documents.ExtractionResponse, action_title: str, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_catalog: Optional[str]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.ValidateExtractionAction - -# Extract predicted data from a document using an DU Modern/IXP project. -sdk.documents.extract(tag: Optional[str]=None, version: Optional[int]=None, project_name: Optional[str]=None, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, classification_result: Optional[uipath.platform.documents.documents.ClassificationResult]=None, project_type: Optional[uipath.platform.documents.documents.ProjectType]=None, document_type_name: Optional[str]=None) -> typing.Union[uipath.platform.documents.documents.ExtractionResponse, uipath.platform.documents.documents.ExtractionResponseIXP] - -# Asynchronously version of the [`extract`][uipath.platform.documents._documents_service.DocumentsService.extract] method. -sdk.documents.extract_async(tag: Optional[str]=None, version: Optional[int]=None, project_name: Optional[str]=None, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None, classification_result: Optional[uipath.platform.documents.documents.ClassificationResult]=None, project_type: Optional[uipath.platform.documents.documents.ProjectType]=None, document_type_name: Optional[str]=None) -> typing.Union[uipath.platform.documents.documents.ExtractionResponse, uipath.platform.documents.documents.ExtractionResponseIXP] - -# Get the result of a validate classification action. -sdk.documents.get_validate_classification_result(validation_action: uipath.platform.documents.documents.ValidateClassificationAction) -> typing.List[uipath.platform.documents.documents.ClassificationResult] - -# Asynchronous version of the [`get_validation_result`][uipath.platform.documents._documents_service.DocumentsService.get_validate_classification_result] method. -sdk.documents.get_validate_classification_result_async(validation_action: uipath.platform.documents.documents.ValidateClassificationAction) -> typing.List[uipath.platform.documents.documents.ClassificationResult] - -# Get the result of a validate extraction action. -sdk.documents.get_validate_extraction_result(validation_action: uipath.platform.documents.documents.ValidateExtractionAction) -> typing.Union[uipath.platform.documents.documents.ExtractionResponse, uipath.platform.documents.documents.ExtractionResponseIXP] - -# Asynchronous version of the [`get_validation_result`][uipath.platform.documents._documents_service.DocumentsService.get_validate_extraction_result] method. -sdk.documents.get_validate_extraction_result_async(validation_action: uipath.platform.documents.documents.ValidateExtractionAction) -> typing.Union[uipath.platform.documents.documents.ExtractionResponse, uipath.platform.documents.documents.ExtractionResponseIXP] - -# Retrieve the result of an IXP extraction operation (single-shot, non-blocking). -sdk.documents.retrieve_ixp_extraction_result(project_id: str, tag: str, operation_id: str) -> uipath.platform.documents.documents.ExtractionResponseIXP - -# Asynchronous version of the [`retrieve_ixp_extraction_result`][uipath.platform.documents._documents_service.DocumentsService.retrieve_ixp_extraction_result] method. -sdk.documents.retrieve_ixp_extraction_result_async(project_id: str, tag: str, operation_id: str) -> uipath.platform.documents.documents.ExtractionResponseIXP - -# Retrieve the result of an IXP create validate extraction action operation (single-shot, non-blocking). -sdk.documents.retrieve_ixp_extraction_validation_result(project_id: str, tag: str, operation_id: str) -> uipath.platform.documents.documents.ValidateExtractionAction - -# Asynchronous version of the [`retrieve_ixp_extraction_validation_result`][uipath.platform.documents._documents_service.DocumentsService.retrieve_ixp_extraction_validation_result] method. -sdk.documents.retrieve_ixp_extraction_validation_result_async(project_id: str, tag: str, operation_id: str) -> uipath.platform.documents.documents.ValidateExtractionAction - -# Start an IXP extraction process without waiting for results (non-blocking). -sdk.documents.start_ixp_extraction(project_name: str, tag: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None) -> uipath.platform.documents.documents.StartExtractionResponse - -# Asynchronous version of the [`start_ixp_extraction`][uipath.platform.documents._documents_service.DocumentsService.start_ixp_extraction] method. -sdk.documents.start_ixp_extraction_async(project_name: str, tag: str, file: Union[IO[bytes], bytes, str, NoneType]=None, file_path: Optional[str]=None) -> uipath.platform.documents.documents.StartExtractionResponse - -# Start an IXP extraction validation action without waiting for results (non-blocking). -sdk.documents.start_ixp_extraction_validation(extraction_response: uipath.platform.documents.documents.ExtractionResponseIXP, action_title: str, action_catalog: Optional[str]=None, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.StartExtractionValidationResponse - -# Asynchronous version of the [`start_ixp_extraction_validation`][uipath.platform.documents._documents_service.DocumentsService.start_ixp_extraction_validation] method. -sdk.documents.start_ixp_extraction_validation_async(extraction_response: uipath.platform.documents.documents.ExtractionResponseIXP, action_title: str, action_catalog: Optional[str]=None, action_priority: Optional[uipath.platform.documents.documents.ActionPriority]=None, action_folder: Optional[str]=None, storage_bucket_name: Optional[str]=None, storage_bucket_directory_path: Optional[str]=None) -> uipath.platform.documents.documents.StartExtractionValidationResponse - -``` - -### Entities - -Entities service - -```python -# Delete multiple records from an entity in a single batch operation. -sdk.entities.delete_records(entity_key: str, record_ids: List[str]) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - -# Asynchronously delete multiple records from an entity in a single batch operation. -sdk.entities.delete_records_async(entity_key: str, record_ids: List[str]) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - -# Insert multiple records into an entity in a single batch operation. -sdk.entities.insert_records(entity_key: str, records: List[Any], schema: Optional[Type[Any]]=None) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - -# Asynchronously insert multiple records into an entity in a single batch operation. -sdk.entities.insert_records_async(entity_key: str, records: List[Any], schema: Optional[Type[Any]]=None) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - -# List all entities in Data Service. -sdk.entities.list_entities() -> typing.List[uipath.platform.entities.entities.Entity] - -# Asynchronously list all entities in the Data Service. -sdk.entities.list_entities_async() -> typing.List[uipath.platform.entities.entities.Entity] - -# List records from an entity with optional pagination and schema validation. -sdk.entities.list_records(entity_key: str, schema: Optional[Type[Any]]=None, start: Optional[int]=None, limit: Optional[int]=None) -> typing.List[uipath.platform.entities.entities.EntityRecord] - -# Asynchronously list records from an entity with optional pagination and schema validation. -sdk.entities.list_records_async(entity_key: str, schema: Optional[Type[Any]]=None, start: Optional[int]=None, limit: Optional[int]=None) -> typing.List[uipath.platform.entities.entities.EntityRecord] - -# Query entity records using a validated SQL query. -sdk.entities.query_entity_records(sql_query: str) -> typing.List[typing.Dict[str, typing.Any]] - -# Asynchronously query entity records using a validated SQL query. -sdk.entities.query_entity_records_async(sql_query: str) -> typing.List[typing.Dict[str, typing.Any]] - -# Resolve an agent entity set, applying resource overwrites. -sdk.entities.resolve_entity_set(items: list[uipath.platform.entities.entities.DataFabricEntityItem]) -> uipath.platform.entities.entities.EntitySetResolution - -# Resolve an agent entity set, applying resource overwrites. -sdk.entities.resolve_entity_set_async(items: list[uipath.platform.entities.entities.DataFabricEntityItem]) -> uipath.platform.entities.entities.EntitySetResolution - -# Retrieve an entity by its key. -sdk.entities.retrieve(entity_key: str) -> uipath.platform.entities.entities.Entity - -# Asynchronously retrieve an entity by its key. -sdk.entities.retrieve_async(entity_key: str) -> uipath.platform.entities.entities.Entity - -# Retrieve an entity by its name. -sdk.entities.retrieve_by_name(entity_name: str, folder_key: Optional[str]=None) -> uipath.platform.entities.entities.Entity - -# Asynchronously retrieve an entity by its name. -sdk.entities.retrieve_by_name_async(entity_name: str, folder_key: Optional[str]=None) -> uipath.platform.entities.entities.Entity - -# Update multiple records in an entity in a single batch operation. -sdk.entities.update_records(entity_key: str, records: List[Any], schema: Optional[Type[Any]]=None) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - -# Asynchronously update multiple records in an entity in a single batch operation. -sdk.entities.update_records_async(entity_key: str, records: List[Any], schema: Optional[Type[Any]]=None) -> uipath.platform.entities.entities.EntityRecordsBatchResponse - - -``` - -### Folders - -Folders service - -```python -# Retrieve the personal workspace folder for the current user. -sdk.folders.get_personal_workspace() -> uipath.platform.orchestrator.folder.PersonalWorkspace - -# Asynchronously retrieve the personal workspace folder for the current user. -sdk.folders.get_personal_workspace_async() -> uipath.platform.orchestrator.folder.PersonalWorkspace - -# Resolve a folder path to its corresponding folder key. -sdk.folders.retrieve_folder_key(folder_path: str | None) -> str | None - -# Asynchronously resolve a folder path to its corresponding folder key. -sdk.folders.retrieve_folder_key_async(folder_path: str | None) -> str | None - -# Retrieve the folder key by folder path with pagination support. -sdk.folders.retrieve_key(folder_path: str) -> typing.Optional[str] - -# Retrieve the folder key by folder path with pagination support. -sdk.folders.retrieve_key_async(folder_path: str) -> typing.Optional[str] - -``` - -### Guardrails - -Guardrails service - -```python -# Validate input text using the provided guardrail. -sdk.guardrails.evaluate_guardrail(input_data: str | dict[str, Any], guardrail: uipath.platform.guardrails.guardrails.BuiltInValidatorGuardrail) -> uipath.core.guardrails.guardrails.GuardrailValidationResult - -``` - -### Jobs - -Jobs service - -```python -# Create and upload an attachment, optionally linking it to a job. -sdk.jobs.create_attachment(name: str, content: Union[str, bytes, NoneType]=None, source_path: Union[str, pathlib.Path, NoneType]=None, job_key: Union[str, uuid.UUID, NoneType]=None, category: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uuid.UUID - -# Create and upload an attachment asynchronously, optionally linking it to a job. -sdk.jobs.create_attachment_async(name: str, content: Union[str, bytes, NoneType]=None, source_path: Union[str, pathlib.Path, NoneType]=None, job_key: Union[str, uuid.UUID, NoneType]=None, category: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> uuid.UUID - -# Check if job exists. -sdk.jobs.exists(job_key: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Async version of exists(). -sdk.jobs.exists_async(job_key: str, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> bool - -# Get the actual output data, downloading from attachment if necessary. -sdk.jobs.extract_output(job: uipath.platform.orchestrator.job.Job) -> typing.Optional[str] - -# Asynchronously fetch the actual output data, downloading from attachment if necessary. -sdk.jobs.extract_output_async(job: uipath.platform.orchestrator.job.Job) -> typing.Optional[str] - -# Link an attachment to a job. -sdk.jobs.link_attachment(attachment_key: uuid.UUID, job_key: uuid.UUID, category: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) - -# Link an attachment to a job asynchronously. -sdk.jobs.link_attachment_async(attachment_key: uuid.UUID, job_key: uuid.UUID, category: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) - -# List jobs using OData API with offset-based pagination. -sdk.jobs.list(folder_path: Optional[str]=None, folder_key: Optional[str]=None, filter: Optional[str]=None, orderby: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.job.Job] - -# Async version of list() with offset-based pagination. -sdk.jobs.list_async(folder_path: Optional[str]=None, folder_key: Optional[str]=None, filter: Optional[str]=None, orderby: Optional[str]=None, skip: int=0, top: int=100) -> uipath.platform.common.paging.PagedResult[uipath.platform.orchestrator.job.Job] - -# List attachments associated with a specific job. -sdk.jobs.list_attachments(job_key: uuid.UUID, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[str] - -# List attachments associated with a specific job asynchronously. -sdk.jobs.list_attachments_async(job_key: uuid.UUID, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> typing.List[str] - -# Restart a completed or failed job. -sdk.jobs.restart(job_key: str, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> uipath.platform.orchestrator.job.Job - -# Async version of restart(). -sdk.jobs.restart_async(job_key: str, folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> uipath.platform.orchestrator.job.Job - -# Sends a payload to resume a paused job waiting for input, identified by its inbox ID. -sdk.jobs.resume(inbox_id: Optional[str]=None, job_id: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, payload: Any) -> None - -# Asynchronously sends a payload to resume a paused job waiting for input, identified by its inbox ID. -sdk.jobs.resume_async(inbox_id: Optional[str]=None, job_id: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, payload: Any) -> None - -# Retrieve a job identified by its key. -sdk.jobs.retrieve(job_key: str, folder_key: str | None=None, folder_path: str | None=None, process_name: str | None=None) -> uipath.platform.orchestrator.job.Job - -# Fetch payload data for API triggers. -sdk.jobs.retrieve_api_payload(inbox_id: str) -> typing.Any - -# Asynchronously fetch payload data for API triggers. -sdk.jobs.retrieve_api_payload_async(inbox_id: str) -> typing.Any - -# Asynchronously retrieve a job identified by its key. -sdk.jobs.retrieve_async(job_key: str, folder_key: str | None=None, folder_path: str | None=None, process_name: str | None=None) -> uipath.platform.orchestrator.job.Job - -# Stop one or more jobs with specified strategy. -sdk.jobs.stop(job_keys: List[str], strategy: str="SoftStop", folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> None - -# Async version of stop(). -sdk.jobs.stop_async(job_keys: List[str], strategy: str="SoftStop", folder_path: Optional[str]=None, folder_key: Optional[str]=None) -> None - -``` - -### Llm - -Llm service - -```python -# Generate chat completions using UiPath's normalized LLM Gateway API. -sdk.llm.chat_completions(messages: list[dict[str, str]] | list[tuple[str, str]], model: str="gpt-4.1-mini-2025-04-14", max_tokens: int=4096, temperature: float=0, n: int=1, frequency_penalty: float=0, presence_penalty: float=0, top_p: float | None=1, top_k: int | None=None, tools: list[uipath.platform.chat.llm_gateway.ToolDefinition] | None=None, tool_choice: Union[uipath.platform.chat.llm_gateway.AutoToolChoice, uipath.platform.chat.llm_gateway.RequiredToolChoice, uipath.platform.chat.llm_gateway.SpecificToolChoice, Literal['auto', 'none'], NoneType]=None, response_format: dict[str, Any] | type[pydantic.main.BaseModel] | None=None, api_version: str="2024-08-01-preview") - -``` - -### Llm Openai - -Llm Openai service - -```python -# Generate chat completions using UiPath's LLM Gateway service. -sdk.llm_openai.chat_completions(messages: list[dict[str, str]], model: str="gpt-4.1-mini-2025-04-14", max_tokens: int=4096, temperature: float=0, response_format: dict[str, Any] | type[pydantic.main.BaseModel] | None=None, api_version: str="2024-10-21") - -# Generate text embeddings using UiPath's LLM Gateway service. -sdk.llm_openai.embeddings(input: str, embedding_model: str="text-embedding-ada-002", openai_api_version: str="2024-10-21") - -``` - -### Mcp - -Mcp service - -```python -# List all MCP servers. -sdk.mcp.list(folder_path: str | None=None) -> typing.List[uipath.platform.orchestrator.mcp.McpServer] - -# Asynchronously list all MCP servers. -sdk.mcp.list_async(folder_path: str | None=None) -> typing.List[uipath.platform.orchestrator.mcp.McpServer] - -# Retrieve a specific MCP server by its slug. -sdk.mcp.retrieve(slug: str, folder_path: str | None=None) -> uipath.platform.orchestrator.mcp.McpServer - -# Asynchronously retrieve a specific MCP server by its slug. -sdk.mcp.retrieve_async(slug: str, folder_path: str | None=None) -> uipath.platform.orchestrator.mcp.McpServer - -``` - -### Orchestrator Setup - -Orchestrator Setup service - -```python -# Fire-and-forget POST requests to enable first run for StudioWeb. -sdk.orchestrator_setup.enable_first_run() -> None - -# Fire-and-forget POST requests to enable first run for StudioWeb. -sdk.orchestrator_setup.enable_first_run_async() -> None - -``` - -### Processes - -Processes service - -```python -# Start execution of a process by its name. -sdk.processes.invoke(name: str, input_arguments: Optional[Dict[str, Any]]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, attachments: Optional[list[uipath.platform.attachments.attachments.Attachment]]=None, parent_operation_id: Optional[str]=None, **kwargs) -> uipath.platform.orchestrator.job.Job - -# Asynchronously start execution of a process by its name. -sdk.processes.invoke_async(name: str, input_arguments: Optional[Dict[str, Any]]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None, attachments: Optional[list[uipath.platform.attachments.attachments.Attachment]]=None, parent_operation_id: Optional[str]=None, **kwargs) -> uipath.platform.orchestrator.job.Job - -``` - -### Queues - -Queues service - -```python -# Completes a transaction item with the specified result. -sdk.queues.complete_transaction_item(transaction_key: str, result: Union[Dict[str, Any], uipath.platform.orchestrator.queues.TransactionItemResult], queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously completes a transaction item with the specified result. -sdk.queues.complete_transaction_item_async(transaction_key: str, result: Union[Dict[str, Any], uipath.platform.orchestrator.queues.TransactionItemResult], queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Creates a new queue item in the Orchestrator. -sdk.queues.create_item(item: Union[Dict[str, Any], uipath.platform.orchestrator.queues.QueueItem], queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously creates a new queue item in the Orchestrator. -sdk.queues.create_item_async(item: Union[Dict[str, Any], uipath.platform.orchestrator.queues.QueueItem], queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Creates multiple queue items in bulk. -sdk.queues.create_items(items: List[Union[Dict[str, Any], uipath.platform.orchestrator.queues.QueueItem]], queue_name: str, commit_type: httpx.Response - -# Asynchronously creates multiple queue items in bulk. -sdk.queues.create_items_async(items: List[Union[Dict[str, Any], uipath.platform.orchestrator.queues.QueueItem]], queue_name: str, commit_type: httpx.Response - -# Creates a new transaction item in a queue. -sdk.queues.create_transaction_item(item: Union[Dict[str, Any], uipath.platform.orchestrator.queues.TransactionItem], queue_name: Optional[str]=None, no_robot: bool=False, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously creates a new transaction item in a queue. -sdk.queues.create_transaction_item_async(item: Union[Dict[str, Any], uipath.platform.orchestrator.queues.TransactionItem], queue_name: Optional[str]=None, no_robot: bool=False, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Retrieves a list of queue items from the Orchestrator. -sdk.queues.list_items(queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously retrieves a list of queue items from the Orchestrator. -sdk.queues.list_items_async(queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Updates the progress of a transaction item. -sdk.queues.update_progress_of_transaction_item(transaction_key: str, progress: str, queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -# Asynchronously updates the progress of a transaction item. -sdk.queues.update_progress_of_transaction_item_async(transaction_key: str, progress: str, queue_name: Optional[str]=None, folder_key: Optional[str]=None, folder_path: Optional[str]=None) -> httpx.Response - -``` - -### Remote A2A - -Remote A2A service - -```python -# List Remote A2A agents. -sdk.remote_a2a.list(top: int | None=None, skip: int | None=None, search: str | None=None, folder_path: str | None=None) -> typing.List[uipath.platform.agenthub.remote_a2a.RemoteA2aAgent] - -# Asynchronously list Remote A2A agents. -sdk.remote_a2a.list_async(top: int | None=None, skip: int | None=None, search: str | None=None, folder_path: str | None=None) -> typing.List[uipath.platform.agenthub.remote_a2a.RemoteA2aAgent] - -# Retrieve a specific Remote A2A agent by slug. -sdk.remote_a2a.retrieve(slug: str, folder_path: str | None=None) -> uipath.platform.agenthub.remote_a2a.RemoteA2aAgent - -# Asynchronously retrieve a specific Remote A2A agent by slug. -sdk.remote_a2a.retrieve_async(slug: str, folder_path: str | None=None) -> uipath.platform.agenthub.remote_a2a.RemoteA2aAgent - -``` - -### Resource Catalog - -Resource Catalog service - -```python -# Get tenant scoped resources and folder scoped resources (accessible to the user). -sdk.resource_catalog.list(resource_types: Optional[List[uipath.platform.resource_catalog.resource_catalog.ResourceType]]=None, resource_sub_types: Optional[List[str]]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None, page_size: int=20) -> typing.Iterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -# Asynchronously get tenant scoped resources and folder scoped resources (accessible to the user). -sdk.resource_catalog.list_async(resource_types: Optional[List[uipath.platform.resource_catalog.resource_catalog.ResourceType]]=None, resource_sub_types: Optional[List[str]]=None, folder_path: Optional[str]=None, folder_key: Optional[str]=None, page_size: int=20) -> typing.AsyncIterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -# Get resources of a specific type (tenant scoped or folder scoped). -sdk.resource_catalog.list_by_type(resource_type: typing.Iterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -# Asynchronously get resources of a specific type (tenant scoped or folder scoped). -sdk.resource_catalog.list_by_type_async(resource_type: typing.AsyncIterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -# Search for tenant scoped resources and folder scoped resources (accessible to the user). -sdk.resource_catalog.search(name: Optional[str]=None, resource_types: Optional[List[uipath.platform.resource_catalog.resource_catalog.ResourceType]]=None, resource_sub_types: Optional[List[str]]=None, page_size: int=20) -> typing.Iterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -# Asynchronously search for tenant scoped resources and folder scoped resources (accessible to the user). -sdk.resource_catalog.search_async(name: Optional[str]=None, resource_types: Optional[List[uipath.platform.resource_catalog.resource_catalog.ResourceType]]=None, resource_sub_types: Optional[List[str]]=None, page_size: int=20) -> typing.AsyncIterator[uipath.platform.resource_catalog.resource_catalog.Resource] - -``` - -### Tasks - -Tasks service - -```python -# Creates a new task synchronously. -sdk.tasks.create(title: str, data: Optional[Dict[str, Any]]=None, app_name: Optional[str]=None, app_key: Optional[str]=None, app_folder_path: Optional[str]=None, app_folder_key: Optional[str]=None, assignee: Optional[str]=None, recipient: Optional[uipath.platform.action_center.tasks.TaskRecipient]=None, priority: Optional[str]=None, labels: Optional[List[str]]=None, is_actionable_message_enabled: Optional[bool]=None, actionable_message_metadata: Optional[Dict[str, Any]]=None, source_name: str="Agent") -> uipath.platform.action_center.tasks.Task - -# Creates a new action asynchronously. -sdk.tasks.create_async(title: str, data: Optional[Dict[str, Any]]=None, app_name: Optional[str]=None, app_key: Optional[str]=None, app_folder_path: Optional[str]=None, app_folder_key: Optional[str]=None, assignee: Optional[str]=None, recipient: Optional[uipath.platform.action_center.tasks.TaskRecipient]=None, priority: Optional[str]=None, labels: Optional[List[str]]=None, is_actionable_message_enabled: Optional[bool]=None, actionable_message_metadata: Optional[Dict[str, Any]]=None, source_name: str="Agent") -> uipath.platform.action_center.tasks.Task - -# Retrieves a task by its key synchronously. -sdk.tasks.retrieve(action_key: str, app_folder_path: Optional[str]=None, app_folder_key: Optional[str]=None, app_name: str | None=None) -> uipath.platform.action_center.tasks.Task - -# Retrieves a task by its key asynchronously. -sdk.tasks.retrieve_async(action_key: str, app_folder_path: Optional[str]=None, app_folder_key: Optional[str]=None, app_name: str | None=None) -> uipath.platform.action_center.tasks.Task - -``` - diff --git a/packages/uipath/src/uipath/_resources/eval.md b/packages/uipath/src/uipath/_resources/eval.md deleted file mode 100644 index 15fa04f7c..000000000 --- a/packages/uipath/src/uipath/_resources/eval.md +++ /dev/null @@ -1,287 +0,0 @@ ---- -allowed-tools: Bash, Read, Write, Edit, Glob -description: Create and run agent evaluations ---- - -I'll help you create and run evaluations for your UiPath agent. - -## Step 1: Check project setup - -Let me check your project structure: - -!ls -la evaluations/ entry-points.json 2>/dev/null || echo "NEEDS_SETUP" - -# Check if schemas might be stale (main.py newer than entry-points.json) -!if [ -f main.py ] && [ -f entry-points.json ] && [ main.py -nt entry-points.json ]; then echo "SCHEMAS_MAY_BE_STALE"; fi - -### If NEEDS_SETUP - -If `entry-points.json` doesn't exist, initialize the project first: - -!uv run uipath init - -Then re-run this skill. - -### If SCHEMAS_MAY_BE_STALE - -Your `main.py` is newer than `entry-points.json`. Refresh schemas: - -!uv run uipath init --no-agents-md-override - -## Step 2: What would you like to do? - -1. **Create new eval set** - Set up evaluations from scratch -2. **Add test case** - Add a test to existing eval set -3. **Run evaluations** - Execute tests and see results -4. **Analyze failures** - Debug failing tests - ---- - -## Creating an Eval Set - -First, create the directory structure: - -!mkdir -p evaluations/eval-sets evaluations/evaluators - -Read the agent's Input/Output schema from entry-points.json to understand the data types. - -### Evaluator Selection Guide - -| If your output is... | Use this evaluator | evaluatorTypeId | -|---------------------|-------------------|-----------------| -| Exact string/number | `ExactMatchEvaluator` | `uipath-exact-match` | -| Contains key phrases | `ContainsEvaluator` | `uipath-contains` | -| Semantically correct | `LLMJudgeOutputEvaluator` | `uipath-llm-judge-output-semantic-similarity` | -| JSON with numbers | `JsonSimilarityEvaluator` | `uipath-json-similarity` | - -### Step 1: Create Evaluator Config Files - -**Each evaluator needs a JSON config file** in `evaluations/evaluators/`. - -**ExactMatchEvaluator** (`evaluations/evaluators/exact-match.json`): -```json -{ - "version": "1.0", - "id": "ExactMatchEvaluator", - "name": "ExactMatchEvaluator", - "description": "Checks for exact output match", - "evaluatorTypeId": "uipath-exact-match", - "evaluatorConfig": { - "name": "ExactMatchEvaluator", - "targetOutputKey": "*" - } -} -``` - -**LLMJudgeOutputEvaluator** (`evaluations/evaluators/llm-judge-output.json`): -```json -{ - "version": "1.0", - "id": "LLMJudgeOutputEvaluator", - "name": "LLMJudgeOutputEvaluator", - "description": "Uses LLM to judge semantic similarity", - "evaluatorTypeId": "uipath-llm-judge-output-semantic-similarity", - "evaluatorConfig": { - "name": "LLMJudgeOutputEvaluator", - "model": "gpt-4o-mini-2024-07-18" - } -} -``` - -**JsonSimilarityEvaluator** (`evaluations/evaluators/json-similarity.json`): -```json -{ - "version": "1.0", - "id": "JsonSimilarityEvaluator", - "name": "JsonSimilarityEvaluator", - "description": "Compares JSON structures", - "evaluatorTypeId": "uipath-json-similarity", - "evaluatorConfig": { - "name": "JsonSimilarityEvaluator", - "targetOutputKey": "*" - } -} -``` - -**ContainsEvaluator** (`evaluations/evaluators/contains.json`): -```json -{ - "version": "1.0", - "id": "ContainsEvaluator", - "name": "ContainsEvaluator", - "description": "Checks if output contains text", - "evaluatorTypeId": "uipath-contains", - "evaluatorConfig": { - "name": "ContainsEvaluator" - } -} -``` - -### Step 2: Create Eval Set - -**Eval Set Template** (`evaluations/eval-sets/default.json`): -```json -{ - "version": "1.0", - "id": "default-eval-set", - "name": "Default Evaluation Set", - "evaluatorRefs": ["ExactMatchEvaluator"], - "evaluations": [ - { - "id": "test-1", - "name": "Test description", - "inputs": { - "field": "value" - }, - "evaluationCriterias": { - "ExactMatchEvaluator": { - "expectedOutput": { - "result": "expected value" - } - } - } - } - ] -} -``` - -**Important notes:** -- `evaluatorRefs` must list ALL evaluators used in any test case -- Each evaluator in `evaluatorRefs` needs a matching JSON config in `evaluations/evaluators/` -- `evaluationCriterias` keys must match entries in `evaluatorRefs` -- Use `expectedOutput` for most evaluators -- LLM evaluators need `model` in their config. Available models are defined in the SDK's `ChatModels` class (`uipath.platform.chat.ChatModels`): - - `gpt-4o-mini-2024-07-18` (recommended for cost-efficiency) - - `gpt-4o-2024-08-06` (higher quality, higher cost) - - `o3-mini-2025-01-31` (latest reasoning model) - - Model availability varies by region and tenant configuration - - Check your UiPath Automation Cloud portal under AI Trust Layer for available models in your region - ---- - -## Adding a Test Case - -When adding a test to an existing eval set: - -1. Read the existing eval set -2. Check which evaluators are in `evaluatorRefs` -3. Add the new test to `evaluations` array -4. If using a new evaluator, add it to `evaluatorRefs` - -### Test Case Template - -```json -{ - "id": "test-{n}", - "name": "Description of what this tests", - "inputs": { }, - "evaluationCriterias": { - "EvaluatorName": { - "expectedOutput": { } - } - } -} -``` - ---- - -## Running Evaluations - -First, read entry-points.json to get the entrypoint name (e.g., `main`): - -!uv run uipath eval main evaluations/eval-sets/default.json --output-file eval-results.json - -**Note:** Replace `main` with your actual entrypoint from entry-points.json. - -### Analyze Results - -After running, read `eval-results.json` and show: -- Pass/fail summary table -- For failures: expected vs actual output -- Suggestions for fixing or changing evaluators - -### Results Format - -```json -{ - "evaluationSetResults": [{ - "evaluationRunResults": [ - { - "evaluationId": "test-1", - "evaluatorId": "ExactMatchEvaluator", - "result": { "score": 1.0 }, - "errorMessage": null - } - ] - }] -} -``` - -- Score 1.0 = PASS -- Score < 1.0 = FAIL (show expected vs actual) -- errorMessage present = ERROR (show message) - ---- - -## Evaluator Reference - -### Deterministic Evaluators - -**ExactMatchEvaluator** - Exact output matching -```json -"ExactMatchEvaluator": { - "expectedOutput": { "result": "exact value" } -} -``` - -**ContainsEvaluator** - Output contains substring -```json -"ContainsEvaluator": { - "searchText": "must contain this" -} -``` - -**JsonSimilarityEvaluator** - JSON comparison with tolerance -```json -"JsonSimilarityEvaluator": { - "expectedOutput": { "value": 10.0 } -} -``` - -### LLM-Based Evaluators - -**LLMJudgeOutputEvaluator** - Semantic correctness -```json -"LLMJudgeOutputEvaluator": { - "expectedOutput": { "summary": "Expected semantic meaning" } -} -``` - -**LLMJudgeTrajectoryEvaluator** - Validate agent reasoning -```json -"LLMJudgeTrajectoryEvaluator": { - "expectedAgentBehavior": "The agent should first fetch data, then process it" -} -``` - ---- - -## Common Issues - -### "No evaluations found" -- Check `evaluations/eval-sets/` directory exists -- Verify JSON file is valid - -### Evaluator not found -- Each evaluator needs a JSON config file in `evaluations/evaluators/` -- Config file must have correct `evaluatorTypeId` (see templates above) -- Config file must have `name` field at root level -- LLM evaluators need `model` in `evaluatorConfig` - -### Evaluator skipped -- Ensure evaluator is listed in root `evaluatorRefs` array -- Check evaluator config file exists in `evaluations/evaluators/` - -### Schema mismatch -- Run `uv run uipath init --no-agents-md-override` to refresh schemas -- Check `entry-points.json` matches your Input/Output models diff --git a/packages/uipath/src/uipath/_resources/new-agent.md b/packages/uipath/src/uipath/_resources/new-agent.md deleted file mode 100644 index b1d051866..000000000 --- a/packages/uipath/src/uipath/_resources/new-agent.md +++ /dev/null @@ -1,103 +0,0 @@ ---- -allowed-tools: Bash, Read, Write, Edit, Glob -description: Create a new UiPath coded agent from a description ---- - -I'll help you create a new UiPath coded agent. - -## Step 1: Check existing project - -Let me check if this is an existing UiPath project: - -!ls uipath.json main.py 2>/dev/null || echo "NEW_PROJECT" - -## Step 2: Gather requirements - -**What should this agent do?** - -Please describe: - -- What inputs it needs (e.g., "a file path and bucket name") -- What it should accomplish (e.g., "process CSV data") -- What outputs it should return (e.g., "total count and status") - -I'll generate the agent structure based on your description. - -## Step 3: Generate agent - -After you describe the agent, I will: - -1. Create `main.py` with Input/Output Pydantic models and `async def main()` -2. Add entrypoint to `uipath.json` under `"functions": {"agent_name": "main.py:main"}` -3. Run `uv run uipath init --no-agents-md-override` to generate schemas - -**Template structure** (from .agent/REQUIRED_STRUCTURE.md): - -```python -from pydantic import BaseModel -from uipath.platform import UiPath - -class Input(BaseModel): - """Input fields for the agent.""" - # Fields based on your description - pass - - -class Output(BaseModel): - """Output fields returned by the agent.""" - # Fields based on your description - pass - - -async def main(input: Input) -> Output: - """Main entry point for the agent. - - Args: - input: The input data for the agent. - - Returns: - The output data from the agent. - """ - - uipath = UiPath() - - # TODO: Implement agent logic - return Output() -``` - -**Important notes:** - -- Use `async def main` - many SDK methods are async -- Initialize `UiPath()` inside the function, not at module level -- After creating main.py, add entrypoint to `uipath.json` under `"functions"` - -## Step 4: Update entry-point schemas - -After creating main.py, regenerate the schemas: - -!uv run uipath init --no-agents-md-override - -## Step 5: Verify - -Quick test to verify the setup: - -!uv run uipath run main '{}' 2>&1 | head -30 - -## Summary - -Once complete, you'll have: - -| File | Purpose | -| ------------------- | ----------------------------------- | -| `main.py` | Agent code with Input/Output models | -| `uipath.json` | Project configuration | -| `entry-points.json` | Entry point schemas | -| `bindings.json` | Resource bindings | -| `.agent/` | SDK and CLI reference docs | - -**Next steps:** - -1. Implement your logic in `main()` -2. Test: `uv run uipath run main '{"field": "value"}'` -3. Create `eval_set.json` for evaluations -4. Evaluate: `uv run uipath eval` diff --git a/packages/uipath/tests/cli/test_init_agents_md.py b/packages/uipath/tests/cli/test_init_agents_md.py index a41502c5f..cc2b479f2 100644 --- a/packages/uipath/tests/cli/test_init_agents_md.py +++ b/packages/uipath/tests/cli/test_init_agents_md.py @@ -17,53 +17,32 @@ class TestGenerateAgentMdFile: """Test the generate_agent_md_file helper function.""" - def test_generate_agent_md_file_creates_file(self) -> None: - """Test that a single md file is created successfully.""" + def test_creates_file(self) -> None: with tempfile.TemporaryDirectory() as temp_dir: - original_cwd = os.getcwd() - try: - os.chdir(temp_dir) - mock_source = ( - Path(__file__).parent.parent.parent - / "src" - / "uipath" - / "_resources" - / "AGENTS.md" - ) + mock_source = Path(temp_dir) / "source.md" + mock_source.write_text("Test content") + + with ( + patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, + patch( + "uipath._cli.cli_init.importlib.resources.as_file" + ) as mock_as_file, + ): + mock_files.return_value.joinpath.return_value = MagicMock() + mock_as_file.return_value.__enter__.return_value = mock_source + mock_as_file.return_value.__exit__.return_value = None + + generate_agent_md_file(temp_dir, "AGENTS.md", False) - with ( - patch( - "uipath._cli.cli_init.importlib.resources.files" - ) as mock_files, - patch( - "uipath._cli.cli_init.importlib.resources.as_file" - ) as mock_as_file, - ): - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path - mock_as_file.return_value.__enter__.return_value = mock_source - mock_as_file.return_value.__exit__.return_value = None - - generate_agent_md_file(temp_dir, "AGENTS.md", False) - - assert (Path(temp_dir) / "AGENTS.md").exists() - finally: - os.chdir(original_cwd) - - def test_generate_agents_md_overwrites_existing_file(self) -> None: - """Test that existing AGENTS.md is overwritten.""" + assert (Path(temp_dir) / "AGENTS.md").read_text() == "Test content" + + def test_overwrites_existing_by_default(self) -> None: with tempfile.TemporaryDirectory() as temp_dir: - agents_path = Path(temp_dir) / "AGENTS.md" - original_content = "Original content" - agents_path.write_text(original_content) - - mock_source = ( - Path(__file__).parent.parent.parent - / "src" - / "uipath" - / "_resources" - / "AGENTS.md" - ) + existing = Path(temp_dir) / "AGENTS.md" + existing.write_text("original") + + mock_source = Path(temp_dir) / "source.md" + mock_source.write_text("new content") with ( patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, @@ -71,39 +50,44 @@ def test_generate_agents_md_overwrites_existing_file(self) -> None: "uipath._cli.cli_init.importlib.resources.as_file" ) as mock_as_file, ): - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path + mock_files.return_value.joinpath.return_value = MagicMock() mock_as_file.return_value.__enter__.return_value = mock_source mock_as_file.return_value.__exit__.return_value = None generate_agent_md_file(temp_dir, "AGENTS.md", False) - assert agents_path.read_text() != original_content - assert agents_path.exists() + assert existing.read_text() == "new content" + + def test_skips_existing_when_no_override(self) -> None: + with tempfile.TemporaryDirectory() as temp_dir: + existing = Path(temp_dir) / "AGENTS.md" + existing.write_text("original") + + generate_agent_md_file(temp_dir, "AGENTS.md", no_agents_md_override=True) - def test_generate_agents_md_handles_errors_gracefully(self) -> None: - """Test that errors are handled gracefully.""" + assert existing.read_text() == "original" + + def test_handles_errors_gracefully(self) -> None: with tempfile.TemporaryDirectory() as temp_dir: with ( patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, patch("uipath._cli.cli_init.console") as mock_console, ): - mock_files.side_effect = RuntimeError("Test error") + mock_files.side_effect = RuntimeError("boom") generate_agent_md_file(temp_dir, "AGENTS.md", False) mock_console.warning.assert_called_once() - assert "Could not create AGENTS.md: Test error" in str( - mock_console.warning.call_args - ) class TestGenerateAgentMdFiles: - """Test the generate_agent_md_files function that creates multiple files.""" + """Test the generate_agent_md_files entry point.""" - def test_generate_agent_md_files_creates_all_files(self) -> None: - """Test that all root and agent files are created in the correct locations.""" + def test_default_does_not_bundle_offline_docs(self) -> None: with tempfile.TemporaryDirectory() as temp_dir: + mock_source = Path(temp_dir) / "source.md" + mock_source.write_text("Test content") + with ( patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, patch( @@ -111,68 +95,83 @@ def test_generate_agent_md_files_creates_all_files(self) -> None: ) as mock_as_file, patch("uipath._cli.cli_init.console"), ): - temp_source = Path(temp_dir) / "temp_source.md" - temp_source.write_text("Test content") - - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path - mock_as_file.return_value.__enter__.return_value = temp_source + mock_files.return_value.joinpath.return_value = MagicMock() + mock_as_file.return_value.__enter__.return_value = mock_source mock_as_file.return_value.__exit__.return_value = None generate_agent_md_files(temp_dir, False) - agent_dir = Path(temp_dir) / ".agent" - assert agent_dir.exists() - assert agent_dir.is_dir() - assert (Path(temp_dir) / "AGENTS.md").exists() assert (Path(temp_dir) / "CLAUDE.md").exists() + assert not (Path(temp_dir) / ".uipath" / "llms-full.txt").exists() + assert not (Path(temp_dir) / ".agent").exists() + assert not (Path(temp_dir) / ".claude").exists() + # default AGENTS.md must not reference the offline fallback + assert ( + ".uipath/llms-full.txt" + not in (Path(temp_dir) / "AGENTS.md").read_text() + ) + + def test_with_offline_docs_bundles_llms_full(self) -> None: + with tempfile.TemporaryDirectory() as temp_dir: + mock_source = Path(temp_dir) / "source.md" + mock_source.write_text("# AGENTS\n\n1. step one\n2. step two\n") - assert (agent_dir / "CLI_REFERENCE.md").exists() - assert (agent_dir / "REQUIRED_STRUCTURE.md").exists() - assert (agent_dir / "SDK_REFERENCE.md").exists() + with ( + patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, + patch( + "uipath._cli.cli_init.importlib.resources.as_file" + ) as mock_as_file, + patch("uipath._cli.cli_init.console"), + ): + mock_files.return_value.joinpath.return_value = MagicMock() + mock_as_file.return_value.__enter__.return_value = mock_source + mock_as_file.return_value.__exit__.return_value = None - def test_generate_agent_md_files_overwrites_existing_files(self) -> None: - """Test that existing files are overwritten.""" + generate_agent_md_files(temp_dir, False, with_offline_docs=True) + + assert (Path(temp_dir) / ".uipath" / "llms-full.txt").exists() + agents_text = (Path(temp_dir) / "AGENTS.md").read_text() + assert ".uipath/llms-full.txt" in agents_text + + def test_with_offline_docs_skips_when_resource_missing(self) -> None: with tempfile.TemporaryDirectory() as temp_dir: - agent_dir = Path(temp_dir) / ".agent" - agent_dir.mkdir() + mock_source = Path(temp_dir) / "source.md" + mock_source.write_text("Test content") - agents_path = Path(temp_dir) / "AGENTS.md" - agents_content = "Original AGENTS content" - agents_path.write_text(agents_content) + call_count = {"n": 0} - cli_ref_path = agent_dir / "CLI_REFERENCE.md" - cli_ref_content = "Original CLI_REFERENCE content" - cli_ref_path.write_text(cli_ref_content) + def files_side_effect(_pkg: str): + call_count["n"] += 1 + if call_count["n"] <= 2: # AGENTS.md + CLAUDE.md + m = MagicMock() + m.joinpath.return_value = MagicMock() + return m + raise FileNotFoundError("no llms-full.txt bundled") with ( - patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, + patch( + "uipath._cli.cli_init.importlib.resources.files", + side_effect=files_side_effect, + ), patch( "uipath._cli.cli_init.importlib.resources.as_file" ) as mock_as_file, patch("uipath._cli.cli_init.console"), ): - temp_source = Path(temp_dir) / "temp_source.md" - temp_source.write_text("Test content") - - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path - mock_as_file.return_value.__enter__.return_value = temp_source + mock_as_file.return_value.__enter__.return_value = mock_source mock_as_file.return_value.__exit__.return_value = None - generate_agent_md_files(temp_dir, False) + generate_agent_md_files(temp_dir, False, with_offline_docs=True) - assert agents_path.read_text() != agents_content - assert agents_path.read_text() == "Test content" - assert cli_ref_path.read_text() != cli_ref_content - assert cli_ref_path.read_text() == "Test content" + assert (Path(temp_dir) / "AGENTS.md").exists() + assert not (Path(temp_dir) / ".uipath" / "llms-full.txt").exists() class TestInitWithAgentsMd: - """Test the init command with default AGENTS.md creation.""" + """Test the init command end to end.""" - def _generate_pyproject(self): + def _generate_pyproject(self) -> None: with open("pyproject.toml", "w") as f: f.write( '[project]\nname = "test-project"\nversion = "0.1.0"\n' @@ -180,81 +179,48 @@ def _generate_pyproject(self): 'requires-python = ">=3.11"\n' ) - def test_init_creates_agent_files_by_default( - self, runner: CliRunner, temp_dir: str - ) -> None: - """Test that agent files are created by default during init.""" + def test_init_creates_agents_md(self, runner: CliRunner, temp_dir: str) -> None: with runner.isolated_filesystem(temp_dir=temp_dir): - # Create a simple Python file with open("main.py", "w") as f: f.write("def main(input): return input") - temp_source = Path(temp_dir) / "temp_source.md" - temp_source.write_text("Test content") - - with ( - patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, - patch( - "uipath._cli.cli_init.importlib.resources.as_file" - ) as mock_as_file, - ): - # Setup mocks - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path - mock_as_file.return_value.__enter__.return_value = temp_source - mock_as_file.return_value.__exit__.return_value = None + self._generate_pyproject() + result = runner.invoke(cli, ["init"]) - self._generate_pyproject() - result = runner.invoke(cli, ["init"]) + assert result.exit_code == 0 + assert os.path.exists("AGENTS.md") + assert os.path.exists("CLAUDE.md") + assert not os.path.exists(".agent") + assert not os.path.exists(".claude") - assert result.exit_code == 0 - assert "AGENTS.md" in result.output - assert "file." in result.output - - assert os.path.exists("AGENTS.md") - assert os.path.exists("CLAUDE.md") - - assert os.path.exists(".agent/CLI_REFERENCE.md") - assert os.path.exists(".agent/REQUIRED_STRUCTURE.md") - assert os.path.exists(".agent/SDK_REFERENCE.md") - - def test_init_overwrites_existing_agents_md( + def test_init_overwrites_existing_agents_md_by_default( self, runner: CliRunner, temp_dir: str ) -> None: - """Test that existing AGENTS.md is overwritten.""" with runner.isolated_filesystem(temp_dir=temp_dir): - # Create a simple Python file with open("main.py", "w") as f: f.write("def main(input): return input") - - # Create existing AGENTS.md - original_content = "Original AGENTS.md content" with open("AGENTS.md", "w") as f: - f.write(original_content) + f.write("user content") - temp_source = Path(temp_dir) / "temp_source.md" - temp_source.write_text("Test content") + self._generate_pyproject() + result = runner.invoke(cli, ["init"]) - with ( - patch("uipath._cli.cli_init.importlib.resources.files") as mock_files, - patch( - "uipath._cli.cli_init.importlib.resources.as_file" - ) as mock_as_file, - ): - # Setup mocks - mock_path = MagicMock() - mock_files.return_value.joinpath.return_value = mock_path - mock_as_file.return_value.__enter__.return_value = temp_source - mock_as_file.return_value.__exit__.return_value = None + assert result.exit_code == 0 + with open("AGENTS.md") as f: + assert f.read() != "user content" - self._generate_pyproject() - # Run init (AGENTS.md creation is now default) - result = runner.invoke(cli, ["init"]) + def test_init_preserves_agents_md_with_no_override( + self, runner: CliRunner, temp_dir: str + ) -> None: + with runner.isolated_filesystem(temp_dir=temp_dir): + with open("main.py", "w") as f: + f.write("def main(input): return input") + with open("AGENTS.md", "w") as f: + f.write("user content") - assert result.exit_code == 0 + self._generate_pyproject() + result = runner.invoke(cli, ["init", "--no-agents-md-override"]) - # Verify content was changed - with open("AGENTS.md", "r") as f: - content = f.read() - assert content != original_content - assert content == "Test content" + assert result.exit_code == 0 + with open("AGENTS.md") as f: + assert f.read() == "user content" diff --git a/packages/uipath/uv.lock b/packages/uipath/uv.lock index 3d4c916d3..c51486b96 100644 --- a/packages/uipath/uv.lock +++ b/packages/uipath/uv.lock @@ -2543,7 +2543,7 @@ wheels = [ [[package]] name = "uipath" -version = "2.10.62" +version = "2.10.63" source = { editable = "." } dependencies = [ { name = "applicationinsights" },