Skip to content

feat(agent): let the LLM pick the folder for semantic context searches [PC-5304] - #1176

Open
tudormatei1 wants to merge 1 commit into
mainfrom
feat/PC-5304-dynamic-folder-prefix
Open

tudormatei1 wants to merge 1 commit into
mainfrom
feat/PC-5304-dynamic-folder-prefix

Conversation

@tudormatei1

@tudormatei1 tudormatei1 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Agents can now let the LLM choose the Context Grounding folder on each search. Before this, a semantic context could only be scoped to one folder with a fixed value or an agent input set at job start. That doesn't work when one session asks about several folders, for example one folder per patent docket, where the docket number only exists in the folder name.

When a semantic context's folderPathPrefix.variant is dynamic, the tool gets an optional folder_path_prefix argument:

  • Its description is the author's text from Agent Builder, or a default when that text is missing or empty.
  • It's advertised as "type": "string", but null and blank values are accepted and mean "search the whole index". Some models send null for optional arguments, and that shouldn't fail the job.
  • Static and argument prefixes behave as before and win over anything the LLM sends. DeepRAG and batch transform are unchanged.

Testing

  • TestDynamicFolderPathPrefix runs the real tool, and its wrapper for argument queries, and checks the scope sent to unified_search_async. It covers: the schema, the author's description and the default, a folder scoping the search for dynamic, static and argument queries, two calls with different folders, and None, "" and null searching the whole index.

  • End to end on alpha, with Studio Web, a local robot on this branch, and an index with one folder per docket: I asked about a docket that the unscoped top 3 never returns. The LLM sent folder_path_prefix: "Dockets/D102" and got that docket's file. With the deployed runtime, the same question found nothing.

  • Checked against a real index how Context Grounding matches the folder:

    • matching is case-insensitive;
    • the leading / is optional;
    • subfolders are included;
    • it's a plain text prefix, so Reports/20 matches both Reports/2023 and Reports/2024;
    • /** returns nothing.

    The default description's example, Reports/2024, fits that.

Rollout

  • This can merge any time. Agent Builder hides the option behind EnableContextGroundingDynamicFolderPathPrefix (UiPath/Agents#6804, UiPath/gitops-centralized-cluster#611672), which stays off in every environment until this runtime is there.
  • uipath-agents pins uipath-langchain exactly, so its bump to 0.18.56 follows in a separate PR once this is released.

🤖 Generated with Claude Code

@tudormatei1
tudormatei1 marked this pull request as ready for review November 4, 2026 12:39
Copilot AI balanced review requested due to automatic review settings November 4, 2026 12:39
Agents could limit a Context Grounding search to one folder only with a
fixed value or an agent input set at job start. When a semantic
context's folder path prefix is set to dynamic, the tool now takes an
optional folder_path_prefix argument, so the LLM can scope each search
to a folder, or leave it out to search the whole index.

The argument's description is the one the author wrote in Agent
Builder, with a default when there is none. It is advertised as a plain
string, but a null or blank value is accepted and means no filter, so a
model sending null does not fail the job. Static and argument prefixes
work as before and win over anything the LLM sends.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tudormatei1
tudormatei1 force-pushed the feat/PC-5304-dynamic-folder-prefix branch from 52b542f to 111c3b2 Compare November 4, 2026 12:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The reported end-to-end search returned HTTP 400, leaving scoped retrieval against a populated index and the folder-path format’s leading-slash requirements unverified.

No open issues 🎉

What changed in this PR

Adds per-search folder selection to semantic context tools, allowing agents to search different Context Grounding folders within one session.

Changes:

  • Adds an optional dynamic folder_path_prefix argument with author-provided or default guidance, while preserving static and argument prefix precedence.
  • Adds tests for schema generation, per-call folder selection, and omitted, blank, or null values.
  • Bumps the package version to 0.18.52.
File Description
uv.lock Updates the locked project version to 0.18.52.
tests/​agent/​tools/​test_context_tool.py Tests dynamic folder schemas and search scoping through tool invocation.
src/​uipath_langchain/​agent/​tools/​context_tool.py Adds the dynamic folder argument and resolves it for semantic searches.
pyproject.toml Updates the package version to 0.18.52.

Review effort: Balanced

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants