Skip to content

Conversation

@Chibionos
Copy link
Contributor

@Chibionos Chibionos commented Jan 9, 2026

Summary

Adds support for suspend/resume pattern in evaluation runtime, enabling agents to suspend execution when invoking RPA processes and resume after completion.

Key Changes

Suspend Detection (_runtime.py)

  • Runtime detects UiPathRuntimeStatus.SUSPENDED after agent execution
  • Extracts trigger information from suspended executions
  • Skips evaluators during suspension (evaluators only run on SUCCESSFUL completion)
  • Returns triggers in partial results for resume context

Resume Support (cli_eval.py)

  • Added --resume flag to evaluation CLI
  • Loads checkpoint state and continues from interruption point
  • Passes resume context to runtime

Trigger Pass-Through

  • Suspended executions return triggers with structure:
    • interruptId: Unique interrupt identifier
    • triggerType: Type of trigger (e.g., "Api")
    • payload: InvokeProcess details (process name, input arguments, folder path)

Comprehensive Logging

  • Suspension detection events (🔴 DETECTED SUSPENSION)
  • Trigger extraction details (📋 Extracted N trigger(s))
  • Evaluator skip reasons (⏭️ Skipping evaluators)
  • Trigger pass-through confirmation (✅ Passing through triggers)
  • Resume mode indication (🟢 RESUMED execution)

Testing

Testing is done via the sample agent in the companion PR: UiPath/uipath-langchain-python#397

Related

Companion PR for sample agent: UiPath/uipath-langchain-python#397

@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Jan 9, 2026
@Chibionos
Copy link
Contributor Author

Quick Testing Guide

Install the Dev Version

pip install git+https://github.com/UiPath/[email protected]

Run Quick Test

cd samples/event-trigger

# Test 1: Direct runtime test
python -c "
import asyncio
from uipath.functions.runtime import UiPathFunctionsRuntime

async def test():
    runtime = UiPathFunctionsRuntime(
        'test_suspend_resume_agent.py',
        'main', 
        'test_suspend_resume_agent'
    )
    result = await runtime.execute({'query': 'Test'})
    print(f'✓ Status: {result.status}')
    print(f'✓ Has Trigger: {result.trigger is not None}')
    if result.trigger:
        print(f'✓ Process: {result.trigger.payload[\"process_name\"]}')

asyncio.run(test())
"

# Test 2: Evaluation test
uipath eval test_suspend_resume_agent evaluations/test_suspend_resume.json --output-file test_output.json
cat test_output.json | python -m json.tool | grep -A 5 "status"

Expected Results

Status: SUSPENDED
Trigger exists with process name and arguments
Evaluation output shows suspended state in JSON

Key Files Changed

  • Functions Runtime: src/uipath/functions/runtime.py (+70 lines)

    • New _detect_langgraph_interrupt() method
    • Trigger extraction from __interrupt__ field
  • Evaluation Runtime: src/uipath/_cli/_evals/_runtime.py (+58 lines)

    • SUSPENDED status detection
    • Skip evaluators when suspended
    • Publish suspended event
  • Test Agent: samples/event-trigger/test_suspend_resume_agent.py (new file)

    • Demonstrates correct interrupt pattern
    • Uses checkpointer and returns raw dict

Tag: v2.4.9-dev.suspend-resume
Branch: investigate-rpa-samples

@Chibionos Chibionos changed the title feat: Add suspend/resume support for RPA invocations in evaluations feat: add suspend/resume support for RPA invocations in evaluations Jan 10, 2026
Chibi Vikram and others added 6 commits January 12, 2026 07:26
This change implements the suspend/resume pattern for RPA process invocations
within the evaluation runtime, ensuring evaluations can pause when waiting for
external job completion and resume after the job finishes.

Key Changes:

1. Functions Runtime (src/uipath/functions/runtime.py):
   - Added _detect_langgraph_interrupt() method to detect LangGraph's
     __interrupt__ field and extract trigger information
   - Modified execute() to check for interrupts and return SUSPENDED status
   - Converts InvokeProcess objects to UiPathResumeTrigger for serverless executor

2. Evaluation Runtime (src/uipath/_cli/_evals/_runtime.py):
   - Added SUSPENDED status detection after agent execution
   - Populates agentExecutionOutput with trigger data when suspended
   - Skips evaluator execution for suspended runs
   - Publishes EvalRunUpdatedEvent with suspended status to event bus

3. Test Agent (samples/event-trigger/test_suspend_resume_agent.py):
   - Updated to use MemorySaver checkpointer (required for LangGraph interrupts)
   - Returns raw dict to preserve __interrupt__ field for runtime detection

The implementation follows the established pattern from UiPathResumableRuntime
and ensures proper trigger extraction and status handling throughout the
evaluation lifecycle.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit adds three key features to support suspend/resume in evaluations:

1. Add --resume option to uipath eval command
   - Added resume flag to CLI arguments
   - Passed through to UiPathEvalContext
   - Enables resuming suspended evaluations

2. Use known execution_id for single runtime runs
   - Added job_id field to UiPathEvalContext
   - Passed ctx.job_id from UiPathRuntimeContext to eval context
   - UiPathEvalRuntime now uses job_id as execution_id when available
   - Falls back to UUID generation when job_id is None

3. Return inner runtime triggers to eval runtime result
   - Collect all triggers from evaluation run results
   - Pass triggers through to top-level UiPathRuntimeResult
   - Enables serverless executor to detect and process suspend triggers
   - Preserves trigger information from nested runtime executions

These changes work with the suspend/resume detection already implemented
to enable full suspend/resume flow for RPA process invocations in evaluations.

Testing will be done with the test agent in uipath-langchain-python repo.
…runtime

Added detailed logging to track the suspend/resume flow:

Execution Start:
- Log execution ID, job ID, and resume mode status
- Clear indication when resume mode is enabled

Suspension Detection:
- Log when SUSPENDED status is detected
- Show number of triggers extracted
- Display each trigger's details

Trigger Pass-through:
- Log trigger collection from all evaluation runs
- Show count and details of triggers being passed through
- Clear confirmation when triggers reach top-level result

This makes the suspend/resume mechanism transparent and easy to debug
for both development and production troubleshooting.
The draw.io diagram is not working properly.
Testing will be done in the uipath-langchain-python repo sample instead.
@Chibionos Chibionos force-pushed the investigate-rpa-samples branch from 0a124f0 to a35d2a5 Compare January 12, 2026 15:26
@mjnovice
Copy link
Contributor

Just to understand, so the suspend and resume is actually being done by the agent and not the orchestrator, right ?

from uipath.runtime.errors import (
UiPathErrorCategory,
UiPathErrorCode,
UiPathErrorContract,
Copy link
Member

Choose a reason for hiding this comment

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

you need to undo everything in this file (this is used for arbitrary python code, no langgraph deps)


result = UiPathRuntimeResult(
output={**results.model_dump(by_alias=True)},
status=UiPathRuntimeStatus.SUCCESSFUL,
Copy link
Member

Choose a reason for hiding this comment

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

if the runtime is suspended, you need to pass the result as suspended to the serverless exector

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

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants