Skip to content

Commit c66e07e

Browse files
fix: keep context tool backwards-compatible with pre-v48 agent bundles (#828)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 313307d commit c66e07e

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/uipath_langchain/agent/tools/context_tool.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def create_context_tool(
150150
llm: BaseChatModel | None = None,
151151
agent: LowCodeAgentDefinition | None = None,
152152
) -> StructuredTool | BaseTool | None:
153-
assert resource.context_type is not None
154153
tool_name = sanitize_tool_name(resource.name)
155154

156155
if resource.context_type == AgentContextType.DATA_FABRIC_ENTITY_SET:

tests/agent/tools/test_context_tool.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,19 @@ def test_case_insensitive_retrieval_mode(self, deep_rag_config):
396396
result = create_context_tool(deep_rag_config)
397397
assert isinstance(result, StructuredToolWithArgumentProperties)
398398

399+
def test_legacy_none_context_type_semantic_search(self, semantic_search_config):
400+
# Agents packaged with storage-schema < v48 have no contextType field.
401+
semantic_search_config.context_type = None
402+
result = create_context_tool(semantic_search_config)
403+
assert isinstance(result, StructuredToolWithOutputType)
404+
assert result.name == "test_semantic_search"
405+
406+
def test_legacy_none_context_type_deep_rag(self, deep_rag_config):
407+
deep_rag_config.context_type = None
408+
result = create_context_tool(deep_rag_config)
409+
assert isinstance(result, StructuredToolWithArgumentProperties)
410+
assert result.name == "test_deep_rag"
411+
399412

400413
class TestHandleSemanticSearch:
401414
"""Test cases for handle_semantic_search function."""

0 commit comments

Comments
 (0)