Skip to content

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

Open
vldcmp-uipath wants to merge 3 commits 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 3 commits 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 function|agent (default: function, shown in --help).
  • uipath new gains --agent-framework google-adk|langchain|llamaindex|microsoft-agent-framework|openai-agents|pydantic-ai, valid only together with --type agent; defaults to langchain when --type agent is given without it.
  • 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.
  • 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.13.

Behaviour

Command Result
uipath new my-fn function project (base template — default)
uipath new my-fn --type function function project (explicit)
uipath new my-agent --type agent langchain agent project (via integration middleware)
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

  • 17/17 in tests/cli/test_new.py (10 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.13.dev1018867574",

  # Any version from this PR (uncomment to use a range instead):
  # "uipath>=2.14.13.dev1018860000,<2.14.13.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" }

Installing an agent framework integration (e.g. uipath-langchain) made its
middleware claim `uipath new` unconditionally, so the base function scaffold
was unreachable. Add a --type function|agent option (default: function) and
an --agent-framework option (default: langchain, only valid together with
--type agent), forward both to the middleware chain, and error when an agent
scaffold is requested but no installed integration claims it.

The scaffold types live in uipath._cli.models.project_types and
uipath._cli.models.agent_frameworks so framework integrations can import
them and gate their middlewares.

Bump version to 2.14.13.

Fixes #1543

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 and others added 2 commits September 7, 2026 18:19
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…text

show_default rendered '[default: (langchain)]' even though the option is
invalid without --type agent; state the conditional default in the help
sentence instead.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 7, 2026

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 →

@sonarqubecloud

sonarqubecloud Bot commented Sep 7, 2026

Copy link
Copy Markdown

@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>
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