NEXORA / scripts /agent_experiment.py
devildasdf's picture
Release validated NEXORA research prototype, tiny weights and evidence
12496fc verified
Raw History Blame Contribute Delete
1.4 kB
"""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()