Skip to content

fix: add NOSTREAM tag for analyze-file-tool internal llm-call#950

Merged
norman-le merged 6 commits into
mainfrom
fix-tool-call-internal
Jun 30, 2026
Merged

fix: add NOSTREAM tag for analyze-file-tool internal llm-call#950
norman-le merged 6 commits into
mainfrom
fix-tool-call-internal

Conversation

@maxduu

@maxduu maxduu commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Bug: The Analyze Files tool's internal LLM call was leaking its response into the conversation stream as a visible content part, causing duplicate content in the chat UI.

Root cause: Commit 67a85715 (2026-03-31) added map_ai_message_to_events() to handle full AIMessage objects for PII masking. This inadvertently caused the internal LLM's AIMessage — captured via inherited graph callbacks in var_child_runnable_config — to be processed and emitted as a content part.

Fix: Tag the internal LLM call's config with LangGraph's built-in TAG_NOSTREAM, which tells StreamMessagesHandler to skip capturing that call's messages entirely.

Single Response from Agent (Internal LLM output not streamed)

Screen.Recording.2026-06-29.at.3.54.22.PM.mov

Autonomous agents still working with the tool:

image

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.

Pull request overview

This PR prevents internal LLM calls made by the analyze-files internal tool from being forwarded into the user-facing conversational message stream, by tagging those LLM calls and filtering them in the runtime stream bridge.

Changes:

  • Introduces a dedicated tag (INTERNAL_TOOL_LLM_CALL_TAG) to mark LLM calls executed as part of internal tool execution.
  • Stamps that tag onto the analyze-files tool’s non-streaming LLM invocation config.
  • Filters tagged message events out of UiPathLangGraphRuntime.stream() so they don’t reach the conversation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/uipath_langchain/runtime/runtime.py Filters out message events for tagged internal-tool LLM calls during graph streaming.
src/uipath_langchain/agent/tools/internal_tools/analyze_files_tool.py Adds an internal-call tag and applies it to the tool’s LLM invocation config.

Comment thread src/uipath_langchain/runtime/runtime.py Outdated
Comment thread src/uipath_langchain/runtime/runtime.py Outdated
@norman-le norman-le changed the title fix: tag analyze-file-tool llm-call as internal fix: add NOSTREAM tag for analyze-file-tool internal llm-call Jun 29, 2026
@sonarqubecloud

Copy link
Copy Markdown

@maxduu maxduu requested a review from andrewwan-uipath June 29, 2026 20:46
@norman-le norman-le merged commit 49612ca into main Jun 30, 2026
49 checks passed
@norman-le norman-le deleted the fix-tool-call-internal branch June 30, 2026 01:14
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.

4 participants