Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions packages/uipath/docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,61 @@ Treat `--client-secret` as a credential. In CI, prefer reading it from a secret

---

::: mkdocs-click
:module: uipath._cli
:command: new
:depth: 1
:style: table

Scaffolds a project in the current directory. `--type` selects what gets created:

- **`auto`** (default) — an installed agent framework integration (e.g. `uipath-langchain`) claims the scaffold and creates a coded agent project; with none installed, a coded function project is created.
- **`function`** — always creates a coded function project, regardless of installed integrations.
- **`agent`** — creates a coded agent project. `--agent-framework` picks the framework and defaults to the one whose integration package is installed.

| Installed framework integrations | `uipath new x` (auto) | `uipath new x --type agent` |
|----------------------------------|------------------------|------------------------------|
| none | coded function project | error listing the integration packages |
| one | that framework's coded agent project | that framework's coded agent project |
| several | error: pick one explicitly | error: pick one explicitly |

`--agent-framework` is only valid together with `--type agent`.

Scaffold a coded function:

<!-- termynal -->

```shell
> uipath new my-function --type function
⠋ Creating new project my-function in current directory ...
✓ Created 'main.py' file.
✓ Created 'pyproject.toml' file.
✓ Created 'uipath.json' file.
💡 Initialize project: uipath init
💡 Run project: uipath run main '{"message": "Hello World!"}'
```

Scaffold a coded agent — requires the framework's integration package in the environment:

<!-- termynal -->

```shell
> uv add uipath-langchain
Resolved 42 packages in 1.2s
Installed 42 packages in 0.8s

> uipath new my-agent --type agent
Using the installed 'langchain' agent framework.
⠋ Creating new agent my-agent in current directory ...
✓ Created 'main.py' file.
✓ Created 'langgraph.json' file.
✓ Created 'pyproject.toml' file.
💡 Initialize project: uipath init
💡 Run agent: uipath run agent '{"topic": "UiPath"}'
```

---

::: mkdocs-click
:module: uipath._cli
:command: init
Expand Down
27 changes: 19 additions & 8 deletions packages/uipath/docs/core/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ Every coded agent is built from two layers:

The `uipath` package is always required. Add one framework extension on top:

| Framework | Package | Best for |
|-----------|---------|---------|
| LangChain / LangGraph | `uipath-langchain` | Graph-based agents, complex multi-step flows |
| LlamaIndex | `uipath-llamaindex` | RAG-heavy agents, document reasoning |
| OpenAI Agents SDK | `uipath-openai-agents` | OpenAI-native tool use, handoffs |
| PydanticAI | `uipath-pydantic-ai` | Type-safe agents with Pydantic models |
| Google ADK | `uipath-google-adk` | Gemini models, Google ecosystem |
| UiPath Agent Framework | `uipath-agent-framework` | UiPath-native agent primitives |
| Framework | Package | `--agent-framework` | Best for |
|-----------|---------|---------------------|---------|
| LangChain / LangGraph | `uipath-langchain` | `langchain` | Graph-based agents, complex multi-step flows |
| LlamaIndex | `uipath-llamaindex` | `llamaindex` | RAG-heavy agents, document reasoning |
| OpenAI Agents SDK | `uipath-openai-agents` | `openai-agents` | OpenAI-native tool use, handoffs |
| PydanticAI | `uipath-pydantic-ai` | `pydantic-ai` | Type-safe agents with Pydantic models |
| Google ADK | `uipath-google-adk` | `google-adk` | Gemini models, Google ecosystem |
| UiPath Agent Framework | `uipath-agent-framework` | `microsoft-agent-framework` | UiPath-native agent primitives |
| Claude Agent SDK | `uipath-claude-sdk` | `claude-sdk` | Claude models, Anthropic-native agent loop |

The `--agent-framework` column is the value to pass to `uipath new --type agent` when scaffolding explicitly (see the note below the Quickstart).

---

Expand Down Expand Up @@ -85,6 +88,14 @@ The example below uses LangChain. Swap `uipath-langchain` for the framework of y

////

/// info | Explicit project type and framework
`uipath new` defaults to `--type auto`: the installed agent framework integration claims the scaffold, which is why the commands above create an agent project. To request one explicitly — required when several framework integrations are installed in the same environment — pass the type and framework:

```shell
uipath new agent --type agent --agent-framework langchain
```
///

---

## Project Structure
Expand Down
8 changes: 8 additions & 0 deletions packages/uipath/docs/core/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ Use coded functions for deterministic compute steps: document extraction, ERP wr

////

/// info | Guaranteeing a function project
`uipath new` defaults to `--type auto`: when an agent framework integration (e.g. `uipath-langchain`) is installed in the environment, it scaffolds a coded agent instead of a function. Pass `--type function` to always get a coded function project:

```shell
uipath new my-function --type function
```
///

---

## Project Structure
Expand Down
10 changes: 8 additions & 2 deletions packages/uipath/docs/core/studio_web.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ First, install the SDK package for the framework you want to use:
# uipath-pydantic-ai - PydanticAI
# uipath-google-adk - Google ADK
# uipath-agent-framework - UiPath Agent Framework
# uipath-claude-sdk - Claude Agent SDK
> uv add uipath-langchain
Resolved 42 packages in 1.2s
Installed 42 packages in 0.8s
Expand All @@ -190,6 +191,7 @@ Installed 42 packages in 0.8s
# uipath-pydantic-ai - PydanticAI
# uipath-google-adk - Google ADK
# uipath-agent-framework - UiPath Agent Framework
# uipath-claude-sdk - Claude Agent SDK
> pip install uipath-langchain
Successfully installed uipath-langchain
```
Expand Down Expand Up @@ -221,9 +223,13 @@ Selected tenant: Tenant1

That's it, your agent should now be visible in Studio Web.

/// info
`uipath new` defaults to `--type auto`, which lets the installed framework integration claim the scaffold. With several integrations installed, pick one explicitly: `uipath new agent --type agent --agent-framework <framework>`.
///

#### Coded Function

A coded function doesn't require an additional framework package. Authenticate, scaffold the project, and initialize it:
A coded function doesn't require an additional framework package. Authenticate, scaffold the project, and initialize it (`--type function` guarantees a function project even when a framework integration is installed):

<!-- termynal -->

Expand All @@ -238,7 +244,7 @@ Select tenant number: 0
Selected tenant: Tenant1
✓ Authentication successful.

> uipath new my-function
> uipath new my-function --type function
✓ Created 'main.py' file.
✓ Created 'pyproject.toml' file.
✓ Created 'uipath.json' file.
Expand Down
2 changes: 1 addition & 1 deletion packages/uipath/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "uipath"
version = "2.14.14"
version = "2.14.15"
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"
Expand Down
80 changes: 78 additions & 2 deletions packages/uipath/src/uipath/_cli/cli_new.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
from ._utils._console import ConsoleLogger
from ._utils._project_files import resolve_existing_project_id
from .middlewares import Middlewares
from .models.agent_frameworks import AgentFramework, installed_agent_frameworks
from .models.project_types import ProjectType

console = ConsoleLogger()

Expand Down Expand Up @@ -57,10 +59,49 @@ def generate_uipath_json(target_directory):
json.dump(uipath_config, f, indent=2)


def _detect_agent_framework(installed: list[AgentFramework]) -> AgentFramework:
"""Resolve an unset --agent-framework from the installed integrations.

Called with at most one installed integration (several error out before
this): the single installed one wins, none installed errors with the
list of frameworks and their packages.
"""
if installed:
framework = installed[0]
console.info(f"Using the installed '{framework}' agent framework.")
return framework
packages = "\n".join(f" {framework.package}" for framework in AgentFramework)
console.error(
"No agent framework integration is installed.\n"
"Please install the package for the framework you want "
"(`pip install <package>` or `uv add <package>`):\n\n" + packages
)


@click.command()
@click.argument("name", type=str, default="")
@click.option(
"--type",
"project_type",
type=click.Choice([t.value for t in ProjectType]),
default=ProjectType.AUTO.value,
show_default=True,
help="Project type to scaffold. 'auto' scaffolds an agent when an agent "
"framework package (e.g. uipath-langchain) is installed and a function "
"otherwise; 'agent' requires one explicitly.",
)
@click.option(
"--agent-framework",
"agent_framework",
type=click.Choice([f.value for f in AgentFramework]),
default=None,
help=(
"Agent framework to scaffold for. Only valid together with `--type agent`; "
"defaults to the framework whose integration package is installed."
),
)
@track_command("new")
def new(name: str):
def new(name: str, project_type: str, agent_framework: str | None):
"""Generate a quick-start project."""
directory = os.getcwd()

Expand All @@ -69,7 +110,30 @@ def new(name: str):
"Please specify a name for your project:\n`uipath new hello-world`"
)

result = Middlewares.next("new", name)
scaffold_type = ProjectType(project_type)
framework = AgentFramework(agent_framework) if agent_framework else None

if framework and scaffold_type is not ProjectType.AGENT:
console.error(
"`--agent-framework` can only be used together with `--type agent`."
)

if framework is None and scaffold_type is not ProjectType.FUNCTION:
installed = installed_agent_frameworks()
if len(installed) > 1:
console.error(
"Multiple agent frameworks are installed: "
+ ", ".join(sorted(installed))
+ ".\nPick one with `--type agent --agent-framework <framework>`, "
f"or run `uipath new {name} --type function` to create a "
"function project."
)
if scaffold_type is ProjectType.AGENT:
framework = _detect_agent_framework(installed)

result = Middlewares.next(
"new", name, project_type=scaffold_type, agent_framework=framework
)

if result.error_message:
console.error(
Expand All @@ -82,6 +146,18 @@ def new(name: str):
if not result.should_continue:
return

if framework is not None: # only set for agent scaffolds
console.error(
f"The '{framework.package}' package is required to scaffold a "
f"'{framework}' agent.\n"
"Please install it:\n\n"
" # Using pip:\n"
f" pip install {framework.package}\n\n"
" # Using uv:\n"
f" uv add {framework.package}\n\n"
f"Or run `uipath new {name}` to create a function project."
)

with console.spinner(f"Creating new project {name} in current directory ..."):
generate_script(directory)
console.success("Created 'main.py' file.")
Expand Down
78 changes: 78 additions & 0 deletions packages/uipath/src/uipath/_cli/models/agent_frameworks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
"""Agent frameworks supported by `uipath new --type agent`.

Each framework's integration package registers a middleware that claims
agent scaffolds for its framework.
"""

import importlib.metadata
from enum import StrEnum

from .project_types import ProjectType


class AgentFramework(StrEnum):
"""Agent frameworks with a UiPath integration package."""

CLAUDE_SDK = "claude-sdk"
GOOGLE_ADK = "google-adk"
LANGCHAIN = "langchain"
LLAMAINDEX = "llamaindex"
MICROSOFT_AGENT_FRAMEWORK = "microsoft-agent-framework"
OPENAI_AGENTS = "openai-agents"
PYDANTIC_AI = "pydantic-ai"

@property
def package(self) -> str:
"""PyPI package that provides this framework's UiPath integration."""
return _AGENT_FRAMEWORK_PACKAGES[self]

def claims_scaffold(
self,
project_type: ProjectType,
agent_framework: "AgentFramework | None",
) -> bool:
"""Whether this framework's `new` middleware should scaffold the project.

Every integration answers the same question — `--type auto` (the
default) lets the installed integration win over the base function
scaffold, and `--type agent` belongs to the framework it names — so
the gate lives here rather than being repeated in each integration:

if not AgentFramework.LANGCHAIN.claims_scaffold(
project_type, agent_framework
):
return MiddlewareResult(should_continue=True)

Comparisons are by value, not identity, so callers passing plain
strings (an older base CLI, or a direct middleware call) still gate
correctly.
"""
return project_type == ProjectType.AUTO or (
project_type == ProjectType.AGENT and agent_framework == self
)


# uipath-langchain lives in its own repo; the rest come from
# UiPath/uipath-integrations-python (note: microsoft-agent-framework ships
# as `uipath-agent-framework`).
_AGENT_FRAMEWORK_PACKAGES = {
AgentFramework.CLAUDE_SDK: "uipath-claude-sdk",
AgentFramework.GOOGLE_ADK: "uipath-google-adk",
AgentFramework.LANGCHAIN: "uipath-langchain",
AgentFramework.LLAMAINDEX: "uipath-llamaindex",
AgentFramework.MICROSOFT_AGENT_FRAMEWORK: "uipath-agent-framework",
AgentFramework.OPENAI_AGENTS: "uipath-openai-agents",
AgentFramework.PYDANTIC_AI: "uipath-pydantic-ai",
}


def installed_agent_frameworks() -> list[AgentFramework]:
"""Agent frameworks whose integration package is installed in this environment."""
installed = []
for framework in AgentFramework:
try:
importlib.metadata.distribution(framework.package)
except importlib.metadata.PackageNotFoundError:
continue
installed.append(framework)
return installed
21 changes: 21 additions & 0 deletions packages/uipath/src/uipath/_cli/models/project_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Project types scaffolded by `uipath new`.

Framework integrations (uipath-langchain and the packages in
UiPath/uipath-integrations-python) import this to decide whether a
`uipath new` invocation is theirs to handle.
"""

from enum import StrEnum


class ProjectType(StrEnum):
"""What `uipath new` scaffolds.

AUTO (the default) lets an installed agent framework claim the scaffold
and falls back to a function project; FUNCTION and AGENT request one
explicitly.
"""

AUTO = "auto"
FUNCTION = "function"
AGENT = "agent"
Loading
Loading