Skip to content

fix: auto-resume conversational llamaindex agents#351

Closed
radu-mocanu wants to merge 1 commit into
mainfrom
fix/llamaindex-conversational-auto-resume
Closed

fix: auto-resume conversational llamaindex agents#351
radu-mocanu wants to merge 1 commit into
mainfrom
fix/llamaindex-conversational-auto-resume

Conversation

@radu-mocanu
Copy link
Copy Markdown
Collaborator

@radu-mocanu radu-mocanu commented May 22, 2026

Summary

  • conversational llamaindex agents now continue prior workflow state automatically when stored context exists
  • first turn (no stored context) still starts a fresh workflow run
  • isConversational is read from uipath.json and surfaced to the runtime via the factory

Why

the llamaindex runtime previously required callers to pass a resume signal explicitly; without it, new input was delivered to a fresh start_event instead of the suspended HumanResponseEvent, so prior context loaded from storage was never used.

Development Packages

uipath-llamaindex

[project]
dependencies = [
  # Exact version:
  "uipath-llamaindex==0.5.14.dev1003511548",

  # Any version from PR
  "uipath-llamaindex>=0.5.14.dev1003510000,<0.5.14.dev1003520000"
]

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

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

Copilot AI review requested due to automatic review settings May 22, 2026 10:40
Copy link
Copy Markdown

Copilot AI left a comment

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 updates the uipath-llamaindex runtime so that conversational workflows automatically resume from previously stored workflow context when it exists, aligning behavior with the langgraph runtime’s “auto-restore by thread/state key” model.

Changes:

  • Add an is_conversational runtime flag and auto-resume logic when prior stored context is detected.
  • Track whether context was restored from storage (_has_prior_state) during context load.
  • Read runtimeOptions.isConversational from config and pass it into the runtime via the factory; bump package version to 0.5.14.

Reviewed changes

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

File Description
packages/uipath-llamaindex/src/uipath_llamaindex/runtime/runtime.py Adds conversational auto-resume behavior based on restored context presence.
packages/uipath-llamaindex/src/uipath_llamaindex/runtime/factory.py Loads isConversational flag and wires it into runtime construction.
packages/uipath-llamaindex/pyproject.toml Bumps package version to 0.5.14.
packages/uipath-llamaindex/uv.lock Updates lock metadata and package version entry.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

try:
with open(self.context.config_path, "r") as f:
config = json.load(f)
except (FileNotFoundError, json.JSONDecodeError):
Comment on lines 150 to +157
workflow_input = UiPathChatMessagesMapper.map_input(input or {})
is_resuming = bool(options and options.resume)

self._context = await self._load_context()

is_resuming = bool(options and options.resume) or (
self.is_conversational and self._has_prior_state
)

@radu-mocanu radu-mocanu added build:dev Create a dev build from the pr and removed build:dev Create a dev build from the pr labels May 22, 2026
@radu-mocanu radu-mocanu force-pushed the fix/llamaindex-conversational-auto-resume branch from f719f2e to 702ffc8 Compare May 22, 2026 11:15
@sonarqubecloud
Copy link
Copy Markdown

@radu-mocanu
Copy link
Copy Markdown
Collaborator Author

Closing — the original premise was wrong. Turn 2 already works on main when locally running with --keep-state-file (matching uipath-langchain's behavior). The OR-clause this PR added actually broke things by routing AgentWorkflow continuation through the HumanResponseEvent branch, which it doesn't consume. No fix needed.

@radu-mocanu radu-mocanu deleted the fix/llamaindex-conversational-auto-resume branch May 22, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build:dev Create a dev build from the pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants