Skip to content
duongnam.com
← Back to projects

Professional

KYC Compliance Agent

Make a decision matrix accessible to the KYC team.

RulesGuidance
My role
Contributor to the foundation · main KYC developer
Status
Internal project
Technology
React, .NET, ClosedXML, OpenAI SDK, Azure AI Foundry, Azure SQL, Azure App Service

Start from a foundation I knew

I helped develop an internal conversational platform. We then forked it to address a need within the KYC team. I carried out most of the development of this specialised project.

We had a conversational foundation. We needed to adapt it to the team’s vocabulary, its decision rules and the documents required in different scenarios.

The starting point: a decision matrix

The team used a large Excel file as a decision matrix, looking up the rules that applied to a given situation. To help a user, the assistant needed to account for that logic and point them towards the right documents for their scenario.

The challenge lay in connecting a question expressed in conversation with the conditions in the spreadsheet. We needed to preserve the meaning of the rules: a useful answer would help users understand their situation and identify what to consult.

In the .NET backend, I used ClosedXML to process the Excel file. I converted each rule into coherent text that preserved its conditions, then stored those texts as rows in Azure SQL so they could be retrieved from a question.

The team updated its rules regularly. I chose a deterministic conversion process so I could update the converted rules while keeping unnecessary changes to a minimum. That requirement applied to preparing the data used for retrieval.

Prepare the rules

  1. Decision matrixExcel

    Multiple sheets, merged cells and groups of rules.

  2. Deterministic conversion.NET · ClosedXML

    Rules rewritten as semantically coherent text.

  3. Stored rulesAzure SQL

    Text converted from the Excel rules.

When importing an update

  1. The same decisionDecision identifier

    The existing content and the imported content.

  2. Comparison sub-agent

    Content comparison, returned as a JSON flag.

    { "hasChanged": false }or{ "hasChanged": true }
  3. Review before applyingManual review

    I review the prepared update before applying it.

Retrieve a rule

  1. QuestionReact

    The user’s request.

  2. AgentOpenAI SDK · Azure AI Foundry

    Access to the rules through a custom tool.

  3. Vector retrievalCustom tool

    Similarity between the question vector and the rule vectors.

  4. Answer with sourceBack to the user

    The rule and its location in the available workbook.

HostingAzure App Service

Rework the spreadsheet with the business team

The hardest part of processing Excel was handling merged cells and rules spread across several sheets. I needed to identify which group each rule belonged to so I could preserve its context in the converted text.

We agreed with the business team to reorganise some sheets. I adapted the processing to the team’s needs, and we also adjusted the structure of the file they worked with. Revising that existing material was part of building the assistant.

Retrieve a rule and cite its source

I built a RAG approach around the matrix: the agent retrieved relevant rules before composing its answer. For retrieval, the question and the rule texts were represented as vectors, called embeddings. These sequences of numbers make it possible to compare meaning across phrases that may use different words.

The agent called a custom tool that compared the question vector with the rule vectors and returned the corresponding texts. Vector similarity helps select candidate rules; their conditions and exceptions still need to match the user’s situation.

The team retained access to the Excel file. The agent mentioned the rule and the precise place in the workbook where users could find the information. Business users could consult that passage to check the answer and took part in reviews. When preparing the texts, I needed to preserve that connection to the original rule.

Compare rules when importing an update

Each decision had an identifier in a spreadsheet column. I also added a sub-agent to compare the imported content with the existing content. It assessed whether the two still conveyed the same meaning or whether the rule had changed, then returned JSON with the hasChanged field set to false or true. That result helped prepare an update, which I reviewed before applying.

I used deterministic processing to convert rules into text. To assess a change in meaning between two pieces of content, I asked the sub-agent for a judgment. That second step relied on the model; it did not make the whole pipeline deterministic.

Give the team a shared knowledge base

We wanted to make knowledge easier to share within the KYC team. The assistant was intended to provide a common point of access to rules and documents, helping users work from the same reference material.

That need defined the project’s scope: support the team’s work with the business knowledge it held. The decision matrix remained central to that scope.

Fictional example

A simplified teaching example, with no real KYC rule.

In the matrix
SituationScenario A
Required documentDocument A
Converted text
If the file matches scenario A, request document A.
Question
My file falls under scenario A. Which document should I provide?
Answer
In this scenario, document A is requested.Fictional source: example workbook, “Example” sheet, decision A.

The approach I would explore today

If I returned to this project, I would test Copilot Studio for the conversation and retrieval orchestration. I consider that feasible while retaining the work specific to the matrix: the .NET and ClosedXML service that reads the sheets, converts rules reproducibly and prepares updates in Azure SQL. I would also keep human review before replacing a rule.

I would expose the existing search engine through a read-only tool, connected to Copilot Studio through a connector or MCP. For each result, the service would return the rule text, its identifier and its location in the workbook. The agent could then explain the applicable conditions and cite a source the user can inspect. I would start with this integration to compare its answers with those from the original system.

With the Microsoft Copilot harness, formerly the GitHub Copilot harness, I would create skills to describe the business procedures: ask for missing information, call retrieval, examine conditions and exceptions, then explain the required documents with references. Skills would guide tool use; the current rules would remain in the database. When a request is ambiguous, I would instruct the agent to clarify the situation before drawing a conclusion.

I would compare this approach with Copilot Studio’s standard orchestration. For a question followed by one search and a sourced answer, the standard harness could be sufficient. I would choose the newer harness if cases required a more adaptive process, with successive searches and checks, and if the benefit justified its response time and credit consumption.

With the business team, I would build a set of cases covering similar wording, different conditions, missing information and updated rules. I would compare answer accuracy, citation validity, response time and cost. I would also check access permissions and data policies before choosing the architecture. I have not implemented this redesign.