Skip to content

Conversation

@cristipufu
Copy link
Member

@cristipufu cristipufu commented Oct 18, 2025

Description

Refactors the runtime execution flow to simplify input/output handling, the suspension/resume support, and streamline streaming execution, in preparation for debug and conversational agents.

  • Replaces LangGraphInputProcessor/LangGraphOutputProcessor classes with functional utilities
  • Refactors suspend detection (static/dynamic interrupts)
  • Centralizes graph config building and streaming execution logic

Development Package

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

  # Any version from PR
  "uipath-langchain>=0.0.141.dev1002270000,<0.0.141.dev1002280000"
]

[[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" }

This comment was marked as outdated.

@cristipufu cristipufu force-pushed the fix/refactor_runtime branch 9 times, most recently from b08df2f to 643531d Compare October 20, 2025 09:38
yield self.context.memory
else:
# Create new memory and dispose at the end
async with AsyncSqliteSaver.from_conn_string(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line closes the memory object once it goes out of scope so I wouldn't recommend caching it. It's better to just instantiate it during object construction

self.context.memory = AsyncSqliteSaver.from_conn_string(self.state_file_path)

Then, in the cleanup method of LangGraphRuntime, we will need to invoke self.context.memory.close() or something along these lines. This will also fix the parallel-evaluations issue that was reported last week.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed the caching. Yes, the idea is to use the memory externally provided, otherwise create a new local scope

Copy link
Collaborator

Choose a reason for hiding this comment

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

I see what you mean.

I was thinking of getting removing memory from UiPathRuntimeContext and moving it to the runtime object. IMO this will simplify how the cache objects are created. I currently don't see why the caller would invoke execute with different memory objects.

Since the cache is removed, the concern of maintaining the cache object is moved to the caller. If a called does not provide a cache object, this line will create new objects for every single execution. Caching the sqlite object is a good idea. However, IMO we should not be closing it unless the runtime exists (i.e; via cleanup).

We could change this later too and decouple it from this PR.

message.pretty_print()
else:
# No messages, print node name and state
logger.info("%s", event.payload)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: should this be logger.verbose?

Copy link
Member Author

Choose a reason for hiding this comment

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

doesn't seem like a built-in method

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I meant debug. Basically, my concern is that event may contain sensitive information, and should be only shown during dev time.

@cristipufu cristipufu force-pushed the fix/refactor_runtime branch 12 times, most recently from 6a5d481 to b70e9ab Compare October 21, 2025 10:37
@cristipufu cristipufu force-pushed the fix/refactor_runtime branch from b70e9ab to 015d49b Compare October 21, 2025 10:38
@cristipufu cristipufu merged commit 3d444cd into main Oct 21, 2025
36 checks passed
@cristipufu cristipufu deleted the fix/refactor_runtime branch October 21, 2025 12:35
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.

4 participants