File size: 1,399 Bytes
12496fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Policy-aware agent experiment, separate from earlier baseline failures."""
from pathlib import Path
import json
import sys
import tempfile
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
from nexora.inference import HFBackend
from nexora.agent import Agent
from nexora.tools import Executor, Policy


def main():
    backend = HFBackend(".cache/Qwen3.5-0.8B", max_new_tokens=192)
    with tempfile.TemporaryDirectory(prefix="nexora-agent-") as folder:
        root = Path(folder)
        (root / "note.txt").write_text("The test project uses a bounded queue.")
        executor = Executor(Policy(folder, permissions=["READ", "WRITE"]))
        task = "Read note.txt, then create summary.txt containing exactly: bounded queue. Finish after the file is written."
        result = Agent(backend, executor, verifier=lambda: (root / "summary.txt").is_file() and (root / "summary.txt").read_text() == "bounded queue", max_steps=6).run(task)
    report = {"model": "Qwen/Qwen3.5-0.8B", "changes": "Advertise only policy-available tools; generation budget 192 tokens", "task": task, "result": result,
              "limitations": "One public synthetic file task. Not repository-scale coding, statistical evidence or hidden benchmark."}
    Path("reports/agent-policy-aware.json").write_text(json.dumps(report, indent=2))
    print(json.dumps(report))


if __name__ == "__main__":
    main()