fix: keep context tool backwards-compatible with pre-v48 agent bundles#828
Open
milind-jain-uipath wants to merge 2 commits intomainfrom
Open
fix: keep context tool backwards-compatible with pre-v48 agent bundles#828milind-jain-uipath wants to merge 2 commits intomainfrom
milind-jain-uipath wants to merge 2 commits intomainfrom
Conversation
The DataFabric PR (#726) added `assert resource.context_type is not None` at the top of `create_context_tool`. Agents packaged with storage-schema < v48 don't carry a `contextType` field, so the assert fires at runtime and the agent fails to start. The downstream `context_type == DATA_FABRIC_ENTITY_SET` check already short-circuits correctly when `context_type` is None, and the semantic-search / deep-rag / batch-transform handlers don't read `context_type` at all — they branch on `settings.retrieval_mode`, which legacy bundles always populate. So removing the assert restores the pre-PR behaviour for legacy bundles without affecting v48+ flows. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Includes the context_type backwards-compatibility fix so legacy agent bundles (storage-schema < v48) start cleanly under the new release. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
UIPath-Harshit
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR #726 (Data Fabric tool support) added
assert resource.context_type is not Noneat the top ofcreate_context_tool. Agents packaged with storage-schema < v48 don't carry acontextTypefield — at runtime they hit this assert and fail to start.This is a backwards-compatibility regression:
uipath-langchain-pythonmust accept all historical agent schema versions, since older customer bundles (packaged with older clients) flow through the runtime without the v48 TypeScript migration ever running.Why removing the assert is safe
if resource.context_type == AgentContextType.DATA_FABRIC_ENTITY_SETcheck already evaluatesFalsewhencontext_typeisNone, so legacy bundles never enter the DataFabric branch (which is correct — DataFabric is v48-only).handle_semantic_search,handle_deep_rag,handle_batch_transform— never readcontext_type. They dispatch onsettings.retrieval_mode, which legacy v47 bundles always populate.Test plan
TestCreateContextToolcoveringcontext_type=Nonefor both semantic search and deep RAG pathsuv run pytest tests/agent/tools/test_context_tool.py— 87/87 passuv run ruff check— cleanManual end-to-end testing
1. Download an agent with a context-grounding tool
Created an agent in Agent Builder with a
TestIndexcontext-grounding resource attached, then pulled the project locally:2. Modify the bundle to simulate a legacy (pre-v48) shape
Inlined the resource into
agent.json.resourcesand removedcontextType. Both top-levelagent.jsonand the cached.agent-builder/agent.jsonwere edited (the runtime restores the top-level from the cached copy on each invocation):Resulting resource entry in
agent.json:3. Run with
main(assert intact)git -C ../uipath-langchain-python checkout main uv run --project ../uipath-agents-python uipath run agent.json '{}'Result: ❌
AgentStartupErrorcaused byAssertionErroratcontext_tool.py:153.Full output (main)
4. Run with this branch (assert removed)
git -C ../uipath-langchain-python checkout fix/context-type-backcompat uv run --project ../uipath-agents-python uipath run agent.json '{}'Result: ✓
Status: Completed, agent runs to end normally.Full output (fix/context-type-backcompat)
Same
agent.json, same runtime path — only thecontext_typeassert was removed.Related
🤖 Generated with Claude Code