repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
Mirrored from https://github.com/yingqi-z20/Agent-libOS
stars
latest
clone command
git clone gitlawb://did:key:z6MkqRzA...RfoM/yingqi-z20-Agen...git clone gitlawb://did:key:z6MkqRzA.../yingqi-z20-Agen...d98dd2c9IPC1d ago| from __future__ import annotations |
| #2 |
| #3 | from typing import Any |
| #4 |
| #5 | from agent_libos.models.exceptions import HumanApprovalRequired |
| #6 | from agent_libos.runtime.runtime import Runtime |
| #7 |
| #8 |
| #9 | def call_tool_with_auto_approval( |
| #10 | runtime: Runtime, |
| #11 | pid: str, |
| #12 | tool: str, |
| #13 | args: dict[str, Any], |
| #14 | approval_decision: dict[str, Any] | None = None, |
| #15 | ) -> Any: |
| #16 | try: |
| #17 | return runtime.tools.call(pid, tool, args) |
| #18 | except HumanApprovalRequired as exc: |
| #19 | runtime.human.approve(exc.request_id, approval_decision or {"approved": True, "macro": "auto_approval"}) |
| #20 | return runtime.tools.call(pid, tool, args) |
| #21 |
| #22 |
| #23 | def run_tests_and_summarize(runtime: Runtime, pid: str, tool: str, args: dict[str, Any]) -> dict[str, Any]: |
| #24 | result = call_tool_with_auto_approval(runtime, pid, tool, args) |
| #25 | return {"ok": result.ok, "payload": result.payload, "result_oid": result.result_handle.oid if result.result_handle else None} |
| #26 |
| #27 |