Skip to content

Conversation

@Chibionos
Copy link

@Chibionos Chibionos commented Jan 15, 2026

Overview

This PR adds a comprehensive sample demonstrating the suspend/resume pattern for agents that invoke RPA processes using LangGraph's interrupt() function.

What's New

🎬 Interactive Demo

  • demo_suspend_resume.py: Single consolidated script demonstrating complete lifecycle
    • Run full demo or individual suspend/resume steps
    • Clear visual logging with emojis showing execution flow
    • Simulates process restart between suspend and resume
    • Quick start: uv run python demo_suspend_resume.py

📖 Comprehensive README

  • Clear Quick Start section with demo command
  • Visual lifecycle diagram showing suspend/resume phases
  • Organized file listings with purpose explanations
  • Multiple usage examples (demo, step-by-step, eval runtime)
  • Common patterns with code examples
  • Troubleshooting guide for common issues
  • Integration details with UiPath evaluation runtime

🔧 Core Agent Files

  • graph.py: LangGraph agent with InvokeProcess for real RPA integration
  • graph_simple.py: Simplified variant using dict payload (no auth required)
  • langgraph.json: Graph entrypoint definitions

🧪 Testing Support

  • test_suspend_resume_with_validation.py: Comprehensive test with checkpoint assertions
  • test_suspend_step1.py & test_suspend_step2.py: Separate suspend/resume steps
  • inspect_state.py: Utility to decode and inspect checkpoint database
  • Evaluation sets: JSON files for testing with uipath eval

📦 Dependencies

  • Added proper dependencies matching other samples (uipath>=2.5.4, uipath-langchain>=0.4.3)
  • Includes uipath-dev in dev dependency group
  • Updated minimum uipath version to 2.5.4 for suspend/resume fixes

Key Features

  1. Easy to Run: Single demo command shows complete suspend/resume flow
  2. Two Graph Variants:
    • Production-ready with InvokeProcess for RPA
    • Development-friendly with simple dict for testing
  3. Comprehensive Documentation: Step-by-step guide with visual diagrams
  4. Testing Tools: Multiple test scripts and inspection utilities
  5. Proper Architecture: LangGraph-specific code stays in uipath-langchain-python

Quick Start

cd samples/tool-calling-suspend-resume

# Run the interactive demo
uv run python demo_suspend_resume.py

# Or test with evaluation runtime
uv run uipath eval agent-simple evaluations/eval-sets/test_simple_no_auth.json

What You'll See

The demo shows:

  1. 🔴 Agent executes and calls interrupt()SUSPENDS
  2. 💾 State saves to SQLite (__uipath/state.db)
  3. ⏸️ Simulates process exit/restart
  4. 🟢 Agent resumes from checkpoint → COMPLETES
  5. ✅ Final result with resume data

Related Work

  • Requires uipath-python 2.5.4 with status propagation fixes
  • Demonstrates proper framework-specific suspend/resume patterns
  • Reference implementation for RPA process invocations with interrupt()

Files Structure

samples/tool-calling-suspend-resume/
├── demo_suspend_resume.py          🎬 START HERE! Interactive demo
├── README.md                       📖 Comprehensive guide
├── graph.py                        🔧 Production agent with InvokeProcess
├── graph_simple.py                 🔧 Development agent (no auth)
├── test_suspend_resume_with_validation.py  🧪 Full test with assertions
├── test_suspend_step1.py           🧪 Suspend step only
├── test_suspend_step2.py           🧪 Resume step only
├── inspect_state.py                🔍 Checkpoint inspector
├── pyproject.toml                  📦 Dependencies
├── langgraph.json                  ⚙️ Graph configuration
└── evaluations/                    📋 Evaluation sets

@Chibionos Chibionos force-pushed the feat/suspend-resume-evaluations branch from 049eab8 to c3488ae Compare January 15, 2026 17:06
@Chibionos Chibionos changed the title feat: Add suspend/resume sample for RPA invocations feat: add suspend/resume sample for RPA invocations Jan 15, 2026
@Chibionos Chibionos force-pushed the feat/suspend-resume-evaluations branch from c3488ae to 745d124 Compare January 15, 2026 17:20
version = "0.1.0"
description = "Tool-calling agent demonstrating suspend/resume with RPA process invocation"
requires-python = ">=3.11"
dependencies = []
Copy link
Member

Choose a reason for hiding this comment

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

we need to add uipath & uipath-langchain deps, same as the other samples

@Chibionos Chibionos force-pushed the feat/suspend-resume-evaluations branch 4 times, most recently from e1cd818 to eab151f Compare January 15, 2026 17:35
Chibi Vikram and others added 5 commits January 15, 2026 09:35
Add sample agent demonstrating suspend/resume pattern for RPA invocations:
- graph.py: LangGraph agent using interrupt(InvokeProcess(...))
- Uses official InvokeProcess from uipath.platform.common
- Includes comprehensive logging for suspend/resume flow
- Evaluation sets for testing suspend/resume behavior
- README with usage instructions

Architecture documentation:
- Add INTERRUPT_SUSPEND_RESUME.md explaining proper separation of concerns
- Documents that LangGraph-specific interrupt detection belongs in
  uipath-langchain-python, not framework-agnostic uipath-python layer

Configuration:
- langgraph.json: defines 'agent' and 'agent-simple' entrypoints
- uipath.json: runtime configuration
- pyproject.toml: dependencies

This sample provides:
- Reference implementation for suspend/resume with RPA
- Test cases for evaluation runtime
- Clear documentation of architecture boundaries

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

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
- Add graph_simple.py with dict payload (no authentication required)
- Add test_simple_no_auth.json evaluation set for quick testing
- Update README with graph variants and evaluation set descriptions
- Provides easier entry point for testing suspend/resume without RPA setup
- Add test_suspend_resume_with_validation.py with checkpoint assertions
  - Validates checkpoint count and structure
  - Verifies interrupt data persistence
  - Validates resume data flow
  - Checks final result completion
  - Asserts checkpoint parent-child chain integrity

- Add test_suspend_step1.py and test_suspend_step2.py
  - Demonstrates separate process suspend/resume pattern
  - Shows state persistence across Python process restarts

- Add inspect_state.py for debugging
  - Decodes msgpack checkpoint data
  - Shows interrupt and resume data structure
  - Helps understand LangGraph checkpoint internals

- Update graph_simple.py with proper checkpointer
  - Use MemorySaver for simple testing (documented)
  - Add note about AsyncSqliteSaver for persistence

- Update langgraph.json
  - Add agent-simple entrypoint for simple graph variant

These tests validate the complete suspend/resume lifecycle and can be used
as reference for understanding the checkpoint mechanism.
This architecture documentation should live in the uipath-python repo
where the core evaluation runtime is located, not in the langchain-specific repo.
- Add tool-calling agent sample demonstrating suspend/resume pattern
- Add comprehensive validation tests with checkpoint assertions
- Add proper dependencies (uipath>=2.5.4, uipath-langchain>=0.4.3)
- Update minimum uipath version to 2.5.4 for suspend/resume fixes
- Include both RPA invocation variant and simplified test variant
@Chibionos Chibionos force-pushed the feat/suspend-resume-evaluations branch from eab151f to 608c8e0 Compare January 15, 2026 17:35
- Add demo_suspend_resume.py: consolidated interactive demo
  - Single script showing complete suspend/resume lifecycle
  - Can run full demo or individual suspend/resume steps
  - Clear logging with emojis for visual flow
  - Simulates process restart between steps

- Enhance README.md: comprehensive documentation
  - Clear Quick Start section with demo command
  - Visual lifecycle diagram showing suspend/resume phases
  - Organized file listing with purpose of each file
  - Multiple usage examples (full demo, step-by-step, eval runtime)
  - Common patterns section with code examples
  - Troubleshooting guide for common issues
  - Integration details with UiPath evaluation runtime

- All commands use 'uv run' for consistency
- Makes sample easy to understand and run
…ization

When using Pydantic BaseModel for State schema, nodes must return plain
dicts rather than BaseModel instances. LangGraph cannot properly serialize
BaseModel objects to checkpoints, resulting in empty state and validation
errors during resume.

Changes:
- graph_simple.py: Return dict instead of State object from suspend_node
- runtime.py: Add Command(resume=...) wrapper for resume mode
- Add test_resume_direct.py: Test script for direct resume without API
- Add test_full_cycle.py: Interactive test for full suspend/resume cycle
- Add SUSPEND_RESUME_FIX.md: Detailed documentation of the fix
- Add MANUAL_TEST_GUIDE.md: Step-by-step manual testing guide
- Update README.md: Document new test files and evaluation setup
- Update uipath.json: Add agent-simple entrypoint for eval

This enables proper suspend/resume functionality for evaluations with
RPA invocations, allowing agents to persist state across process restarts.
@cristipufu cristipufu self-requested a review January 17, 2026 15:49
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.

2 participants