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 3 commits into
Conversation
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>
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`.", |
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>
🚨 Heads up:
|
|



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 function|agent(default:function, shown in--help).uipath newgains--agent-framework google-adk|langchain|llamaindex|microsoft-agent-framework|openai-agents|pydantic-ai, valid only together with--type agent; defaults tolangchainwhen--type agentis given without it.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.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-fnuipath 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(10 new cases), mypy and ruff clean.🤖 Generated with Claude Code