Skip to content

fix(cli): add --type and --agent-framework options to uipath new - #1886

Open
vldcmp-uipath wants to merge 1 commit into
mainfrom
fix/new-project-type-and-agent-framework
Open

fix(cli): add --type and --agent-framework options to uipath new#1886
vldcmp-uipath wants to merge 1 commit into
mainfrom
fix/new-project-type-and-agent-framework

Conversation

@vldcmp-uipath

@vldcmp-uipath vldcmp-uipath commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

When uipath-langchain is installed, its entry-point middleware claims uipath new unconditionally (should_continue=False in all cases), so the base function scaffold is unreachable — uipath new <name> always produces a LangGraph agent project with no uipath.json. Fixes #1543.

Changes

  • uipath new gains --type auto|function|agent (default: auto, shown in --help). auto preserves today's implicit behaviour: an installed agent framework claims the scaffold, otherwise the base function project is created; several installed integrations error and ask for an explicit choice instead of resolving by middleware registration order. function/agent request one explicitly — callers that need a guaranteed function project (e.g. the uip functions-tool passthrough) should pass --type function.
  • uipath new gains --agent-framework claude-sdk|google-adk|langchain|llamaindex|microsoft-agent-framework|openai-agents|pydantic-ai, valid only together with --type agent. When omitted, it resolves to the framework whose integration package is installed (a single installed integration wins; several installed require an explicit --agent-framework; none installed errors with the list of frameworks and their integration packages — there is no hardcoded default framework).
  • Both values are forwarded to the middleware chain as enums: Middlewares.next("new", name, project_type=..., agent_framework=...).
  • If --type agent is requested but no installed integration claims the scaffold, the command errors and names the exact package to install (e.g. uipath-pydantic-ai) instead of silently falling back to a function project.
  • AgentFramework.<member>.claims_scaffold(project_type, agent_framework) is the gate the integrations' new middlewares share: auto is claimed by whichever integration is installed, agent only by the framework it names, function by none. The rule is identical for every framework, so it lives here instead of being repeated (and drifting) in each integration repo.
  • New ProjectType and AgentFramework StrEnums live in uipath._cli.models.project_types / uipath._cli.models.agent_frameworks so framework integrations can import them; AgentFramework.<member>.package returns the integration's PyPI package name (note: microsoft-agent-framework ships as uipath-agent-framework).
  • Version bumped to 2.14.15.

Behaviour

Command Result
uipath new my-fn (or --type auto) agent project when one framework integration is installed, function project when none (default); pick-one error when several
uipath new my-fn --type function function project (explicit)
uipath new my-agent --type agent agent for the single installed framework's integration; pick-one error when several; install-a-framework error when none
uipath new my-agent --type agent --agent-framework pydantic-ai pydantic-ai integration if installed, otherwise actionable error
uipath new x --agent-framework langchain error: only valid with --type agent

Compatibility

  • Old integrations that don't accept the new kwargs hit the existing legacy-signature fallback in Middlewares.next (kwargs trimmed + "Install the latest version for uipath packages" warning), so behaviour with an outdated uipath-langchain is unchanged until it updates — companion PR in uipath-langchain-python gates its middleware on these values.
  • The enums subclass str, so middlewares comparing plain strings keep working.

Testing

  • 27/27 in tests/cli/test_new.py (19 new cases), mypy and ruff clean.
  • Verified end-to-end in a venv with both packages installed editable: default/function/agent/uninstalled-framework/misuse/invalid-value paths.

🤖 Generated with Claude Code

Development Packages

uipath

[project]
dependencies = [
  # Exact version (copy-paste ready):
  "uipath==2.14.15.dev1018867616",

  # Any version from this PR (uncomment to use a range instead):
  # "uipath>=2.14.15.dev1018860000,<2.14.15.dev1018870000",
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath = { index = "testpypi" }

Copilot AI lite review requested due to automatic review settings September 7, 2026 14:54
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Sep 7, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The behavior change is well-covered by tests and the remaining feedback is limited to minor CLI help/UX clarity rather than functional correctness.

Pull request overview

This PR updates the uipath CLI’s new command to make function vs agent scaffolding explicit, preventing third-party integrations (e.g., uipath-langchain) from unconditionally claiming uipath new and making the base function scaffold unreachable.

Changes:

  • Added --type function|agent (default function) and --agent-framework ... (valid only with --type agent) to uipath new, forwarding both as enums through the middleware chain.
  • Introduced shared StrEnum models (ProjectType, AgentFramework) for integrations to import, including framework→package name mapping.
  • Expanded CLI test coverage for the new option matrix and bumped version to 2.14.13.
File summaries
File Description
packages/uipath/src/uipath/_cli/cli_new.py Adds --type / --agent-framework, resolves defaults, validates combinations, forwards enums to middleware, and errors when an agent scaffold isn’t claimed.
packages/uipath/src/uipath/_cli/models/project_types.py New ProjectType StrEnum for integrations and middleware dispatch.
packages/uipath/src/uipath/_cli/models/agent_frameworks.py New AgentFramework StrEnum with .package mapping and default framework constant.
packages/uipath/tests/cli/test_new.py Adds tests verifying defaulting, forwarding, validation, and “missing integration” error behavior.
packages/uipath/pyproject.toml Bumps uipath version to 2.14.13.
packages/uipath/uv.lock Updates lock metadata and bumps locked uipath version to 2.14.13.
Review details
  • Files reviewed: 5/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +75 to +78
type=click.Choice([f.value for f in AgentFramework]),
default=None,
show_default=DEFAULT_AGENT_FRAMEWORK.value,
help="Agent framework to scaffold for. Only valid together with `--type agent`.",
@vldcmp-uipath vldcmp-uipath added the build:dev Create a dev build from the pr label Sep 8, 2026
vldcmp-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Sep 8, 2026
Temporary, to validate and publish a dev build of this PR before uipath
2.14.13 ships: pin uipath==2.14.13.dev1018867574 (built from
UiPath/uipath-python#1886) and source it from the testpypi index. Restore
the ">=2.14.13, <2.15.0" range and drop the source before merging.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/new-project-type-and-agent-framework branch from f6e07d4 to e38a166 Compare September 9, 2026 11:22
vldcmp-uipath added a commit to UiPath/uipath-langchain-python that referenced this pull request Sep 9, 2026
Temporary, to validate and publish a dev build of this PR before uipath
2.14.14 ships: pin uipath==2.14.14.dev1018867580 (built from
UiPath/uipath-python#1886) and source it from the testpypi index. Restore
the ">=2.14.14, <2.15.0" range and drop the source before merging.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/new-project-type-and-agent-framework branch from 598ff8f to 28a14dc Compare September 11, 2026 12:06
@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

`uipath new` was unconditionally hijacked by any installed agent
framework integration (the middleware always returned
should_continue=False), making the base function scaffold unreachable
once uipath-langchain was in the environment (#1543).

Scaffold selection is now explicit, and every ambiguity is resolved in
the base CLI before dispatching to the integrations:

- `--type auto` (the new default) keeps the previous behaviour: the
  single installed integration claims the scaffold, otherwise a
  function project is created.
- `--type function` always creates a function project.
- `--type agent` creates an agent project. `--agent-framework` picks
  the framework; when unset it resolves to the single installed
  integration, and with none installed the error lists the packages to
  install.
- Several installed integrations with no explicit framework is an
  error for both `auto` and `agent`, rather than an arbitrary pick.
- A framework whose integration does not claim the scaffold fails with
  pip/uv install instructions, matching `uipath dev`.

The project type and agent framework are modelled as StrEnums in
`_cli/models/` and forwarded to the `new` middleware so integrations
can gate on them. `AgentFramework.claims_scaffold()` is that gate: the
rule is the same for every framework, so the integrations name their
framework instead of each repeating the comparison.

Docs cover the new options: the previously missing `new` section in
the CLI reference, an --agent-framework column plus a Claude Agent SDK
row in the coded-agents framework table, explicit-type notes in the
agents, functions, and Studio Web guides.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vldcmp-uipath
vldcmp-uipath force-pushed the fix/new-project-type-and-agent-framework branch from 28a14dc to fe4e537 Compare September 11, 2026 12:24
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cli): add --type flag to uipath new to support function project scaffolding alongside agents

2 participants