# Automating customer support in banking with agentic RAG

URL: https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag

> How agentic RAG automates bank customer support: one agent retrieves your procedures, another acts through your APIs, with approvals and traces.

Learn

How agentic RAG automates bank customer support: one agent retrieves your procedures, another acts through your APIs, with approvals and traces.

Maksym Buleshnyi · Applied AI, RAG systems · October 21, 2024 · 6 min read · Updated September 29, 2026

In short

Agentic RAG gives a support agent a search tool over your procedures instead of a fixed retrieval step, so it decides what to look up and searches again when results are weak. In banking, pair it with a second agent that acts through your APIs, keep money movement behind approvals, and trace every run. This tutorial builds both agents with the open-source Dynamiq SDK.

Agentic RAG automates banking support by giving an AI agent a search tool over your own procedures instead of a fixed retrieval step. The agent decides what to look up, searches again when the results don't fit, and hands a cited procedure to a second agent that completes the request through your banking APIs. Approvals, PII detection and a trace of every run keep the whole thing within what a bank can explain to an auditor.

## What is agentic RAG?

[Retrieval-augmented generation](https://www.getdynamiq.ai/glossary/retrieval-augmented-generation) (RAG) grounds a model's answer in documents you control. The system embeds the question, retrieves the closest passages from a vector store and asks the model to answer from them.

Classic RAG runs that pipeline once, in a fixed order. Agentic RAG turns retrieval into a tool that an agent calls when it needs to, as often as it needs to. That matters in banking, where a customer's words ("I was charged twice at a hotel abroad") rarely match the title of the procedure that answers them.

|  | Classic RAG | Agentic RAG |
| --- | --- | --- |
| Who decides to search | The pipeline, once per question | The agent, as often as the task needs |
| Weak results | Answers from whatever came back | Rephrases and searches again, or asks the customer |
| Output | An answer | An answer, or an action through a tool |
| Best for | FAQ-style questions | Requests that need lookup, reasoning and an action |

## Why does banking support need more than a chatbot?

Three things make bank support different from a generic help desk:

-   **Procedures change often.** Fees, dispute windows and card controls get updated, so answers must come from the current document, not from what a model remembers.
-   **Many requests end in an action.** Blocking a card, opening a dispute or reissuing a statement needs tools, and the bank needs control over which actions run without a person.
-   **Everything is reviewable.** Supervisors and auditors expect to see what the agent read, what it did and why.

Support automation of this kind is already in production. For one example, read how [an Asian neo-bank automated about 85% of support inquiries and went live in 30 days](https://www.getdynamiq.ai/case-studies/automating-customer-support-at-scale-how-a-neo-bank-saves-1-5m-a-year-with-ai).

## How does the two-agent design work?

The workflow in this tutorial splits the job between two agents:

1.  **The procedures agent** receives the customer's request, searches your internal procedures and returns the steps that apply, plus the details the bank needs from the customer.
2.  **The action agent** receives the request and that procedure, asks the customer for anything missing, and calls the banking API for the steps it is allowed to take.
3.  **The workflow** returns a summary of what was done, and the full run is traced.

Splitting the roles keeps each agent's instructions short and its permissions narrow. The procedures agent can read but not act; the action agent can act only through the tools you give it.

## How do you build it with the Dynamiq SDK?

The code below uses the [open-source Dynamiq SDK](https://www.getdynamiq.ai/open-source) (Apache-2.0), the same engine that runs the visual Agent Builder. It assumes your procedures are already indexed in a Pinecone index called `bank-procedures`.

The [RAG pipeline guide](https://docs.getdynamiq.ai/docs/sdk/rag/rag-pipeline) shows the indexing flow. The SDK supports 8 vector stores, and swapping Pinecone for another one changes a single node.

### Install and configure

```
pip install dynamiq
export OPENAI_API_KEY="..."
export PINECONE_API_KEY="..."
```

### Step 1: Give the agent a search tool over your procedures

`VectorStoreRetriever` bundles a query embedder and a retriever into one tool the agent can call. Use the same embedding model you indexed with.

```
from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.connections import Pinecone as PineconeConnection
from dynamiq.nodes.embedders import OpenAITextEmbedder
from dynamiq.nodes.llms import OpenAI
from dynamiq.nodes.retrievers import PineconeDocumentRetriever
from dynamiq.nodes.retrievers.retriever import VectorStoreRetriever

llm = OpenAI(
    connection=OpenAIConnection(),  # reads OPENAI_API_KEY
    model="gpt-4o-mini",
    temperature=0.1,
)

procedures_search = VectorStoreRetriever(
    name="procedures-search",
    description="Searches the bank's internal support procedures. Input: a short search query.",
    text_embedder=OpenAITextEmbedder(
        connection=OpenAIConnection(),
        model="text-embedding-3-small",  # the model used at indexing time
    ),
    document_retriever=PineconeDocumentRetriever(
        connection=PineconeConnection(),  # reads PINECONE_API_KEY
        index_name="bank-procedures",
        top_k=5,
    ),
)
```

### Step 2: Create the procedures agent

The agent's role tells it to search, retry with a better query when results miss, and say so when no procedure applies.

```
from dynamiq.nodes.agents import Agent

procedures_agent = Agent(
    name="Procedures agent",
    role=(
        "You look up the bank's internal procedure for a customer request. "
        "Search the procedures, rephrase the query if the results do not fit, "
        "and return the steps to follow and the details needed from the customer. "
        "Name the procedure you used. If nothing applies, say so."
    ),
    llm=llm,
    tools=[procedures_search],
    max_loops=6,
)
```

### Step 3: Give the action agent its tools

The action agent gets two tools: an HTTP tool for your internal API and a feedback tool for asking the customer a question.

```
from dynamiq.connections import Http as HttpConnection
from dynamiq.nodes.tools.http_api_call import HttpApiCall
from dynamiq.nodes.tools.human_feedback import HumanFeedbackTool

BANK_API = "http://127.0.0.1:8000"  # your internal API gateway

bank_api = HttpApiCall(
    name="bank-api",
    connection=HttpConnection(method="POST", url=BANK_API),
    description=(
        "Internal bank API for the signed-in customer. Call an endpoint by its full URL "
        "and send parameters in `data`:\n"
        f"- {BANK_API}/cards/block (card_last4, reason)\n"
        f"- {BANK_API}/statements/request (account_last4, month)"
    ),
)

ask_customer = HumanFeedbackTool()  # asks in the console; connect your chat channel in production
```

The tool description is the agent's only documentation for your API, so list every endpoint and its parameters. Notice what is not on the list: nothing moves money. Keep those endpoints out of the agent's reach, or put an approval in front of them.

### Step 4: Chain the agents in a workflow

The action agent runs after the procedures agent and receives both the original request and the procedure it returned.

```
from dynamiq import Workflow
from dynamiq.flows import Flow

def with_procedure(inputs: dict, outputs: dict) -> str:
    return (
        f"Customer request: {inputs['input']}\n\n"
        f"Procedure to follow:\n{outputs[procedures_agent.id]['content']}"
    )

action_agent = (
    Agent(
        name="Action agent",
        role=(
            "You resolve the customer's request by following the procedure you are given. "
            "Ask the customer for a missing detail with the feedback tool. "
            "Never ask for a PIN, password or one-time code. "
            "Finish with a short summary of what you did and what happens next."
        ),
        llm=llm,
        tools=[bank_api, ask_customer],
        max_loops=10,
    )
    .inputs(input=with_procedure)
    .depends_on(procedures_agent)
)

workflow = Workflow(flow=Flow(nodes=[procedures_agent, action_agent]))

session_token = "..."  # from the customer's authenticated app session

result = workflow.run(
    input_data={
        "input": "I lost my debit card this morning. Please block it.",
        "tool_params": {
            "by_name": {"bank-api": {"headers": {"Authorization": f"Bearer {session_token}"}}},
        },
    }
)
print(result.output[action_agent.id]["output"]["content"])
```

`tool_params` passes the customer's session token to the bank API at run time. The model never sees it, so it cannot repeat it in a reply, and the agent never has to ask the customer for credentials.

A runnable version with a mock bank API lives in the SDK repository under [examples/use\_cases/customer\_support](https://github.com/dynamiq-ai/dynamiq/tree/main/examples/use_cases/customer_support). Its mock checks a PIN to stay self-contained. In production, authenticate the customer in your app and never let a model collect a PIN or password.

## What does it take to run this in a bank?

The two agents are the easy part. These controls are what make the workflow acceptable to risk and compliance teams:

-   **Keep data in your perimeter.** Run Dynamiq in our cloud or self-hosted in your own cloud account or data center; see [how we deploy](https://www.getdynamiq.ai/deployment).
-   **Detect PII and prompt injection** before a request reaches a model, with [guardrail nodes](https://www.getdynamiq.ai/product/guardrails) in the workflow.
-   **Put approvals on actions that matter.** An approval pauses a step for a person, who can edit its fields before it runs.
-   **Retrieve with permissions.** [Knowledge bases](https://www.getdynamiq.ai/product/knowledge-rag) apply permission-aware retrieval, so an agent sees only what the asking user is allowed to see.
-   **Trace and evaluate.** Every run is traced with its inputs, outputs, cost and latency. Turn bad runs into test cases and attach [real-time evals](https://www.getdynamiq.ai/product/evaluations) to the live deployment.

For the full picture of support automation across chat and inbound calls, see [customer service agents](https://www.getdynamiq.ai/use-cases/customer-service).

Banks, lenders and insurers can find the rest of the platform, from document review to compliance, on the [financial services page](https://www.getdynamiq.ai/industries/financial-services).

## FAQ

### What is the difference between RAG and agentic RAG?

Classic RAG retrieves once and answers from whatever came back. Agentic RAG gives retrieval to an agent as a tool, so the agent decides when to search, rephrases weak queries and combines retrieval with other tools, such as an API call or a question to the customer.

### Can an AI agent block a card or move money on its own?

Technically yes, if you give it the tool. In practice, banks let agents take low-risk, reversible actions such as blocking a card, and route anything that moves money or changes an account through an approval, where a person reviews and can edit the exact request before it runs.

### How do you keep customer data safe when an LLM handles bank support?

Keep processing inside infrastructure you control, detect PII and prompt injection before text reaches a model, inject credentials at run time instead of asking customers for them, and scope retrieval to what each user may see. A trace of every run gives your auditors the evidence.

### Do you need to retrain the model when procedures change?

No. The agent answers from the retrieved procedure, not from training, so you update the document and re-index it. That also gives compliance teams one place to review what the agent is told to do.

### Which LLM and vector database should I use?

Use the model and store your bank has already approved. The SDK supports 29 model providers and 8 vector stores behind the same interfaces, so changing either one means swapping a single node, not rewriting the workflow.

Maksym Buleshnyi

Applied AI, RAG systems

Writes on applied AI and retrieval-augmented generation for banking at Dynamiq.

On this page

1.  [What is agentic RAG?](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#what-is-agentic-rag)
2.  [Why does banking support need more than a chatbot?](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#why-does-banking-support-need-more-than-a-chatbot)
3.  [How does the two-agent design work?](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#how-does-the-two-agent-design-work)
4.  [How do you build it with the Dynamiq SDK?](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#how-do-you-build-it-with-the-dynamiq-sdk)
5.  [What does it take to run this in a bank?](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#what-does-it-take-to-run-this-in-a-bank)
6.  [FAQ](https://www.getdynamiq.ai/post/automating-customer-support-in-banking-using-agentic-rag#faq)

## Keep reading

-   ### [Build an automated social media management agent with Dynamiq](https://www.getdynamiq.ai/post/build-an-automated-social-media-management-agent-with-dynamiq)
    
    Build an agent that reads a client list, drafts a personalized email for each contact and sends it through Mailgun after a person approves the drafts.
    
    December 9, 2024 · 4 min read
    
-   ### [Building an intelligent Linear app assistant](https://www.getdynamiq.ai/post/building-an-intelligent-linear-app-assistant)
    
    Build a Linear assistant that answers questions about projects and teams and writes well-scoped issues from chat, using Linear's MCP server and Dynamiq.
    
    December 5, 2024 · 4 min read
    
-   ### [Build an autonomous data analyst using Dynamiq, E2B and Together AI](https://www.getdynamiq.ai/post/how-to-build-an-autonomous-data-analyst-using-dynamiq-e2b-and-together-ai)
    
    Build a data analyst agent in Python with the open-source Dynamiq SDK: it reasons with a Together AI model and writes and runs code in an E2B sandbox.
    
    November 6, 2024 · 5 min read
    

## Put this into practice.

See an agent built for your workflow, running in your environment, with our engineers.

[Start free](https://app.getdynamiq.ai/signup) · [Talk to the team](https://www.getdynamiq.ai/book-a-demo)
