创建由 AHP Server 智能体监督的业务智能体会话
(agent, workspace: str)
| 78 | |
| 79 | |
| 80 | def 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 | |
| 96 | def section(title: str): |
no test coverage detected