Skip to content

Commit 1c67a9a

Browse files
chore: Release v5.0.1 - Add approval gates demo example
Added: - Interactive approval gates demo script (examples/test_approval_gates.py) - Demonstrates Pattern 5: Approval Gates workflow - Shows approve/reject flow with dashboard interaction Version: 5.0.0 → 5.0.1 CHANGELOG: Updated with v5.0.1 release notes Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent faed34d commit 1c67a9a

4 files changed

Lines changed: 136 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [5.0.1] - 2026-01-28
11+
12+
### Added
13+
- **Interactive Approval Gates Demo** (`examples/test_approval_gates.py`)
14+
- Demonstrates Pattern 5: Approval Gates workflow
15+
- Creates test approval requests for dashboard interaction
16+
- Shows approve/reject flow with timeout handling
17+
- Useful for testing and understanding approval gates
18+
19+
### Documentation
20+
- Added example script for approval gates testing
21+
- Helps users understand human-in-the-loop workflows
22+
1023
## [5.0.0] - 2026-01-27
1124

1225
### 🚨 Breaking Changes

examples/test_approval_gates.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#!/usr/bin/env python3
2+
"""Test Approval Gates - Interactive Demo
3+
4+
This script creates approval requests and waits for you to approve/reject them
5+
via the dashboard UI at http://localhost:8000
6+
7+
Usage:
8+
python scripts/test_approval_gates.py
9+
"""
10+
import time
11+
from datetime import datetime
12+
13+
from empathy_os.telemetry import ApprovalGate
14+
15+
16+
def create_test_approvals():
17+
"""Create several test approval requests for demonstration."""
18+
gate = ApprovalGate(agent_id="demo-workflow")
19+
20+
print("=" * 60)
21+
print("🚦 APPROVAL GATES DEMO")
22+
print("=" * 60)
23+
print("\nThis demo will create 3 approval requests.")
24+
print("Open the dashboard at: http://localhost:8000")
25+
print("\nYou can approve or reject each request in the dashboard UI.")
26+
print("=" * 60)
27+
28+
# Approval 1: Deploy to Production
29+
print("\n📋 Request 1: Deploy to Production")
30+
print(" Creating approval request...")
31+
32+
response = gate.request_approval(
33+
approval_type="deploy_to_production",
34+
context={
35+
"version": "5.0.0",
36+
"changes": 60,
37+
"risk": "medium",
38+
"timestamp": datetime.utcnow().isoformat(),
39+
},
40+
timeout=60.0, # Wait 60 seconds
41+
)
42+
43+
print(f" ✅ Response received!")
44+
print(f" Approved: {response.approved}")
45+
print(f" Responder: {response.responder}")
46+
print(f" Reason: {response.reason}")
47+
48+
if not response.approved:
49+
print("\n❌ Deployment blocked by human review")
50+
return
51+
52+
# Approval 2: Delete Resources
53+
print("\n📋 Request 2: Delete Resources")
54+
print(" Creating approval request...")
55+
56+
response = gate.request_approval(
57+
approval_type="delete_resources",
58+
context={
59+
"resource_type": "database_records",
60+
"count": 1000,
61+
"impact": "high",
62+
},
63+
timeout=60.0,
64+
)
65+
66+
print(f" ✅ Response received!")
67+
print(f" Approved: {response.approved}")
68+
print(f" Responder: {response.responder}")
69+
print(f" Reason: {response.reason}")
70+
71+
# Approval 3: Refactor Code
72+
print("\n📋 Request 3: Refactor Code")
73+
print(" Creating approval request...")
74+
75+
response = gate.request_approval(
76+
approval_type="refactor_code",
77+
context={
78+
"files": 50,
79+
"lines_changed": 5000,
80+
"risk": "low",
81+
},
82+
timeout=60.0,
83+
)
84+
85+
print(f" ✅ Response received!")
86+
print(f" Approved: {response.approved}")
87+
print(f" Responder: {response.responder}")
88+
print(f" Reason: {response.reason}")
89+
90+
print("\n" + "=" * 60)
91+
print("✅ DEMO COMPLETE")
92+
print("=" * 60)
93+
94+
95+
def create_background_approval():
96+
"""Create a single approval request that stays pending."""
97+
gate = ApprovalGate(agent_id="background-agent")
98+
99+
print("\n🔄 Creating a persistent approval request...")
100+
print("This will stay in your dashboard until you approve/reject it.")
101+
102+
gate.request_approval(
103+
approval_type="run_expensive_operation",
104+
context={
105+
"operation": "Train ML model",
106+
"estimated_cost": "$50",
107+
"estimated_time": "2 hours",
108+
},
109+
timeout=600.0, # 10 minutes
110+
)
111+
112+
113+
if __name__ == "__main__":
114+
import sys
115+
116+
if len(sys.argv) > 1 and sys.argv[1] == "--background":
117+
# Create one that stays pending
118+
create_background_approval()
119+
else:
120+
# Interactive demo
121+
create_test_approvals()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "empathy-framework"
7-
version = "5.0.0"
7+
version = "5.0.1"
88
description = "AI collaboration framework with real LLM agent execution, AskUserQuestion tool integration, Socratic agent generation, progressive tier escalation (70-85% cost savings), meta-orchestration, dynamic agent composition (6 patterns), intelligent caching (85% hit rate), semantic workflow discovery, visual workflow editor, MCP integration for Claude Code, and multi-agent orchestration."
99
readme = {file = "README.md", content-type = "text/markdown"}
1010
requires-python = ">=3.10"

src/empathy_os/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
Licensed under Fair Source 0.9
5656
"""
5757

58-
__version__ = "5.0.0"
58+
__version__ = "5.0.1"
5959
__author__ = "Patrick Roebuck"
6060
__email__ = "patrick.roebuck@smartaimemory.com"
6161

0 commit comments

Comments
 (0)