Skip to content

fix(cli): only claim uipath new scaffolds for langchain agents - #1069

Draft
vldcmp-uipath wants to merge 3 commits into
mainfrom
fix/gate-new-middleware-on-project-type
Draft

fix(cli): only claim uipath new scaffolds for langchain agents#1069
vldcmp-uipath wants to merge 3 commits into
mainfrom
fix/gate-new-middleware-on-project-type

Conversation

@vldcmp-uipath

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

Copy link
Copy Markdown
Contributor

Important

Draft until UiPath/uipath-python#1886 is approved and uipath 2.14.14 is published. The middleware imports uipath._cli.models.project_types / uipath._cli.models.agent_frameworks, which only exist from 2.14.14. For dev-build validation and TestPyPI publishing, this PR temporarily pins uipath==2.14.14.dev1018867600 (the dev build of #1886) sourced from the testpypi index, with uv.lock resolved against it. Before marking ready for review: restore "uipath>=2.14.14, <2.15.0", drop the [tool.uv.sources] testpypi entry for uipath, and run uv lock.

Problem

langgraph_new_middleware returns should_continue=False unconditionally, so installing uipath-langchain hijacks uipath new process-wide and the base function scaffold becomes unreachable (UiPath/uipath-python#1543). This also breaks the uip function new -l py path, which delegates to uipath new and expects a function project.

Changes

  • The middleware now takes project_type / agent_framework (forwarded by uipath new since 2.14.14) and claims the command for --type auto (the default: an installed framework wins, preserving today's behaviour) and for --type agent with the langchain framework; everything else passes through to the base scaffold or another framework's integration.
  • Defaults (ProjectType.AGENT / AgentFramework.LANGCHAIN) preserve current behaviour when an older uipath CLI calls with just the project name.
  • Comparisons use != rather than identity so callers passing plain strings gate correctly (the enums subclass str).
  • Version bumped to 0.17.6; uipath floor raised to 2.14.14.

Behaviour with uipath >= 2.14.14

Command Result
uipath new my-fn (or --type auto) LangGraph agent project (auto default: installed framework claims it)
uipath new my-fn --type function function project (guaranteed — previously unreachable)
uipath new my-agent --type agent LangGraph agent project (unchanged)
uipath new x --type agent --agent-framework pydantic-ai passes through to that framework's integration

Testing

  • 7/7 in tests/cli/test_new.py (5 new cases incl. plain-string gating and old-CLI default), mypy and ruff clean, run against the TestPyPI dev build uipath==2.14.14.dev1018867600.
  • Verified end-to-end in a venv with both packages installed editable.

🤖 Generated with Claude Code

Development Package

  • Use uipath pack --nolock to get the latest dev build from this PR (requires version range).
  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath-langchain==0.17.6.dev1010695747",

  # Any version from PR
  "uipath-langchain>=0.17.6.dev1010690000,<0.17.6.dev1010700000"
]

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

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

[tool.uv]
override-dependencies = [
    "uipath-langchain>=0.17.6.dev1010690000,<0.17.6.dev1010700000",
]

vldcmp-uipath and others added 2 commits September 9, 2026 14:32
langgraph_new_middleware intercepted `uipath new` unconditionally, making
the base function scaffold unreachable whenever uipath-langchain was
installed (UiPath/uipath-python#1543). Gate it on the project_type and
agent_framework values forwarded by uipath >= 2.14.13 and pass through
anything that is not an agent scaffold for the langchain framework.

Bump version to 0.17.2 and raise the uipath floor to 2.14.13, which ships
the shared ProjectType/AgentFramework enums.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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/gate-new-middleware-on-project-type branch from bb51178 to 0fbab93 Compare September 9, 2026 11:47
@sonarqubecloud

sonarqubecloud Bot commented Sep 9, 2026

Copy link
Copy Markdown

…ath dev build

`uipath new` now defaults to --type auto, where an installed agent
framework wins over the base function scaffold — restore that claim here
so the default stays seamless. Explicit --type agent still requires the
langchain framework; everything else passes through. Track the uipath
2.14.14.dev1018867600 dev build that introduces ProjectType.AUTO.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant