> ## Documentation Index
> Fetch the complete documentation index at: https://agent-observability-docs.splunk.com/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/splunk/splunk-ao-python" horizontal>
    Get the code for the sample project. You can find this project by cloning the Splunk Agent Observability Python SDK repo.

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

The code for this sample is available in Python, 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.

## Evaluate the app

The sample project comes with an Agent 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 Agent Stream

Navigate to the **Default Agent Stream** by selecting this project, and selecting the **Default Agent Stream** in the dashboard.

<img src="https://mintcdn.com/agent-observability-docs/tQcIFWBC_UEfM1wy/images/getting-started/multi-agent-default-agent-stream.png?fit=max&auto=format&n=tQcIFWBC_UEfM1wy&q=85&s=0433636dff949456fee8f58ee256f9cf" alt="The default Agent Stream in the project dashboard" width="2398" height="718" data-path="images/getting-started/multi-agent-default-agent-stream.png" />

The Agent Stream is configured with the following evaluators:

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

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

<img src="https://mintcdn.com/agent-observability-docs/tQcIFWBC_UEfM1wy/images/getting-started/multi-agent-tracing-sessions.png?fit=max&auto=format&n=tQcIFWBC_UEfM1wy&q=85&s=6550b843656452d0cbbff486c7ac8648" alt="A set of traces with Correctness and Instruction Adherence evaluators with a range of values" width="2508" height="1134" data-path="images/getting-started/multi-agent-tracing-sessions.png" />

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

### Get insights

Splunk Agent Observability has an Insights Engine that reviews your traces and evaluators, and gives suggestions to improve your application. To generate insights, select the **Agent Stream Insights** button.

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

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 evaluators calculated in Splunk Agent Observability, you will need:

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

  <Steps>
    <Step title="Navigate to the LLM Integrations page" id="step-navigate">
      In the Splunk Agent Observability UI, navigate to the **LLM Integrations** page by selecting your user profile in the upper-right corner and then selecting **Integrations**.

      <img src="https://mintcdn.com/agent-observability-docs/Y4gaVgpsSUs8MBdT/images/console-ui/user-menu-sao.png?fit=max&auto=format&n=Y4gaVgpsSUs8MBdT&q=85&s=3e71ca4ab350c4552866ecb0a323975f" alt="The user menu" width="2458" height="906" data-path="images/console-ui/user-menu-sao.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/agent-observability-docs/Y4gaVgpsSUs8MBdT/images/console-ui/llm-integrations-sao.png?fit=max&auto=format&n=Y4gaVgpsSUs8MBdT&q=85&s=d7faf841b98a7de492bd250734007d0d" alt="LLM provider options" width="1846" height="1098" data-path="images/console-ui/llm-integrations-sao.png" />
    </Step>

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

### Get the code

<Steps>
  <Step title="Clone the SDK examples repo">
    ```bash Terminal theme={null}
    git clone https://github.com/splunk/splunk-ao-python
    ```
  </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 examples/agent/langgraph-fsi-agent/after
      ```
    </CodeGroup>

    <Note>
      If you want to learn more about adding logging with Splunk Agent Observability 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 Splunk Agent Observability [Python SDK Examples GitHub repo](https://github.com/splunk/splunk-ao-python/tree/main/examples).

<CardGroup cols={2}>
  <Card title="SDK Examples" icon="code" horizontal href="https://github.com/splunk/splunk-ao-python/tree/main/examples">
    Check out sample projects using Splunk Agent Observability
  </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
      ```
    </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
      ```
    </CodeGroup>
  </Step>

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

    | Environment Variable     | Value                                                                                                                                                                                                                                  |
    | :----------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
    | `SPLUNK_AO_API_KEY`      | Only required if you are using an on-premises, standalone, or custom deployment. Your API key.                                                                                                                                         |
    | `SPLUNK_AO_PROJECT`      | The name of your Splunk Agent Observability project - this is preset to `Multi-Agent Banking Chatbot`                                                                                                                                  |
    | `SPLUNK_AO_AGENT_STREAM` | The name of your Agent Stream - this is preset to `Default Agent Stream`                                                                                                                                                               |
    | `SPLUNK_AO_CONSOLE_URL`  | Only required if you are using an on-premises, standalone, or custom deployment. Your custom deployment URL, which appears in the browser when you log into Splunk Observability Cloud. For the free 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 Splunk Agent Observability.
    </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
      ```
    </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.

    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/splunk_ao_langgraph_fsi_agent/agents/supervisor_agent.py
  ```
</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()
  ```
</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.
  """
  ```
</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 Splunk Agent Observability UI and examine the new traces. You should see the evaluators improving.

### Run the sample app as an experiment

Splunk Agent Observability allows you to run [experiments](/sdk-api/experiments/experiments) against [datasets](/sdk-api/experiments/datasets) of known data, generating traces in an experiment Agent Stream and evaluating these for different evaluators. 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
      ```
    </CodeGroup>
  </Step>

  <Step title="Evaluate the experiment">
    The unit test will output a link to the experiment in the Splunk Agent Observability UI:

    ```output Terminal theme={null}
    Experiment multi-agent-chatbot-experiment 2025-07-15 at 00:48:11.842 has
    completed and results are available at
    <your-splunk-ao-deployment-url>/<id>/experiments/<id>
    ```

    Follow this link to see the evaluators for the experiment Agent Stream.
  </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 evaluators.
  </Step>

  <Step title="Compare experiments">
    If you navigate back to the experiments list using the breadcrumb, you can select **Compare Experiments**, then select multiple rows to [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="Splunk Agent Observability logger" icon="code" horizontal href="/sdk-api/logging/splunk-ao-logger">
    Log with full control over sessions, traces, and spans using the Splunk Agent Observability 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="Splunk Agent Observability context" icon="code" horizontal href="/sdk-api/logging/splunk-ao-context">
    Manage logging using the Splunk Agent Observability 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 Splunk Agent Observability'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 Splunk Agent Observability @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 Splunk Agent Observability Python SDK reference.
  </Card>
</CardGroup>
