Skip to content

feat(context-grounding): add start_deep_rag_from_attachments primitive - #1872

Merged
cfauchere merged 9 commits into
mainfrom
feat/deep-rag-from-attachments
Aug 28, 2026
Merged

feat(context-grounding): add start_deep_rag_from_attachments primitive#1872
cfauchere merged 9 commits into
mainfrom
feat/deep-rag-from-attachments

Conversation

@cfauchere

@cfauchere cfauchere commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What

Adds a single-call primitive that creates the ephemeral index and starts the Deep RAG task in one server operation. Callers no longer need to create the index separately and wait for ingestion before starting the task.

Changes

  • New SDK methods start_deep_rag_from_attachments(_async) on ContextGroundingService, hitting POST /ecs_/v2/deeprag/create (vdbs DeepRagController.CreateAsync — the collection-level Create action registered in the OData model).
  • CreateDeepRag interrupt model gains an optional attachments: list[str] | None field; the ephemeral-index validator now accepts attachments as an alternative to index_id.
  • UiPathResumeTriggerCreator dispatches to the new SDK method when CreateDeepRag.attachments is set; the existing start_deep_rag_ephemeral_async / start_deep_rag_async paths are untouched.

Why

The two-step flow (create ephemeral index → wait for ingestion → create Deep RAG task) collapses into one server call. On the client side that removes the middle WaitEphemeralIndex interrupt — the trailing wait for task completion remains.

Notes

The endpoint URL is POST /ecs_/v2/deeprag/create based on vdbs' OData config (EnableUnqualifiedOperationCall = true + the collection action Create in ODataModelConfiguration.cs:60). Worth a smoke test against a running vdbs before merge to confirm the route resolves.

@github-actions

Copy link
Copy Markdown

🚨 Heads up: uipath-langchain cross-tests are FAILING 🚨

Your changes may break the uipath-langchain-python integration.

⚠️ These checks are NOT enforced by branch protection rules. Please review the failures before merging.

🔍 Inspect the failed run →

@cfauchere
cfauchere marked this pull request as ready for review August 27, 2026 01:12
Copilot AI lite review requested due to automatic review settings August 27, 2026 01:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Context Grounding “single-call” Deep RAG primitive that creates an ephemeral index from attachments and starts the Deep RAG task in one server operation, and wires that flow into resume-trigger handling in uipath-platform.

Changes:

  • Add start_deep_rag_from_attachments(_async) to ContextGroundingService, posting to POST /ecs_/v2/deeprag/create.
  • Extend the CreateDeepRag interrupt model with optional attachments and route resume-trigger creation through the new SDK method when provided.
  • Bump uipath-platform to 0.2.22 and update lockfiles.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/uipath/uv.lock Updates dependency lock and uipath-platform version reference.
packages/uipath-platform/uv.lock Updates dependency lock for uipath-platform.
packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py Adds attachments-based dispatch to the new Deep RAG primitive.
packages/uipath-platform/src/uipath/platform/context_grounding/_context_grounding_service.py Adds new Deep RAG-from-attachments request spec + public methods; adds deprecations.
packages/uipath-platform/src/uipath/platform/common/interrupt_models.py Adds attachments to CreateDeepRag and relaxes validation for ephemeral Deep RAG creation.
packages/uipath-platform/pyproject.toml Bumps package version to 0.2.22.
Suppressed comments (1)

packages/uipath-platform/src/uipath/platform/context_grounding/_context_grounding_service.py:1407

  • The PR description says existing start_deep_rag_ephemeral_async/start_deep_rag_async paths are “untouched”, but this change adds a @deprecated decorator which will emit warnings and is a behavior change for callers. Also, start_deep_rag_from_attachments_async is not a general replacement for start_deep_rag_ephemeral_async (it requires attachments and does not support glob_pattern). Either update the PR description to reflect this deprecation or reconsider the deprecation here / adjust the deprecation message to describe the narrower replacement scope.
    @deprecated(
        "Use start_deep_rag_from_attachments_async instead — one call, no separate index step."
    )

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +1362 to 1366
"Use start_deep_rag_from_attachments instead — one call, no separate index step."
)
@resource_override(resource_type="index", resource_identifier="index_name")
@traced(name="contextgrounding_start_deep_rag", run_type="uipath")
async def start_deep_rag_ephemeral(
Comment thread packages/uipath-platform/src/uipath/platform/resume_triggers/_protocol.py Outdated
folder_path=folder_path,
)

response = self.request(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what do we return if attachment isn't found? 404? should we catch that and return user readable message?

@cfauchere cfauchere Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the workflow just fails - maybe we validate attachment exist before we accept the request

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Today the create endpoint returns 201 without touching Orchestrator — a bad attachment id only surfaces later as a Failed DeepRag status.

Fixing server-side in a follow-up vdbs PR: OrchestratorClient.GetAttachmentByIdAsync will translate the downstream 404 into RecordNotFoundException with a localized Attachment_NotFound message (mirrors the SystemIndexesService.cs:82-85 pattern), and CreateDeepRagFromAttachmentsAsync will resolve the attachments up front so the failure is synchronous. That reaches the SDK as a real 404, which BaseService.request already wraps in EnrichedException (with the localized message pulled by error_info) — so no SDK change needed here.

Clement Fauchere added 9 commits August 28, 2026 14:24
Adds a single-call primitive that creates the ephemeral index and
starts the Deep RAG task in one server operation. Callers no longer
need to create the index separately and wait for ingestion before
starting the task.

- New SDK methods start_deep_rag_from_attachments(_async) on
  ContextGroundingService, hitting POST /ecs_/v2/deeprag/create.
- CreateDeepRag interrupt model gains an optional attachments field;
  the ephemeral-index validator now accepts attachments as an
  alternative to index_id.
- UiPathResumeTriggerCreator dispatches to the new SDK method when
  CreateDeepRag.attachments is set; existing paths untouched.
- New feature flag constant DEEP_RAG_FROM_ATTACHMENTS_FEATURE_FLAG
  ("EnableDeepRagFromAttachments") registered in the shared registry
  so downstream callers can gate the switch.
The single caller can migrate in one step; a flag would only add code
to remove later. Backend rollback path is unchanged either way.
mypy resolved `list[str]` in the class body to the sibling
`ContextGroundingService.list` method (a Function). Switched to
`List[str]` to match the file's convention.

Bumped uipath-platform 0.2.20 -> 0.2.22 (0.2.21 already on PyPI).
Superseded by start_deep_rag_from_attachments{,_async}, which does
index creation and task start in one server call. The existing
methods keep working (the dispatcher still routes to them for the
is_ephemeral_index=True + index_id path); callers should migrate
to the new attachments-based primitive.
- CreateDeepRag validator now rejects empty attachments and forbids
  combining attachments with index_id/index_name.
- Dispatcher branch changed to explicit `is not None` for parity
  with the validator's semantics.
- New SDK tests exercise start_deep_rag_from_attachments{,_async}:
  URL, payload shape, User-Agent, default citation_mode=INLINE.
- New HITL tests cover the attachments dispatch path and the two
  new validator errors.
The spec builder called _resolve_folder_key(None, None) and then
header_folder(None, None) unconditionally, which sent a header the
test mocks did not include and left the mock URL unrequested. Match
the ephemeral spec's pattern: only add the folder header when the
caller actually passes folder_key or folder_path.
- test_start_deep_rag_from_attachments_with_folder_key exercises the
  spec's folder branch, verifying the header ships with the request.
- test_create_deep_rag_attachments_rejects_index_name covers the
  index_name half of the mutual-exclusivity OR that the existing
  index_id test only touched.
@cfauchere
cfauchere force-pushed the feat/deep-rag-from-attachments branch from 7591636 to d9f6daf Compare August 28, 2026 19:25
@sonarqubecloud

Copy link
Copy Markdown

@cfauchere
cfauchere merged commit c805809 into main Aug 28, 2026
222 of 226 checks passed
@cfauchere
cfauchere deleted the feat/deep-rag-from-attachments branch August 28, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants