> ## Documentation Index
> Fetch the complete documentation index at: https://docs.galileo.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-agent banking chatbot sample

> Get started with the multi-agent banking chatbot sample project powered by LangGraph, with RAG using Pinecone

The multi-agent banking chatbot sample project is a demo of a multi-agent chatbot powered by LangGraph, with RAG using Pinecone as a vector database. You can have a conversation with the chatbot, and it will bring back information on your (fictional) credit score, as well as give you details of credit cards available from a fictional bank.

<CardGroup cols={1}>
  <Card title="Get the code" icon="code" href="https://github.com/rungalileo/sdk-examples" horizontal>
    Get the code for the sample project. You can find this project by cloning the Galileo SDK Examples repo.

    The code for this project is in the `/python/agent/langgraph-fsi-agent/after/` or `/typescript/agent/langgraph-fsi-agent/` folder.
  </Card>
</CardGroup>

The code for this sample is available in Python and TypeScript, and you can run this code to generate more traces, and experiment with improving the app based off the evaluations.

The Python version of this app uses Chainlit to host the chatbot in a web UI. The TypeScript version is terminal-based.

## Evaluate the app

The sample project comes with a Log stream pre-populated with a set of traces for some sample interactions with the chatbot - some asking relevant questions, some asking questions unrelated to the banking agents capabilities.

### Investigate the Log stream

Navigate to the **Default Log stream** by selecting this project, and selecting the **Default Log stream** in the dashboard.

<img src="https://mintcdn.com/v2galileo/EJflor4xYHvmraya/getting-started/sample-projects/multi-agent-view-all-logs-button.webp?fit=max&auto=format&n=EJflor4xYHvmraya&q=85&s=5a424f0e6d8132a6df74720480c3349a" alt="The default Log stream in the project dashboard" width="920" height="228" data-path="getting-started/sample-projects/multi-agent-view-all-logs-button.webp" />

The Log stream is configured to evaluate the following metrics:

* [Action Advancement](/concepts/metrics/agentic/action-advancement)
* [Action Completion](/concepts/metrics/agentic/action-completion)
* [Tool Errors](/concepts/metrics/agentic/tool-error)
* [Tool Selection Quality](/concepts/metrics/agentic/tool-selection-quality)

For some of the traces, these metrics are evaluated at 100%, showing the agents are working well for those inputs. For other traces, these metrics are reporting lower values, showing the chatbot needs some improvements.

<img src="https://mintcdn.com/v2galileo/E8lj9Nk9__MN-baJ/getting-started/sample-projects/multi-agent-traces.webp?fit=max&auto=format&n=E8lj9Nk9__MN-baJ&q=85&s=f3c69730d65b607d2d38a9e18b03422f" alt="A set of traces with Correctness and Instruction Adherence metrics with a range of values from 33% to 100%" width="2350" height="1140" data-path="getting-started/sample-projects/multi-agent-traces.webp" />

Select different rows to see more details, including the input and output data, the metric scores, and explanations

### Get insights

Galileo has an Insights Engine that reviews your traces and metrics, and gives suggestions to improve your application. To generate insights, select the **Log Stream Insights** button.

<img src="https://mintcdn.com/v2galileo/EJflor4xYHvmraya/getting-started/sample-projects/multi-agent-insights-button.webp?fit=max&auto=format&n=EJflor4xYHvmraya&q=85&s=ee277f44c84e0261817004c7004c2bce" alt="The Log Stream Insights button" width="939" height="236" data-path="getting-started/sample-projects/multi-agent-insights-button.webp" />

The insights will be generated, and show on a pane on the right-hand side:

<img src="https://mintcdn.com/v2galileo/EJflor4xYHvmraya/getting-started/sample-projects/multi-agent-insights.webp?fit=max&auto=format&n=EJflor4xYHvmraya&q=85&s=c44c023db48318cf04231eb3fe23284b" alt="A list of insights" width="1036" height="836" data-path="getting-started/sample-projects/multi-agent-insights.webp" />

Review the generated insights, and think about ways to improve the chatbot by tweaking the agent prompts. The insights will likely have something like this:

> **Summary**
>
> The supervisor agent exhibits inconsistent behavior that undermines the multi-agent system's effectiveness. In a credit score inquiry, the supervisor correctly identified the query type and transferred it to the credit-score-agent, which successfully retrieved the user's credit score (550) and provided helpful context about the score's meaning. However, when control returned to the supervisor, it responded with 'I don't know' despite the specialist having successfully completed the task. This creates a frustrating user experience where the system retrieves the requested information but then claims ignorance, potentially making users think the system is broken or unreliable.
>
> **Suggestions**
>
> Ensure the supervisor agent properly processes and relays the results from specialist agents instead of defaulting to 'I don't know' responses.

To see how you can use these insights to improve the app, get the code and try some different agent prompts.

## Run the sample app

You can run the sample app to generate more traces, and test out different agent prompts.

### Prerequisites

To run the code yourself to generate more traces, you will need:

* Access to an OpenAI compatible API, such as
  * An OpenAI API key
  * Access to an OpenAI compatible API, such as Google Vertex
  * Ollama installed locally with a model downloaded
* A [Pinecone account](https://www.pinecone.io). The free Starter tier is more than enough for this project. You will need your Pinecone API key.
* Either Python 3.10 or later, or Node installed

To get metrics calculated in Galileo, you will need:

* An integration with an LLM configured. If you don't have an integration configured, then:

  <Steps>
    <Step title="Navigate to the Integrations page" id="step-navigate">
      In the Galileo console UI, navigate to the [LLM integrations page](https://app.galileo.ai/settings/integrations) by opening the user menu on the bottom-left corner, and then selecting **Integrations**.

      <img src="https://mintcdn.com/v2galileo/L1-piB8ckkwMmjO7/images/console-ui/integrations-user-menu.png?fit=max&auto=format&n=L1-piB8ckkwMmjO7&q=85&s=4ba1694ec13769ae154c95f956b99a7e" alt="Integrations user menu" width="1554" height="1374" data-path="images/console-ui/integrations-user-menu.png" />
    </Step>

    <Step title="Add an integration" id="step-add-integration">
      Locate the LLM provider you are using (or specify a [custom integration](/sdk-api/third-party-integrations/model-integrations/custom-model-integrations/custom-model-integrations)), then select the **+Add Integration** button.

      <img src="https://mintcdn.com/v2galileo/L1-piB8ckkwMmjO7/images/console-ui/integrations-options.png?fit=max&auto=format&n=L1-piB8ckkwMmjO7&q=85&s=28d88856324a0bec7ff425e892ca56ad" alt="LLM provider options" width="2045" height="1156" data-path="images/console-ui/integrations-options.png" />
    </Step>

    <Step title="Add settings" id="step-add-settings">
      Specify settings for your integration (such as an API key), then select **Save changes**.

      <img src="https://mintcdn.com/v2galileo/L1-piB8ckkwMmjO7/images/console-ui/integrations-openai-modal.png?fit=max&auto=format&n=L1-piB8ckkwMmjO7&q=85&s=76441ca64e237871a3f7aa1351df60c0" alt="OpenAI integration input modal" width="1292" height="600" data-path="images/console-ui/integrations-openai-modal.png" />
    </Step>
  </Steps>

### Get the code

<Steps>
  <Step title="Clone the SDK examples repo">
    ```bash Terminal theme={null}
    git clone https://github.com/rungalileo/sdk-examples
    ```
  </Step>

  <Step title="Navigate to the relevant project folder">
    Start by navigating to the root folder for the programming language you are using:

    <CodeGroup>
      ```bash Python theme={null}
      cd python/agent/langgraph-fsi-agent/after
      ```

      ```bash TypeScript theme={null}
      cd typescript/agent/langgraph-fsi-agent
      ```
    </CodeGroup>

    <Note>
      The Python code for the sample is in a folder called `after`. If you want to learn more about adding logging with Galileo to a LangGraph app, check out the [add evaluations to a multi-agent LangGraph application cookbook](/cookbooks/use-cases/multi-agent-langgraph/multi-agent-langgraph).
    </Note>
  </Step>
</Steps>

The full source code for all of our sample projects is available in the Galileo [SDK Examples GitHub repo](https://github.com/rungalileo/sdk-examples).

<CardGroup cols={2}>
  <Card title="SDK Examples" icon="code" horizontal href="https://github.com/rungalileo/sdk-examples">
    Check out sample projects using Galileo
  </Card>
</CardGroup>

### Set up Pinecone

This project uses Pinecone as a vector database to power a RAG agent that retrieves data around the fictional credit cards offered by a bank. Before you can run the app, you will need to upload the documents.

<Steps>
  <Step title="Configure environment variables">
    In each project folder is a `.env.example` file. Rename this file to `.env` and populate the `PINECONE_API_KEY` value. You can leave the other values for now as you will populate them later
  </Step>

  <Step title="Upload the documents">
    There is a helper script in the `scripts` folder. Run this script to create a new index in Pinecone and upload the documents.

    <CodeGroup>
      ```python Python theme={null}
      python ./scripts/setup_pinecone.py
      ```

      ```typescript TypeScript theme={null}
      npm run upload-docs
      ```
    </CodeGroup>

    This will take a few seconds, and a successful run should look like:

    ```output Terminal theme={null}
    Loading documents for credit-card-information folder...
    ...
    ✅ Document processing and upload complete!
    ```
  </Step>
</Steps>

### Run the code

<Steps>
  <Step title="Install required dependencies">
    From the project folder, Install the required dependencies. For Python, make sure to create and activate a virtual environment before installing the dependencies.

    <CodeGroup>
      ```bash Python theme={null}
      pip install -r requirements.txt
      ```

      ```bash TypeScript theme={null}
      npm install
      ```
    </CodeGroup>
  </Step>

  <Step title="Configure environment variables">
    In your `.env` file, populate the Galileo values:

    | Environment Variable  | Value                                                                                                           |
    | :-------------------- | :-------------------------------------------------------------------------------------------------------------- |
    | `GALILEO_API_KEY`     | Your API key                                                                                                    |
    | `GALILEO_PROJECT`     | The name of your Galileo project - this is preset to `Multi-Agent Banking Chatbot`                              |
    | `GALILEO_LOG_STREAM`  | The name of your Log stream - this is preset to `Default Log stream`                                            |
    | `GALILEO_CONSOLE_URL` | Optional. The URL of your Galileo console for custom deployments. For the fre tier, you don't need to set this. |

    <Note>
      You can find these values from the project page for the multi-agent banking chatbot sample page in the Galileo Console.
    </Note>

    Next populate the values for your LLM:

    | Environment Variable | Value                                                                                                                                                                                                                                                                    |
    | :------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `OPENAI_API_KEY`     | Your OpenAI API key. If you are using Ollama, set this to `ollama`. If you are using another OpenAI compatible API, then set this to the relevant API key.                                                                                                               |
    | `OPENAI_BASE_URL`    | Optional. The base URL of your OpenAI deployment. Leave this commented out if you are using the default OpenAI API. If you are using Ollama, set this to `http://localhost:11434/v1`. If you are using another OpenAI compatible API, then set this to the relevant URL. |
    | `MODEL_NAME`         | The name of the model you are using                                                                                                                                                                                                                                      |
  </Step>

  <Step title="Run the project">
    Run the project with the following command:

    <CodeGroup>
      ```bash Python theme={null}
      chainlit run app.py -w
      ```

      ```bash TypeScript theme={null}
      npm run start
      ```
    </CodeGroup>

    If you are using the Python version, the app will be running at [localhost:8000](http://localhost:8000), so open it in your browser.

    <img src="https://mintcdn.com/v2galileo/E8lj9Nk9__MN-baJ/cookbooks/use-cases/multi-agent-langgraph/bot-demo.gif?s=5b8f5ed8704de591d6486ad3e53ce743" alt="A demo of the bot responding to being asked what credit cards do you offer. The bot lists 2 cards" width="830" height="480" data-path="cookbooks/use-cases/multi-agent-langgraph/bot-demo.gif" />

    If you are using TypeScript, the app will run in your terminal:

    <CodeGroup>
      ```output Terminal theme={null}
      You: What credit cards do you offer?
      Assistant: Brahe Bank offers the Orbit Basic Credit Card, which features no
        annual fee, variable interest rates (29.9% APR on purchases, 34.9% APR
        on cash advances), and a 0% APR on balance transfers for 12 months. It
        does not include a rewards program but offers standard fraud protection,
        digital card management tools, and contactless payment support.

        Eligibility requires being 18 or older with a valid U.S. address and SSN,
        and a fair credit history with a credit score over 500.
        Would you like information on eligibility or application process?
      ```
    </CodeGroup>

    You can ask the agent questions about:

    * The different credit cards offered by the bank
    * Your credit score
  </Step>
</Steps>

### Improve the app

The insights you viewed earlier suggested improving how the supervisor agent processes messages, especially with credit scores. You can try this out to see what issues might occur:

```output Terminal theme={null}
You: What is my credit score?
Assistant: I cannot answer that question.
```

Despite there being an agent to get the users credit score, it is not always used.

To improve the agent, have a look at the agent prompt defined in the following file:

<CodeGroup>
  ```output Python theme={null}
  src/galileo_langgraph_fsi_agent/agents/supervisor_agent.py
  ```

  ```output TypeScript theme={null}
  agents/supervisorAgent.ts
  ```
</CodeGroup>

In this file is the current agent prompt:

<CodeGroup>
  ```python Python theme={null}
  bank_supervisor_agent = create_supervisor(
      model=ChatOpenAI(model=os.environ["MODEL_NAME"], name="Supervisor"),
      agents=[credit_card_information_agent, credit_score_agent],
      prompt=(
          """
          You are a supervisor managing the following agents:
          - a credit card information agent. Assign any tasks related to
            information about credit cards to this agent
          Otherwise, only respond with 'I don't know' or 'I cannot answer
          that question'.
          If you need to ask the user for more information, do so in a
          concise manner.
          """
      ),
      add_handoff_back_messages=True,
      output_mode="full_history",
      supervisor_name="brahe-bank-supervisor-agent",
  ).compile()
  ```

  ```typescript TypeScript theme={null}
  const bankSupervisorAgent = createSupervisor({
      llm: new ChatOpenAI({ model: process.env.MODEL_NAME }),
      agents: [creditCardInformationAgent, creditScoreAgent],
      prompt: `
          You are a supervisor managing the following agents:
          - a credit card information agent. Assign any tasks related to
            information about credit cards to this agent
          Otherwise, only respond with 'I don't know' or 'I cannot answer
          that question'.
          If you need to ask the user for more information, do so in a
          concise manner.
      `,
      addHandoffBackMessages: true,
      outputMode: "full_history",
      supervisorName: "brahe-bank-supervisor-agent",
  }).compile();
  ```
</CodeGroup>

This supervisor agent prompt explicitly mentions the credit card agent, but not the credit score agent. You can encourage the supervisor agent to use the credit score agent to get better results:

<CodeGroup>
  ```python Python theme={null}
  """
  You are a supervisor managing the following agents:
  - a credit card information agent. Assign any tasks related to
      information about credit cards to this agent
  - a credit score agent. Use this to get the users credit score.
  Otherwise, only respond with 'I don't know' or 'I cannot answer
  that question'.
  If you need to ask the user for more information, do so in a
  concise manner.
  """
  ```

  ```typescript TypeScript theme={null}
  `
  You are a supervisor managing the following agents:
  - a credit card information agent. Assign any tasks related to
      information about credit cards to this agent
  - a credit score agent. Use this to get the users credit score.
  Otherwise, only respond with 'I don't know' or 'I cannot answer
  that question'.
  If you need to ask the user for more information, do so in a
  concise manner.
  `
  ```
</CodeGroup>

Try this new prompt out and see how the agent responds.

```output Terminal theme={null}
You: what is my credit score
Assistant: Your credit score is 550. If you have any other questions or
need further assistance, please let me know.
```

Once you have asked a few questions, head back to the Galileo Console and examine the new traces. You should see the metrics improving.

### Run the sample app as an experiment

Galileo allows you to run [experiments](/sdk-api/experiments/experiments) against [datasets](/sdk-api/experiments/datasets) of known data, generating traces in an experiment Log stream and evaluating these for different metrics. Experiments allow you to take a known set of inputs and evaluate different prompts, LLMs, or versions of your apps.

This sample project has a unit test that runs the chatbot against a pre-defined dataset, containing a mixture of sensible and irrelevant questions:

```json dataset.json theme={null}
[
    {"input": "What are the cashback rewards offered by the Orbit Credit Card?"},
    {"input": "What is my credit score?"},
    {"input": "What is the APR for balance transfers on the Orbit Credit Card?"},
    {"input": "What credit cards am I eligible for?"},
    {"input": "What can I do with my credit score?"},
    {"input": "Recommend me a good book."}
    ...
]
```

You can use this unit test to evaluate different supervisor agent prompts for your app.

<Steps>
  <Step title="Run the unit test">
    Use the following command to run the unit test:

    <CodeGroup>
      ```python Python theme={null}
      python -m pytest test.py
      ```

      ```typescript TypeScript theme={null}
      npm run test
      ```
    </CodeGroup>
  </Step>

  <Step title="Evaluate the experiment">
    The unit test will output a link to the experiment in the Galileo Console:

    ```output Terminal theme={null}
    Experiment multi-agent-chatbot-experiment 2025-07-15 at 00:48:11.842 has
    completed and results are available at
    https://app.galileo.ai/project/<id>/experiments/<id>
    ```

    Follow this link to see the metrics for the experiment Log stream.

    <img src="https://mintcdn.com/v2galileo/E8lj9Nk9__MN-baJ/getting-started/sample-projects/multi-agent-experiment.webp?fit=max&auto=format&n=E8lj9Nk9__MN-baJ&q=85&s=079a27c92164240f630e53159f9db023" alt="The experiment with low correctness scores for most rows" width="890" height="611" data-path="getting-started/sample-projects/multi-agent-experiment.webp" />
  </Step>

  <Step title="Try different supervisor agent prompts">
    Experiment with different supervisor agent prompts. Edit the supervisor agent prompt in the app, then re-run the experiment through the unit test to see how different supervisor agent prompts affect the metrics.
  </Step>

  <Step title="Compare experiments">
    If you navigate to the experiments list using the **All Experiments** link, you will be able to compare the average metric values of each run.

    <img src="https://mintcdn.com/v2galileo/E8lj9Nk9__MN-baJ/getting-started/sample-projects/compare-experiments.webp?fit=max&auto=format&n=E8lj9Nk9__MN-baJ&q=85&s=fe93087dd5361ed94f0df944f5865f9d" alt="A list of experiments with the scores increasing as you go up the list" width="1992" height="714" data-path="getting-started/sample-projects/compare-experiments.webp" />

    You can then select multiple rows and [compare the experiments in detail](/concepts/experiments/compare).
  </Step>
</Steps>

## Next steps

### Logging with the SDKs

<CardGroup cols={2}>
  <Card title="Learn how to log experiments" icon="flask" horizontal href="/sdk-api/experiments">
    Learn how to run experiments with multiple data points using datasets and prompt templates
  </Card>

  <Card title="Galileo logger" icon="code" horizontal href="/sdk-api/logging/galileo-logger">
    Log with full control over sessions, traces, and spans using the Galileo logger.
  </Card>

  <Card title="Log decorator" icon="code" horizontal href="/sdk-api/logging/log-decorator/log-decorator">
    Quickly add logging to your code with the log decorator and wrapper.
  </Card>

  <Card title="Galileo context" icon="code" horizontal href="/sdk-api/logging/galileo-context">
    Manage logging using the Galileo context manager.
  </Card>
</CardGroup>

### How-to guides

<CardGroup cols={2}>
  <Card title="Log Using the OpenAI Wrapper" icon="code" href="/how-to-guides/basics/basic-example" horizontal>
    Learn how to integrate and use OpenAI's API with Galileo's wrapper client.

    <br />

    **Python**
  </Card>

  <Card title="Log Using the @log Decorator" icon="code" href="/how-to-guides/basics/basic-logging-with-decorator/basic-logging-with-decorator" horizontal>
    Learn how to use the Galileo @log decorator to log functions to traces

    <br />

    **Python**
  </Card>

  <Card title="Create Traces and Spans" icon="code" href="/how-to-guides/basics/manual-span-creation/manual-span-creation" horizontal>
    Learn how to create log traces and spans manually in your AI apps

    <br />

    **Python**
  </Card>
</CardGroup>

### SDK reference

<CardGroup cols={2}>
  <Card title="Python SDK Reference" icon="python" horizontal href="/sdk-api/python/sdk-reference">
    The Galileo Python SDK reference.
  </Card>

  <Card title="TypeScript SDK Reference" icon="js" horizontal href="/sdk-api/typescript/sdk-reference">
    The Galileo TypeScript SDK reference.
  </Card>
</CardGroup>
