fix(cli): add --type to uipath new so function projects stay reachable - #1886
Conversation
There was a problem hiding this comment.
🟢 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(defaultfunction) and--agent-framework ...(valid only with--type agent) touipath new, forwarding both as enums through the middleware chain. - Introduced shared
StrEnummodels (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.
| 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`.", |
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>
f6e07d4 to
e38a166
Compare
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>
28a14dc to
fe4e537
Compare
5d9f76d to
e35dc3b
Compare
`uipath new` ships no `--agent-framework` option: the core takes the framework from whichever integration package is installed, and fails when several are (UiPath/uipath-python#1886). Framework Selection still told readers the flag existed, which would have them type an option the command rejects. State the two type values that do exist, note that the framework cannot be named on the command line, and record the several-installed failure so "install exactly one" reads as a requirement rather than a preference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VqfFdgnQFGJ8EPGXn6HC82
a934a57 to
35a4063
Compare
`uipath new` was unconditionally hijacked by any installed agent framework integration (their middleware always returned should_continue=False), making the base function scaffold unreachable once uipath-langchain was in the environment (#1543). The fix is in the dispatch rather than in the integrations: the `new` middleware chain is the only way an agent scaffold happens, and the base CLI now decides whether to consult it at all. - `--type auto` (the new default) keeps today's behaviour: an installed framework claims the scaffold, otherwise a function project is created. - `--type function` never consults the chain, so no installed framework can intercept it. - `--type agent` consults the chain and fails when nothing claims it, rather than quietly producing a function project. The framework is never named on the command line: it is whichever integration package the environment has. With several installed the command errors instead of resolving by registration order, naming the packages it found — discovered from the registered middlewares and their entry points, so the CLI never hardcodes the list of frameworks that exist. Integrations need no changes and no new uipath floor; `Middlewares.next("new", name)` is unchanged. Docs cover the new option: the previously missing `new` section in the CLI reference, a Claude Agent SDK row in the coded-agents framework table, and explicit-type notes in the agents, functions and Studio Web guides. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
- Move AGENT_FRAMEWORKS_DOCS_URL to _cli/_utils/_constants.py. - Drop the ProjectType module docstring's note about which packages import it: the integrations no longer do. - Trim the explanation from _installed_agent_framework_packages() and from the middleware-chain comment in the command. - State what `--type function` guarantees in its test, instead of pointing at the issue it came from. - Drop "Using the installed '<framework>' agent framework." from the CLI reference transcript: the command no longer resolves a framework by name, so it no longer prints that line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
With several agent framework packages in the same environment, `uipath
new` could only report the ambiguity and ask for one to be uninstalled.
It now takes the choice on the command line:
uipath new my-agent --type agent --agent-framework uipath-langchain
The value is the integration package, spelled exactly as the errors
list it, and the scaffold is dispatched to that framework alone rather
than through the chain, so another one cannot claim it first. Naming a
framework that is not installed lists the ones that are, and the option
stays limited to `--type agent`.
The accepted values are still discovered, never hardcoded: frameworks
come from the registered `new` middlewares, named after the
distribution that registered them, so a framework this CLI has never
heard of can be selected by name like any other.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
35a4063 to
129c451
Compare
🚨 Heads up:
|
| console.error( | ||
| "Multiple agent frameworks are installed: " | ||
| + ", ".join(framework.package for framework in installed) | ||
| + f".\nPick one with `uipath new {name} --type agent " | ||
| "--agent-framework <framework>`, or run " | ||
| f"`uipath new {name} --type function` to create a function project." | ||
| ) |
There was a problem hiding this comment.
this is a breaking change. let s warn that there are multiple frameworks installed but the scaffold should not fail
Environments with more than one agent framework package scaffolded fine before `--type` existed — the first discovered integration claimed the project. Turning that into an error would be a breaking change, so the old outcome stays: `uipath new` warns, names all the installed frameworks and the one it picked, and scaffolds with the first discovered. `--agent-framework` remains the way to choose deliberately. The pick is dispatched to that framework's middleware directly, so the warning always names the integration that actually scaffolds. Discovery order is the entry-point order (a filesystem accident, stable per environment); listings shown to the user stay sorted. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
79e6f37 to
195fac3
Compare
|



Problem
When an agent framework integration such as
uipath-langchainis installed, its entry-point middleware claimsuipath newunconditionally (should_continue=Falsein all cases), so the base function scaffold is unreachable —uipath new <name>always produces an agent project with nouipath.json. Fixes #1543.Changes
The fix lives in the dispatch, not in the integrations. The
newmiddleware chain is the only route to an agent scaffold, and cli_new.py is its only caller, so the base CLI decides whether the frameworks are consulted at all:--type auto(the new default) preserves today's behaviour — an installed framework claims the scaffold; with none installed, the base function project is created.--type functionnever calls the chain, so no installed framework can intercept it. This is the option callers needing a guaranteed function project (e.g. theuipfunctions-tool passthrough) should pass.--type agentcalls the chain and errors when nothing claims it, instead of quietly producing a function project. It is a guarantee, which is what makes it useful in CI.--agent-frameworkpicks between installed frameworks:uipath new my-agent --type agent --agent-framework uipath-langchain. It takes the integration package, spelled exactly as the error messages list it, is only valid with--type agent, and dispatches to that framework alone so another cannot claim the scaffold first. With one framework installed there is nothing to choose and it is optional; with several and no choice given, the command warns — naming the installed frameworks and the one it picked — and scaffolds with the first discovered, preserving the pre---typebehaviour rather than breaking those environments.There is still no list of frameworks in the base package — no enum, no framework-to-package map, nothing to update when an eighth integration ships. The frameworks that exist, and the names
--agent-frameworkaccepts, are derived from the registerednewmiddlewares and the distributions that registered them, so a framework this CLI has never heard of is named and selected like any other.Integrations need no changes.
Middlewares.next("new", name)is byte-identical to today's call, so existing releases keep working as they are, with no newuipathfloor, no kwargs, and no legacy-signature warnings.Behaviour
uipath new x(auto)uipath new x --type functionuipath new x --type agentTesting
tests/cli/test_new.py, 1490/1490 acrosstests/cli; mypy and ruff clean.uipath-langchain0.17.8 from itsmain:autoscaffolds the LangGraph agent,--type functionnow reaches the base scaffold (the bug),--type agentscaffolds the agent. With a second integration installed, bothautoandagentwarn and scaffold with the first discovered framework while--type functionstill succeeds;--agent-framework uipath-langchainselects explicitly, and a value that is not an installed package lists the ones that are.--typechoices.🤖 Generated with Claude Code
Development Packages
uipath