Choose your region

    Lists show the case studies of your region first. Browse and search still hold every case study.

    Europe
    North America

    Nubank fraud analysts write defense rules with AI agents

    Nubank's DefenseIO team turned its fraud detection engine into a declarative policy platform, then gave fraud analysts AI agents that edit those policies through a custom MCP server.

    NubankBrazil, Mexico, and ColombiaBankingPilot
    Scale
    About 500 million events a day, with peaks of 5 million requests per minute
    Scenario
    Fraud detection rule generation
    Business function
    Risk and fraud
    Who built it
    Built in-house
    Where it runs
    Public cloud
    Human oversight
    Assists people
    Organization
    Enterprise, part of Nu Holdings
    AI types
    Generative AI, Agentic AI, Machine learning
    Users
    about 100 internal customers
    People served
    over 131 million customers

    Sources and their publishers

    This case study draws on reporting by the following publishers. Enterprise AI Case Studies combined these accounts and added its own explanation. The reporting, and every passage quoted from it, belongs to whoever published or supplied it.

    1. ZenML

    2. Model Context Protocol

    tl;drPolicy changes went live in 1-2 days instead of 3-5 weeks once fraud teams could configure defenses.See the results

    View the solutionBuild this solution yourself

    Nubank’s DefenseIO team gives fraud analysts AI agents that create and edit fraud detection policies on the bank’s Defense Platform. The agents work through the DefenseIO Agent Plugin and a custom Model Context Protocol (MCP) server1.

    The Defense Platform is the centralized fraud detection engine for the bank’s products, including card issuing, lending and e-commerce1. It processes approximately 500 million events daily, at peaks of 5 million requests per minute, for over 131 million customers1. In a 2026 talk, team members described how the platform moved from policies written in code to declarative policies, and then to AI agents that edit those policies1.

    The declarative step cut policy deployment time from 3-5 weeks to 1-2 days and grew production policies from about 20 to over 300 policies1. The agent layer builds on that platform, and the team is testing AI-assisted policy creation on it1.

    Before the deployment

    Each Nubank business unit first kept its own fraud logic inside its product services, which led to duplicated policies, inconsistent implementations and coordination problems1. A first redesign centralized fraud detection on a Clojure-based platform built from scratch, with policies defined in a shared codebase1.

    • Engineers wrote every change: Business analysts and fraud teams depended on engineers to translate analytical models into production code1.
    • Slow deployments: A policy change took 3-5 weeks to reach production1.
    • Few builders: About 10 people built defenses, for about 20 policies in production1.

    A second redesign introduced a custom domain-specific language (DSL) for policies, a policy registry, a feature registry and a configuration manager, all reachable through a user interface1. Fraud teams could then create and modify policies themselves, and onboarding still took five different documentation articles on authentication, environment setup and operations1.

    What was built

    The solution lets an analyst describe a fraud defense in natural language and turns that description into a new policy version in the DSL1. The policy then runs on the same decision pipeline as every other defense1.

    • AI agent: The DefenseIO Agent Plugin combines engineered prompts with the custom MCP server. Its skills automate onboarding and environment setup, and its tools query features, create policy versions and edit configurations1.
    • Policies and models: The policy engine service runs each transaction, with enriched features such as transaction history and past fraud reports, through policies that apply thresholds and rules to produce decision scores. Machine learning models run beside them1.
    • Deterministic software: The flow orchestrator sends transactions down production and shadow paths. Action managers apply live actions such as challenges, delays and warnings, and backstage actions such as reports1.
    • Analysts: They own rule logic, optimization and behavioral analysis, and use the AI interfaces to create and refine policies1.
    • Engineers: They own data infrastructure, feature engineering and the data pipelines1.

    Alternatives considered

    • Agents that write code: The team chose to keep growing the declarative platform instead, so that AI-generated policies follow established rules and predefined action sets rather than risk hallucinations that affect millions of customers1.
    • A fully autonomous agent: The team rejected it in favor of constrained AI-assisted tooling1.
    • A proprietary AI interface: The team supports several AI interfaces, such as Cursor, through one MCP server, because users prefer different tools1.

    Technology and architecture

    Figure 1How AI agents reach Nubank's fraud Defense Platform
    How AI agents reach Nubank's fraud Defense PlatformA fraud analyst works in Cursor with the DefenseIO plugin, which calls the custom MCP server. The MCP server queries the feature registry, writes new policy versions to the policy registry and edits settings in the configuration manager. Product services send transactions to the flow orchestrator, which passes them to the policy engine and writes shadow-flow results to the ETL. The policy engine reads policies, settings and features, combines them with machine learning model scores, sends decision scores to the action managers and stores decisions in the ETL. The link between the machine learning models and the policy engine is inferred.policy in plain language (data) · Documented in source [1]tool calls (trigger or control) · Documented in source [1]query features (data) · Documented in source [1]new policy version (data) · Documented in source [1]configuration edits (trigger or control) · Documented in source [1]transactions (data) · Documented in source [1]production flow (data) · Documented in source [1]policies in DSL (trigger or control) · Documented in source [1]thresholds (trigger or control) · Documented in source [1]enriched features (data) · Documented in source [1]model scores (data) · Inferred, not documented in the sourcesdecision scores (data) · Documented in source [1]decisions (data) · Documented in source [1]shadow-flow results (data) · Documented in source [1]AI INTERFACEDEFENSE PLATFORMFraud analyst · Person · Documented in source [1]PERSONFraud analystCursor with DefenseIO plugin · Application · Documented in source [1]APPLICATIONCursor withDefenseIOpluginCustom MCP server · System · Documented in source [1]SYSTEMCustomMCP serverFeature registry · Data · Documented in source [1]DATAFeatureregistryPolicy registry · Data · Documented in source [1]DATAPolicy registryConfiguration manager · System · Documented in source [1]SYSTEMConfigurationmanagerProduct services · System · Documented in source [1]SYSTEMProductservicesFlow orchestrator · System · Documented in source [1]SYSTEMFloworchestratorPolicy engine service · System · Documented in source [1]SYSTEMPolicy engineserviceMachine learning models · AI model · Documented in source [1]AI MODELMachinelearningmodelsAction managers · System · Documented in source [1]SYSTEMActionmanagersETL · Data · Documented in source [1]DATAETLpolicy in plainlanguagetool callsquery featuresnew policyversionconfigurationeditstransactionsproduction flowpolicies in DSLthresholdsenrichedfeaturesmodel scoresdecision scoresdecisionsshadow-flowresultsHow AI agents reach Nubank's fraud Defense PlatformA fraud analyst works in Cursor with the DefenseIO plugin, which calls the custom MCP server. The MCP server queries the feature registry, writes new policy versions to the policy registry and edits settings in the configuration manager. Product services send transactions to the flow orchestrator, which passes them to the policy engine and writes shadow-flow results to the ETL. The policy engine reads policies, settings and features, combines them with machine learning model scores, sends decision scores to the action managers and stores decisions in the ETL. The link between the machine learning models and the policy engine is inferred.policy in plain language (data) · Documented in source [1]tool calls (trigger or control) · Documented in source [1]query features (data) · Documented in source [1]new policy version (data) · Documented in source [1]configuration edits (trigger or control) · Documented in source [1]transactions (data) · Documented in source [1]production flow (data) · Documented in source [1]policies in DSL (trigger or control) · Documented in source [1]thresholds (trigger or control) · Documented in source [1]enriched features (data) · Documented in source [1]model scores (data) · Inferred, not documented in the sourcesdecision scores (data) · Documented in source [1]decisions (data) · Documented in source [1]shadow-flow results (data) · Documented in source [1]AI INTERFACEDEFENSE PLATFORMFraud analyst · Person · Documented in source [1]PERSONFraud analystCursor with DefenseIO plugin · Application · Documented in source [1]APPLICATIONCursor withDefenseIO pluginCustom MCP server · System · Documented in source [1]SYSTEMCustom MCP serverFeature registry · Data · Documented in source [1]DATAFeature registryPolicy registry · Data · Documented in source [1]DATAPolicy registryConfiguration manager · System · Documented in source [1]SYSTEMConfiguration managerProduct services · System · Documented in source [1]SYSTEMProduct servicesFlow orchestrator · System · Documented in source [1]SYSTEMFlow orchestratorPolicy engine service · System · Documented in source [1]SYSTEMPolicy engine serviceMachine learning models · AI model · Documented in source [1]AI MODELMachinelearning modelsAction managers · System · Documented in source [1]SYSTEMAction managersETL · Data · Documented in source [1]DATAETLpolicy in plain languagetool callsquery featuresnew policy versionconfiguration editstransactionsproduction flowpolicies in DSLthresholdsenriched featuresmodel scoresdecision scoresdecisionsshadow-flow results
    • AI component
    • Data
    • Trigger or control
    • Inferred, not documented
    Source [1]
    The agent writes policies and settings through the MCP server, and the decision pipeline runs them on live transactions.

    MCP is an open-source standard for connecting AI applications to external systems, and Cursor is one of the development tools that support it2. In this deployment, the MCP server runs as a service on AWS and uses Nubank’s authentication provider, so internal users keep their existing identity and access management when they work through AI tools1.

    Layer What they used Role Source
    Prompt and context management DefenseIO Agent Plugin Prompts and skills for onboarding and policy work 1
    Tools and actions Custom MCP server Queries features, creates policy versions and edits configurations 1, 2
    Developer tools Cursor One of the AI interfaces analysts use to reach the MCP server 1, 2
    Predictive model Machine learning models in Python Run beside the policies on each transaction in the decision pipeline 1
    Rules and decision logic Policy engine service Executes the policy DSL against transaction inputs and features to produce decision scores 1
    Business or operational system Policy registry Stores policies as entities rather than code, including the versions the agent creates 1
    Feature store Feature registry Catalogs the features available to policies, which the agent can query 1
    Rules and decision logic Configuration manager Changes thresholds and parameters in real time without a deployment 1
    Workflow engine Flow orchestrator Routes each transaction into the production flow and the shadow flow 1
    Workflow engine Action managers Carry out live interventions such as challenges, delays and warnings, and backstage actions such as reports 1
    Data platform and storage ETL Stores decisions and shadow results for validation, analysis and feature engineering 1
    Event stream Apache Kafka Carries asynchronous communication between the platform’s services 1

    The platform runs approximately 400 policies and models on around 300 features, and about 100 internal customers use it daily1. Data sits in Datomic layered over AWS DynamoDB, and services are replicated across global shards, with each customer assigned to one shard1.

    Data inputs

    • Transactions: Transaction inputs from the bank’s products enter the decision pipeline in real time1.
    • Enriched features: Customer transaction history and past fraud reports come from the feature registry1.
    • Analyst requests: Natural-language descriptions of a policy, which the agent translates into the policy DSL1.
    • Shadow results: Results of the shadow flow go to the ETL, where they’re checked against performance and business metrics1.

    How one policy change reaches production

    1. The analyst runs the plugin’s onboarding skill, which sets up authentication and the environment in place of five documentation articles1.
    2. The analyst describes the policy in natural language in an AI interface such as Cursor1.
    3. The MCP server’s tools query the feature registry for the features the policy can use1.
    4. The MCP server creates a new version of the policy, translated into the policy DSL, and edits its configuration without code1.
    5. The flow orchestrator runs the new defense on live traffic in the shadow flow, which doesn’t affect customers1.
    6. The team validates the shadow results in the ETL against performance and business metrics. Only then is the defense promoted to production1.

    Results

    The published figures measure the move from policies in code to declarative policies, the platform on which the agents now work1.

    Metric Before After Scope and timeframe Reported by
    Policy deployment time 3-5 weeks 1-2 days Policy changes, after the move from code to declarative policies Nubank DefenseIO team, via ZenML, measured1
    Policies in production approximately 20 policies over 300 policies Production policies, same change Nubank DefenseIO team, via ZenML, measured1
    Defense builders around 10 over 50 People who build defenses, same change Nubank DefenseIO team, via ZenML, measured1
    • Policy deployment time: The time for a policy change to reach production, which fell from 3-5 weeks to 1-2 days1.
    • Policies in production: The count grew from about 20 to over 300 policies1.
    • Defense builders: The people who build defenses on the platform grew from about 10 to over 501.

    The agent layer adds onboarding through one setup skill and policy creation in natural language, and the team is testing AI-assisted policy creation1.

    Lessons learned

    Keeping the agents on the declarative layer gave them a narrow, checkable output. The agents write policies with predefined action sets that run through the same engine and shadow tests as every other defense, and configuration changes need fewer tokens than code1.

    All figures are the Nubank team’s own, from its talk as summarized by ZenML1. They measure the declarative platform. ZenML’s own summary ties the cut from 3-5 weeks to 1-2 days to the agent plugin, while its account of the talk ties it to the second redesign, before the agents1. The summary also gives 450+ million daily events where its body gives about 500 million1.

    Accountability for AI-made changes is the team’s first concern. The team asks who is responsible for a policy created through an AI interface and how to tell an agent’s change from a person’s, because a single malicious or erroneous rule could block millions of customers1.

    Faster rule creation might multiply policies. The team asks what happens when users create thousands of rules a day, and how to keep sub-second response times as the policy set grows1.

    AI-written rules must meet the same standard as code written by engineers. That requires validation of business effect and operational cost as well as correctness1. ZenML adds that policy quality depends on prompt engineering and on the model behind each AI interface, which can make results vary1.

    Case study scorecard

    Sources by publication date

    • Vendors and partners 1
    • Press, academic, and regulators 1

    Build this solution yourself

    Analysis

    What you need

    • A declarative policy layer: You need policies stored as data in a DSL with fixed actions, because the agent edits configurations and policy versions, not code1.
    • A shadow path on live traffic: Every new defense ran in shadow mode and passed validation before promotion, so you need a way to run an AI-written policy on real traffic without affecting customers1.
    • An identity provider the agent tools can reuse: The MCP server relied on the bank’s existing authentication, so check that your tools can carry each user’s identity into every change1.

    Reference architecture

    Risk scoring and decisions

    A risk scoring and decisions solution scores each payment, claim, application, or person for a risk such as fraud, financial crime, a loss, or reoffending, and turns the score into a decision or a referral. A model scores each case against its history, and rules and thresholds that the organization sets turn the score into an outcome. People review the referred cases and decide them, and the outcomes that they record train the next model.

    A check mark shows a building block that this case study's sources document.

    Open the reference architecture

    Others who built it

    Cite this case study

    Enterprise AI Case Studies. "Nubank fraud analysts write defense rules with AI agents." Updated Nov 25, 2026. https://case-studies.ai/case-studies/risk-and-compliance/RC-058-fraud-policy-ai-agents-nubank/

    @misc{csai-rc-058,
      author = {{Enterprise AI Case Studies}},
      title = {{Nubank fraud analysts write defense rules with AI agents}},
      year = {2026},
      note = {Updated 2026-11-25},
      url = {https://case-studies.ai/case-studies/risk-and-compliance/RC-058-fraud-policy-ai-agents-nubank/}
    }

    Sources

    The following reporting, and every passage quoted from it, belongs to its publisher, not to this site. Sources and ownership

    1. Source 1:

      Nubank: AI-Powered Fraud Detection Platform Scaling to 450M+ Daily Events

      IndependentZenML, Jan 1, 20261 Jan 2026Accessed Nov 25, 202625 Nov 2026

      Supporting excerpts (55)
      • scaling fraud detection across 450+ million daily events for over 131 million customers across Latin America
      • serving over 131 million customers across Brazil, Mexico, Colombia, and the expanding US market
      • processes approximately 500 million events daily with peak loads of 5 million requests per minute, generating 100 terabytes of logs per day
      • The DefenseIO team, consisting of eight engineers, four ML engineers, four data scientists, and a product manager, operates the Defense Platform - a centralized fraud detection engine that serves not only the fraud business unit but also various product teams across the bank including card issuing, lending, and e-commerce.
      • The presentation delivered by team members Jairo and Daniel chronicles a three-phase evolution
      • The original architecture required each business unit to maintain its own fraud logic embedded directly into product services, leading to duplicated policies, inconsistent implementations, and coordination challenges
      • The first major transformation centralized fraud detection using a Clojure-based infrastructure built from scratch.
      • This architecture featured a flow orchestrator that directed transactions into either a main production flow or a shadow flow for testing, a shared codebase where policies were defined in code, and action managers for live interventions like challenges, delays, and warnings as well as backstage actions like report generation.
      • All decisions and results were stored in their ETL for analysis and feature engineering.
      • this code-centric approach still required significant engineering involvement for every policy change, with business analysts and fraud teams dependent on engineers to translate analytical models into production code
      • The second architecture iteration introduced a declarative ecosystem centered around a custom Domain-Specific Language for policies.
      • a policy engine service that executes the DSL, a policy registry database where policies exist as entities rather than code
      • a feature registry cataloging all available features across
      • a configuration manager enabling real-time threshold and parameter adjustments without deployment cycles
      • all of these components were accessible through a user interface, allowing fraud teams to create and modify policies themselves
      • This transformation reduced policy deployment time from 3-5 weeks to 1-2 days and enabled scaling from approximately 20 policies to over 300 policies in production, while the number of defense builders grew from around 10 to over 50.
      • explicitly rejecting a fully autonomous agent model in favor of constrained AI-assisted tooling
      • while maintaining the control, security, and reliability required for production financial systems
      • The DefenseIO team made a deliberate architectural decision to continue their declarative growth strategy rather than allowing AI agents to generate code directly.
      • they want to ensure that AI-generated policies follow established rules and predefined action sets rather than risking hallucinations or unexpected behaviors that could impact millions of customers
      • The declarative approach also provides token optimization benefits, as configuration changes require less context and fewer tokens than generating full code implementations.
      • The core LLMOps innovation is the DefenseIO Agent Plugin, which combines carefully engineered prompts with a custom Model Context Protocol server.
      • The agent plugin provides several key capabilities through what they call
      • it automates onboarding and environment setup that previously required users to navigate through five different documentation articles covering authentication, environment configuration, and operational steps
      • The MCP server itself runs as a service on AWS
      • enabling internal users to leverage their existing identity and access management when interacting through AI tools
      • The exposed tools allow users to query available features from the feature registry, create new versions of policies using natural language descriptions that get translated into the policy DSL, and edit configurations to optimize rule behavior without touching code.
      • The team explicitly supports multiple AI interfaces rather than building a proprietary solution, mentioning compatibility with tools like Cursor and other developer-focused AI coding assistants.
      • different users will have different preferred tooling, and the MCP standard provides a way to support this heterogeneity without duplicating implementation effort
      • The team wants business analysts to focus exclusively on rule logic, optimization, and behavioral analysis using the AI-assisted interfaces to create and refine policies more quickly.
      • Engineers, meanwhile, should focus on data infrastructure, feature engineering, and optimizing data pipelines to handle the massive volumes Nubank processes.
      • This separation of concerns is enabled by the declarative platform architecture, where the policy DSL abstracts away implementation details from business logic.
      • Shadow mode allows the team to run experimental policies and models against live production traffic asynchronously without impacting customer experience.
      • Transactions flow through both production and shadow paths, with shadow results logged to the ETL for validation against performance and business metrics. Only after thorough validation are defenses promoted to production.
      • The platform currently runs approximately 400 policies and models using around 300 features, with about 100 internal customers interacting with the platform daily.
      • The decision pipeline takes transaction inputs along with enriched features like customer transaction history and past fraud reports, runs them through policies that apply thresholds and business rules to generate decision scores, and triggers both live actions that users experience immediately and backstage actions for analyst review.
      • when a policy is created or modified through an AI interface, who is responsible? How do they ensure they can identify whether an agent or a person made a change?
      • a single malicious or erroneous rule could block millions of customers from conducting transactions
      • this remains an area of active concern as they scale AI-assisted policy creation
      • as AI tooling makes policy creation faster and easier, what happens when customers create thousands of rules daily?
      • How do they manage the computational cost of evaluating an ever-growing policy set against millions of transactions per minute while maintaining sub-second response times required for real-time fraud detection?
      • The team emphasizes extensive measurement of rule behavior, business impact, and operational impact.
      • The quality of AI-generated rules must meet the same stringent standards as engineer-written code, requiring robust validation frameworks that can assess not just functional correctness but business effectiveness and operational efficiency.
      • Data storage leverages Datomic layered over AWS DynamoDB
      • Asynchronous communication between services uses Apache Kafka
      • Machine learning models are implemented in Python
      • Observability infrastructure incorporates various tools for monitoring both system health and ML model performance.
      • The infrastructure employs a global sharding strategy where services are replicated across shards, with each customer assigned to a specific shard.
      • This approach ensures quality of service across the customer base and provides a scaling model where bottlenecks are addressed by adding shards rather than vertically scaling individual services.
      • The use of shadow mode testing for validating changes before production impact is a critical reliability pattern for high-stakes systems.
      • policy engines and DSLs can serve as abstraction layers that enable both human-configured and AI-assisted rule generation while maintaining consistent execution semantics and operational characteristics
      • reducing rule deployment time from 3-5 weeks to 1-2 days while scaling from 20 to over 300 production policies
      • the team is implementing MCP servers and testing AI-assisted policy creation
      • The quality and reliability of policy generation will depend significantly on prompt engineering quality
      • creating potential variability that may be challenging to control in a production environment where consistency is critical
    2. Source 2:

      What is the Model Context Protocol (MCP)?

      Product documentationModel Context Protocol, Jul 28, 202628 Jul 2026Accessed Nov 25, 202625 Nov 2026

      Supporting excerpts (2)
      • MCP (Model Context Protocol) is an open-source standard for connecting AI applications to external systems.
      • development tools like Visual Studio Code, Cursor, MCPJam, and many others all support MCP

    More in Risk & Compliance

    View all