# ============================================================ # app.py — Integration snippets for Agent 6 (AXIOM Audit Agent) # Add these to your existing app.py # ============================================================ # ── 1. Import at top of app.py ─────────────────────────────── from agent6_audit import run_audit_agent, get_audit_for_submission # ── 2. Call AXIOM at end of pipeline (after NOVA) ─────────── # In your existing pipeline route (wherever NOVA runs), add: def run_full_pipeline(submission_id: int) -> dict: """ Example: call this at the end of your existing pipeline function. Replace with your actual pipeline call. """ # ... your existing agent calls (AURA, TERRA, KARMA, AURUM, NOVA) ... # ✅ ADD THIS at the very end, after NOVA issues/declines: audit_result = run_audit_agent(submission_id) return { # ... your existing pipeline result dict ... "audit": audit_result, } # ── 3. Flask API route — GET audit for a submission ────────── from flask import jsonify, request @app.route("/audit/", methods=["GET"]) def get_audit(submission_id): """ Returns the audit record for a given submission. Called by the UI audit panel. GET /audit/123 """ record = get_audit_for_submission(submission_id) if not record: # Run it on demand if not yet generated record = run_audit_agent(submission_id) return jsonify(record) @app.route("/audit/run/", methods=["POST"]) def trigger_audit(submission_id): """ Manually trigger audit for a submission (useful for backfill). POST /audit/run/123 """ result = run_audit_agent(submission_id) return jsonify(result) # ============================================================ # HTML AUDIT PANEL — Add this to your existing policy detail # page or results screen in your HTML/Jinja templates # ============================================================ AUDIT_PANEL_HTML = """
🔍
AXIOM — Audit Agent
Agent 6 · Decision Audit · Gold Layer
Loading...
Loading audit summary...
Audit Confidence Score
0%
Agent Decision Factors
"""