Skip to content

Commit cc9480c

Browse files
committed
Add README for human_in_the_loop samples
1 parent b083bfe commit cc9480c

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Human-in-the-Loop Samples
2+
3+
Two approaches to implementing human-in-the-loop approval workflows with LangGraph and Temporal.
4+
5+
## Samples
6+
7+
### [approval_graph_interrupt](./approval_graph_interrupt/)
8+
9+
Uses LangGraph's `interrupt()` function to pause graph execution.
10+
11+
- Graph calls `interrupt(request_data)` to pause
12+
- Workflow detects `__interrupt__` in result, waits for signal
13+
- Workflow resumes graph with `Command(resume=response)`
14+
15+
**Best for:** Standard LangGraph patterns, portable graph definitions.
16+
17+
### [approval_wait_condition](./approval_wait_condition/)
18+
19+
Uses `run_in_workflow=True` to access Temporal operations directly in graph nodes.
20+
21+
- Node marked with `metadata={"run_in_workflow": True}`
22+
- Node uses `workflow.instance()` to access workflow
23+
- Node waits directly with `workflow.wait_condition()`
24+
25+
**Best for:** Keeping all wait logic encapsulated in the graph, simpler workflow code.
26+
27+
## Quick Comparison
28+
29+
| Aspect | graph_interrupt | wait_condition |
30+
|--------|-----------------|----------------|
31+
| Wait logic location | Workflow | Graph node |
32+
| Graph portability | Higher | Lower |
33+
| Workflow complexity | More code | Less code |
34+
| Temporal API access | Indirect | Direct |

0 commit comments

Comments
 (0)