fix(cli): add --type and --agent-framework options to uipath new - #1886
fix(cli): add --type and --agent-framework options to uipath new#1886vldcmp-uipath wants to merge 1 commit into
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>
598ff8f to
28a14dc
Compare
🚨 Heads up:
|
`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>
28a14dc to
fe4e537
Compare
|



Problem
When
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 a LangGraph agent project with nouipath.json. Fixes #1543.Changes
uipath newgains--type auto|function|agent(default:auto, shown in--help).autopreserves 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/agentrequest one explicitly — callers that need a guaranteed function project (e.g. theuipfunctions-tool passthrough) should pass--type function.uipath newgains--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).Middlewares.next("new", name, project_type=..., agent_framework=...).--type agentis 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'newmiddlewares share:autois claimed by whichever integration is installed,agentonly by the framework it names,functionby none. The rule is identical for every framework, so it lives here instead of being repeated (and drifting) in each integration repo.ProjectTypeandAgentFrameworkStrEnums live inuipath._cli.models.project_types/uipath._cli.models.agent_frameworksso framework integrations can import them;AgentFramework.<member>.packagereturns the integration's PyPI package name (note:microsoft-agent-frameworkships asuipath-agent-framework).Behaviour
uipath new my-fn(or--type auto)uipath new my-fn --type functionuipath new my-agent --type agentuipath new my-agent --type agent --agent-framework pydantic-aiuipath new x --agent-framework langchain--type agentCompatibility
Middlewares.next(kwargs trimmed + "Install the latest version for uipath packages" warning), so behaviour with an outdateduipath-langchainis unchanged until it updates — companion PR in uipath-langchain-python gates its middleware on these values.str, so middlewares comparing plain strings keep working.Testing
tests/cli/test_new.py(19 new cases), mypy and ruff clean.🤖 Generated with Claude Code
Development Packages
uipath