Skip to content

Conversation

@mike-deem-uipath
Copy link
Contributor

@mike-deem-uipath mike-deem-uipath commented Jan 27, 2026

Development Package

  • Add this package as a dependency in your pyproject.toml:
[project]
dependencies = [
  # Exact version:
  "uipath-langchain==0.5.7.dev1004852292",

  # Any version from PR
  "uipath-langchain>=0.5.7.dev1004850000,<0.5.7.dev1004860000"
]

[[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
uipath-langchain = { index = "testpypi" }

self.tool_call_to_ai_message: dict[str, str] = {}
self.current_message: AIMessageChunk
self.seen_message_ids: set[str] = set()
self.pending_message_tool_call_count: dict[str, int] = {}
Copy link
Member

@cristipufu cristipufu Jan 28, 2026

Choose a reason for hiding this comment

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

this won't survive suspend/resume (interruptable tool calls, create_process_tool, create_escalation_tool, deep rag etc)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that also true for tool_call_to_ai_message? If that map is empty after an interrupt, then none of the tool results would be associated with the correct message id (the existing code is creating a new guid for these, but CAS wouldn't know what to do with it and would produce an error event).

Copy link
Member

Choose a reason for hiding this comment

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

Exactly. That's why we were suggesting to loosen up the CAS contracts

def __init__(self):
"""Initialize the mapper with empty state."""
self.tool_call_to_ai_message: dict[str, str] = {}
self.current_message: AIMessageChunk
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be kept as otherwise the tool input won't be properly mapped. When the tool input is streamed by langchain, only the first toolCallChunk contains the tool_id . What will happen with the current changes from this PR is that only the first toolCallChunk will be mapped to a startToolCall (since that's the only one containing and Id) and the rest will be lost. Verified this using a dev version with the changes from this PR : tool_Input appears as empty (since the first tool_call_chunk has no args):

Image

Here are the logs from the agent as well:

Image

Also, if I remember right, CAS does not support streaming the tool input either way so even if the tool_id was present in all chunks, this still wouldn't work, only the first event will create a tool call and the rest wouldn't be discarded I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, after submitting the PR I did notice the inputs were missing....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants