UiPath Documentation
functions
latest
false
  • Información general
    • Acerca de las funciones
  • Python functions
    • Primeros pasos
    • Building Python functions
    • Accessing platform services
    • Tracing and observability
    • Pruebas y depuración
  • Deploy and run

Functions user guide

Primeros pasos

This page walks you through installing the SDK, scaffolding a project, and running your first Python function locally.

Requisitos previos

  • Python 3.10 or later.
  • The uipath CLI and SDK, installed with pip.
  • A UiPath account with access to Orchestrator (for publishing and invoking).

Install the SDK

pip install uipath
pip install uipath

Verify the installation:

uipath --version
uipath --version

Scaffold a project

Create a new function project:

uipath new my-function
uipath new my-function

This scaffolds the files you edit:

Archivo Propósito
main.pyYour function logic and the Input/Output models. Starts as a runnable example.
pyproject.tomlProject metadata and dependencies.
uipath.jsonDeclares the callable entry points. The scaffold registers main for you.

Write your first function

Replace the scaffolded logic in main.py:

from pydantic.dataclasses import dataclass


@dataclass
class Input:
    message: str = ""


@dataclass
class Output:
    reply: str = ""


def main(input: Input) -> Output:
    return Output(reply=f"Hello, {input.message}!")
from pydantic.dataclasses import dataclass


@dataclass
class Input:
    message: str = ""


@dataclass
class Output:
    reply: str = ""


def main(input: Input) -> Output:
    return Output(reply=f"Hello, {input.message}!")

The scaffolded uipath.json already declares this entry point:

{
  "functions": {
    "main": "main.py:main"
  }
}
{
  "functions": {
    "main": "main.py:main"
  }
}

The key (main) is the entry-point name used in CLI commands; the value references the file and function. Update it only if you rename the function or add more entry points.

Generate the project schema

Once your Input and Output are defined, generate the schema and bindings:

uipath init
uipath init

This reads your code and uipath.json and generates:

Archivo Propósito
entry-points.jsonInput/output JSON Schema derived from your models, used for variable binding.
bindings.jsonResource bindings for local runs.

Re-run uipath init whenever you change your Input or Output models.

Run it locally

uipath run main '{"message": "world"}'
uipath run main '{"message": "world"}'

Local runs use the bindings in bindings.json to resolve platform resources, so you can test against real Orchestrator assets and buckets before publishing.

Próximos pasos

¿Te ha resultado útil esta página?

Conectar

¿Necesita ayuda? Soporte

¿Quiere aprender? UiPath Academy

¿Tiene alguna pregunta? Foro de UiPath

Manténgase actualizado