-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathtools.py
More file actions
49 lines (40 loc) · 1.58 KB
/
Copy pathtools.py
File metadata and controls
49 lines (40 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Tencent is pleased to support the open source community by making tRPC-Agent-Python available.
#
# Copyright (C) 2026 Tencent. All rights reserved.
#
# tRPC-Agent-Python is licensed under Apache-2.0.
""" Tools for the agent. """
import time
import uuid
async def human_approval_required(task_description: str, details: dict) -> dict:
"""A long-running function that requires human approval.
Args:
task_description: Description of the task requiring approval
details: Additional details about the task
Returns:
A dictionary indicating the task is pending human approval
"""
return {
"status": "pending_approval",
"message": f"Task '{task_description}' requires human approval",
"details": details,
"approval_id": str(uuid.uuid4()),
"timestamp": time.time(),
}
async def check_system_critical_operation(operation: str, target: str) -> dict:
"""A long-running function for sub-agent that requires human approval for critical operations.
Args:
operation: The critical operation to perform (e.g., delete, restart, update)
target: The target of the operation (e.g., server name, database name)
Returns:
A dictionary indicating the operation requires human approval
"""
return {
"status": "pending_approval",
"message": f"Critical operation '{operation}' on '{target}' requires human approval",
"operation": operation,
"target": target,
"approval_id": str(uuid.uuid4()),
"timestamp": time.time(),
"risk_level": "high",
}