# How UiPath CLI is organized

> UiPath CLI is assembled from a small host plus a set of tools and a few cross-cutting services. Understanding how the pieces fit together makes the design choices — default output format, auto-install, session resolution, stability contract — easier to reason about. This page is a single-paragraph map of each layer, with links to the page that goes deep.

UiPath CLI is assembled from a small host plus a set of tools and a few cross-cutting services. Understanding how the pieces fit together makes the design choices — default output format, auto-install, session resolution, stability contract — easier to reason about. This page is a single-paragraph map of each layer, with links to the page that goes deep.

## The host

The host is the `@uipath/cli` npm package, invoked through the `uip` command that `npm install -g` places on your `PATH`. It is a thin command-line program that owns:

- **Argv parsing and global options**, including the four-flag contract: `--output`, `--output-filter`, `--log-level`, `--log-file`. Global options are stripped from argv before any tool's subcommand sees the arguments, so tools cannot accidentally shadow them.
- **Authentication and session management** through three flows (interactive OAuth2, External App, env-var). See [Sessions and credentials](./concepts-sessions.md).
- **Configuration** through environment variables and per-command flags. See [Configuration](./configuration.md).
- **Tool lifecycle** via `uip tools install / update / uninstall / list / search`. See [Tools (plugins)](./concepts-tools.md).
- **Skills lifecycle** via `uip skills install / update / uninstall`. Orthogonal to tools. See [Skills](./concepts-skills.md).
- **Shell completion** via `uip completion` (bash, zsh, fish, pwsh).
- **The Model Context Protocol bridge** via `uip mcp`, for MCP-aware clients.
- **Logging, telemetry, output formatting, and the JSON envelope** — the runtime services every command uses to produce consistent output.

The host is published as `@uipath/cli` on npm. Its release cadence is independent from the tools.

## Tools

Every UiPath surface — Orchestrator, Solutions, Agents, Flows, Maestro, RPA, Test Manager, Integration Service, Data Fabric, Insights, Traces, DocsAI, API Workflow, Vertical Solutions, Coded Agents, Coded Apps — is a separate npm package under the `@uipath/` scope. The host maintains an auto-install whitelist of these packages and installs them on first use. Tools are loaded lazily; a fresh install has zero tools on disk.

Tool versions track the host's MAJOR.MINOR line by default, so upgrading the CLI and running `uip tools update` brings the entire toolchain into step.

See [Tools (plugins)](./concepts-tools.md) for the full model and [uip tools reference](./uip-tools.md) for the command. The no-opt-out auto-install behavior is covered in [Installing UiPath CLI](./installing-uipath-cli.md) under "Controlling tool auto-install".

## Skills

Skills are a parallel extension mechanism aimed at AI coding agents, not at the command surface. `uip skills install --agent <name>` writes a catalog of UiPath-specific instructions into Claude Code, Cursor, GitHub Copilot, Gemini CLI, Codex, or OpenCode. The agent reads those instructions to know how to use `uip` for common UiPath tasks — pack a solution, deploy an agent, run a test set, and so on.

Skills and tools are independent. Tools add commands; skills teach agents how to use the commands. Installing tools does not install skills, and vice versa. See [Skills](./concepts-skills.md).

## Sessions and credentials

`uip login` establishes a session — an organization, a tenant, and a pair of access/refresh tokens — and persists it inside a `.uipath/` folder. The CLI resolves the folder by walking up from the current directory, falling back to `~/.uipath/` if no project-local folder is found. Tokens are refreshed silently until the refresh token itself expires or is revoked.

A third auth flow bypasses on-disk state entirely: with `UIPATH_CLI_ENABLE_ENV_AUTH=true`, the CLI reads token + tenant + organization from environment variables on every invocation, which is the right fit for containers and ephemeral runners. See [Sessions and credentials](./concepts-sessions.md) and [Authentication](./authentication.md).

## Output and exit codes

Every command emits a single structured envelope on stdout. Four formats — `json` (default), `table`, `yaml`, `plain` — render the same envelope differently. The envelope's `Result` field maps one-to-one to a narrow set of exit codes (0 / 1 / 2 / 3 / 4 + 130 for user cancel) that scripts can branch on without parsing strings.

Stdout is reserved for the envelope. Logs, progress indicators, and human-readable error text always go to stderr, so pipelines can redirect the two streams independently.

See [Output formats](./output-formats.md), [Exit codes](./exit-codes.md), and [Scripting patterns](./scripting-patterns.md).

## Logging and telemetry

Logs are structured JSON Lines. They go to stderr by default and, with `--log-file <path>`, are duplicated into a file for log shippers to pick up. `--log-level` controls verbosity (`debug` / `info` / `warn` / `error`).

Telemetry is anonymous usage data sent to UiPath's Application Insights. It can be disabled with `UIPATH_TELEMETRY_DISABLED=1` or redirected with `UIPATH_AI_CONNECTION_STRING`. No command arguments, file contents, or credentials are transmitted.

See [Configuration](./configuration.md), and the Telemetry section of [Installing UiPath CLI](./installing-uipath-cli.md).

## The full command surface

```
uip <core-command> …                  # login, logout, tools, skills, mcp, completion
uip <tool-alias> <verb> [options]     # single-workflow tools (solution, agent, flow, maestro, rpa, codedagent, codedapp, api-workflow, vss)
uip <tool-alias> <resource> <verb>    # resource-first tools (or, tm, resource)
uip <tool-alias> [options]            # flat wrappers (df, insights, traces, docsai, is)
```

Three shapes, one grammar. Each tool's reference page documents the exact verbs and flags; every tool inherits the same global options and envelope.

## How a command runs

The sequence for a `uip or folders list` invocation, at a high level:

1. **Parse global options.** The host strips `--output`, `--output-filter`, `--log-level`, `--log-file` out of argv and configures the runtime.
2. **Resolve the tool.** `or` is matched against the whitelist. If `@uipath/orchestrator-tool` is not yet installed, auto-install runs. Otherwise the tool is loaded dynamically.
3. **Tool registers subcommands.** The host learns about `uip or folders list` and other Orchestrator subcommands.
4. **Resolve authentication.** The tool asks the host for the session. The host picks it up from a `.uipath/` folder (walk-up), from env-var auth, or fails fast with exit code `2` if nothing is available.
5. **Resolve configuration.** Environment variables and flags are reconciled per the precedence chain.
6. **Execute the verb.** The tool calls Orchestrator with the resolved session and configuration, then emits the envelope through the host's formatter.
7. **Exit.** The host translates the envelope's `Result` into a process exit code.

Nothing in this sequence is specific to Orchestrator. Every `uip <tool> …` call follows the same shape, which is what makes scripts portable across tools.

## See also

- [Tools (plugins)](./concepts-tools.md) — the plugin model in depth.
- [Skills](./concepts-skills.md) — the parallel extension mechanism for AI agents.
- [Sessions and credentials](./concepts-sessions.md) — where the credentials folder lives and how it is resolved.
- [Configuration](./configuration.md) — files, env vars, and precedence.
- [Output formats](./output-formats.md), [Exit codes](./exit-codes.md), [Global options](./global-options.md) — the runtime contract.
