feat: include index_id in context grounding tool output for tracing#742
Open
feat: include index_id in context grounding tool output for tracing#742
Conversation
The context grounding tool's trace span has an index_id field but it was never populated because the tool output didn't include it. The index ID is resolved inside the SDK's unified_search but discarded before reaching the instrumentor. This change captures the resolved index_id from the search result on the retriever and includes it in the semantic search tool return value, so the trace instrumentor in uipath-agents-python can write it to the span. Requires a corresponding SDK change to expose index_id on UnifiedQueryResult. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3 tasks
Depends on UiPath/uipath-python#1534 which exposes index_id on the result. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Depends on UiPath/uipath-python#1534. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
index_idfrom the SDK'sunified_searchresult onContextGroundingRetriever(both sync and async paths)index_idin the semantic search tool return value so the trace instrumentor inuipath-agents-pythoncan write it to thecontextGroundingToolspanContext
The
contextGroundingTooltrace span has anindex_idfield defined inuipath-agents-python(ContextGroundingToolSpanAttributes.index_id), andset_context_grounding_resultsalready looks forcontent.get("index_id")in the tool output. But it was never populated because:index_name→index_idinternally inunified_searchbut doesn't return it{"documents": [...]}Without
index_idin the trace, debugging Context Grounding issues (like empty search results) requires manual lookup — you can't go from the trace to the CG service logs.Dependencies
Requires a corresponding change in
uipath-pythonto exposeindex_idonUnifiedQueryResult. Until then,resolved_index_idwill beNone(the code usesgetattrwith a fallback to avoid breaking).Test plan
resolved_index_idis populated afterunified_searchwhen SDK exposesindex_idindex_idappears in thecontextGroundingTooltrace span attributesindex_id(getattrfallback returnsNone)🤖 Generated with Claude Code