MCPcopy Create free account
hub / github.com/AI45Lab/Code / make_monitored_session

Function make_monitored_session

examples/test_ahp_agent_monitors_agent.py:80–93  ·  view source on GitHub ↗

创建由 AHP Server 智能体监督的业务智能体会话

(agent, workspace: str)

Source from the content-addressed store, hash-verified

78
79
80def make_monitored_session(agent, workspace: str):
81 """创建由 AHP Server 智能体监督的业务智能体会话"""
82 ahp_server_script = str(Path(__file__).parent / "ahp_agent_monitors_agent.py")
83 venv_python = find_venv_python()
84
85 opts = SessionOptions()
86 opts.ahp_transport = StdioTransport(
87 program=venv_python,
88 args=[ahp_server_script],
89 )
90 opts.builtin_skills = True
91 # 显式允许业务智能体尝试工具调用;AHP server 负责阻止危险操作。
92 opts.permission_policy = PermissionPolicy(default_decision="allow")
93 return agent.session(workspace, opts)
94
95
96def section(title: str):

Callers 1

mainFunction · 0.85

Calls 5

find_venv_pythonFunction · 0.85
SessionOptionsClass · 0.50
StdioTransportClass · 0.50
PermissionPolicyClass · 0.50
sessionMethod · 0.45

Tested by

no test coverage detected