From Chaos to Compliance: Taming the AI Agent Wild West at Harbor Credit Union Harbor Credit Union built a hands-on demonstration with IBM Bob using CUGA Polisys, an open-source policy engine that enforces lending compliance on tool-using AI agents. The engine compiles company policies and SOPs into typed rules, procedures and obligations that run at the agent harness's lifecycle hooks, blocking wrong tool calls and flagging required writes the agent never performed, with each decision logged to an audit file. The team argues this decoupled governance layer avoids stuffing rules into system prompts or hardcoding guardrails in back-end services as policies change. Imagine handing an enthusiastic intern the keys to your loan approval desk. They understand the big picture—approve qualified applicants, decline those who don't qualify—but they haven't memorized the compliance binder. On a busy afternoon, that intern might approve a $75,000 loan without manager sign-off, pick a non-existent 40-month loan term, or send an approval notice and walk away without ordering a credit report or logging the decision in the audit trail. When that "intern" is an AI agent, those shortcuts aren't harmless quirks. They are regulatory breaches, financial exposure, and operational headaches. At Harbor Credit Union, we set out to solve this exact tension. Our loan-processing agent knew how to call its tools, yet left on its own it repeatedly cut corners on lending policies and Standard Operating Procedures SOPs . Stuffing every rule into the agent's system prompt or hardcoding guardrails inside back-end services quickly becomes fragile—especially when compliance policies evolve. Instead, we wanted a clean, decoupled governance layer. Enter CUGA Polisys https://github.com/cuga-project/polisys —an open-source policy engine that we put to work in a hands-on demonstration built with IBM Bob . CUGA Polisys Excerpt from GitHub; Policy and SOP adherence for tool-using agents. polisys turns a company policy a handbook, an SOP, a rule list into checks that run while an agent works: rules that stop a wrong tool call, procedures that guide the agent through a case, and obligations that find work the agent never did. It is a library with a hook interface, so it runs next to an agent and does not contain one. What it does | Part | What it gives the agent | Checked by | | ------------------ | ------------------------------------------------------------ | ----------------------------------------------- | | Typed rules | A wrong call is stopped before it runs, with a message that says what to do instead. 15 rule types, for example required arguments, allowed values, record state, role permission, thresholds | Code and Cedar for hard rules . No model call | | Procedures | The steps, preconditions, exceptions and must-not rules of the SOP section that applies to the case, as tools and a brief | Code, plus a small model for judgement checks | | Obligations | At the final reply: "these required writes did not happen", with the values the policy prescribes. Never for work that a hook blocked | Code first; the ledger stays silent when unsure | | Control levels | Strong models get fewer checks than weak ones; one switch sets which checks run | runtime/levels.py | | Audit | One line per decision: rule, source, evidence, package version, and each failure of a check | audit.jsonl | Everything is chosen by a profile one YAML file . Policy switches in the environment do not exist. A profile never holds rules; rules live in the policy package . How it fits together Three parties meet in polisys. The enterprise owns the policies and the systems the agent acts on. polisys compiles the policies into a package and turns it into checks. The agent harness the host that runs the agent loop calls those checks at its lifecycle hooks. Nothing in polisys contains an agent, and the harness needs nothing from polisys but the hook contract. Introduction on the demo Implementation The central challenge of putting autonomous agents into real workflows is what we can call the Agent Compliance Gap . Modern agents are great at chaining tool calls together to reach an answer, yet they do not reliably enforce policy boundaries, procedural order, or mandatory follow-up work on their own. CUGA Polisys flips the usual script on agent governance. Rather than forcing your agent to live inside a rigid framework or sprinkling policy checks across every tool and prompt, Polisys sits beside the agent harness as a dedicated policy runtime. It compiles human-readable company policies into structured runtime checks and plugs into the host application through nine lifecycle hooks session start , on user message , before llm call , after llm call , before tool call , after tool call , before reply , on task end , and tool blocked . +-------------------------------------------------------------------+ | HOST & AGENT HARNESS | | ScriptedAgent / OpenAI-Compatible LLMAgent / CUGA Agent | +---------------------------------+---------------------------------+ | 9 Lifecycle Hooks HookRegistry | v +-------------------------------------------------------------------+ | CUGA POLISYS | | 1. RuleSetHooks -- Blocks invalid calls before execution | | 2. ProcedureGuide -- Enforces SOP sequence & checkpoints | | 3. ObligationLedger -- Catches forgotten follow-up work | +---------------------------------+---------------------------------+ | Allowed Tool Calls Only v +-------------------------------------------------------------------+ | BACK-END & INDEPENDENT ORACLE | | LoanBackend zero policy code -- audit.jsonl & Oracle | +-------------------------------------------------------------------+ Think of Polisys as an attentive compliance referee watching the desk at every beat of the loop. Before a model call happens, before a tool executes, after a tool returns, and before the agent claims it is done, Polisys can allow the action, attach a policy note, block a bad call with a helpful explanation, or send the agent back to finish incomplete work. To see how this plays out in practice, we built the Harbor Credit Union Loan Demo . Harbor Credit Union is fictional, and its back-end loan demo/backend.py deliberately accepts any well-formed tool call without enforcing policy itself. That design gives us a crystal-clear laboratory: we run a "sloppy" agent across six loan scenarios APP-1001 through APP-1006 and four policy profiles baseline , rules only , procedures , and full , watching what happens when the agent makes the exact same mistakes every time and only the Polisys configuration changes. Implementation Building a realistic, trustworthy demo meant separating three concerns cleanly: authoring policies as structured data, wiring Polisys into the host loop without polluting the agent or back-end, and letting three distinct mechanisms enforce compliance. Policy as Data, Schemas, and Clean Hook Wiring Everything starts in policy/loan policy.md , where Harbor Credit Union's personal-loan rules live in plain English—covering valid loan terms 12 , 24 , 36 , 48 , or 60 months , rate tiers A to D , the $50,000 manager approval threshold, KYC verification, sanctions screening, decline reason codes, approval notice formatting, and the "Approving a personal loan" SOP. From there, Polisys turns readable policy prose into a validated package policy/package.json backed by policy/draft.json which organizes 9 hard rules , 1 judgment rule , and 2 guidance rules , each quoting the numbered policy clause it comes from and checked against the agent's nine tool schemas in policy/tools.json : - get application - verify kyc - order credit report - request manager approval - approve loan - decline loan - send notification - log audit entry - escalate to compliance Running polisys validate policy/package.json --tools policy/tools.json verifies that every rule and procedure step aligns with the tool definitions 0 errors, 0 warnings before a single scenario runs. In loan demo/wiring.py , build arm reads a YAML profile from profiles/ to turn governance mechanisms on or off. Here is how the full profile enables rules, procedure guidance, and the experimental obligation ledger together: profiles/full.yaml policy: package: policy/package.json sources: {data: false, discovery: false, request: true} checkers: rules: on gate: {mode: off} verifier: {mode: off} write checks: off organizers: procedure tools: off guide: {mode: on} loop: off sop tracker: off navigator: off requirements tracker: off obligations: producers: package, duty model: demo/binder item level: follow up decisions: {mode: off} And inside loan demo/host.py , wiring Polisys into LoanDeskHost takes just a few lines: """A minimal agent host: the loop that owns the agent, the tools and - from Polisys - nothing but a list of hooks. This file is the heart of the "decoupled" story. Read LoanDeskHost.run top to bottom: every self.hooks.