"""closegate: the policy gate for finance AI agents โ€” live governance eval. Put an agent in front of the monthly close and the risk is not 'can it match invoices', it is 'does it respect the controls'. This Space runs closegate's own eval harness (no LLM) over synthetic multi-entity finance data and shows the report: matching accuracy AND policy enforcement, with verbatim rule text in the audit trail. Tool: https://github.com/neul-labs/closegate """ import os, subprocess, glob, gradio as gr CG = os.environ.get("CLOSEGATE_DIR", "/home/user/closegate") def run_eval(): try: subprocess.run(["python", "-m", "eval.runner", "--dimension", "accuracy,policy"], cwd=CG, capture_output=True, text=True, timeout=240) except Exception as e: return f"eval error: {e}" reports = sorted(glob.glob(f"{CG}/evals/results/*/report.md")) return open(reports[-1]).read() if reports else "No report produced." HEADER = """# closegate: governance eval for finance AI agents closegate is a policy gate + tamper-evident audit log that sits between an LLM and your accounting systems โ€” segregation of duties, materiality routing, and a hash-chained audit an external auditor can replay. This Space runs closegate's **own eval harness (no LLM)** over synthetic multi-entity ledgers and shows the report live: reconciliation **matching accuracy** and **policy enforcement**. ๐Ÿ”ง [github.com/neul-labs/closegate](https://github.com/neul-labs/closegate) ยท ๐Ÿ—‚๏ธ dataset: [neullabs/closegate-recon-bench](https://huggingface.co/datasets/neullabs/closegate-recon-bench) ยท From [Neul Labs](https://huggingface.co/neullabs). """ with gr.Blocks(title="closegate โ€” finance-agent governance eval") as demo: gr.Markdown(HEADER) b = gr.Button("Run the governance eval", variant="primary") o = gr.Markdown() b.click(run_eval, None, o) demo.load(run_eval, None, o) if __name__ == "__main__": demo.launch(server_name="0.0.0.0", server_port=7860)