Skip to content

Repository files navigation

Fred

Fred is a multi-agent AI assistant to help managing your Kubernetes applications. It consists of a python backend, exposing (fast API) REST endpoints, and a companion UI that provides you with a simple but effective chatbot UI.

Fred is primarly a laboratory to explore how to best design a complete multi-agent application using LangChain and LanGraph. It does not pretend to be a framework, instead it is a complete example that illustrates how to turn several specialized agents into a fully-fledge expert team ready to assist you in answering very precise questions about your K8S application.

Checkout Fred website for details and position papers.

Installation

Have a look first at fred website get started.

Simply explained, you need to first start the Python backend as explained here, then the UI as explained here.

Here is the quick procedure for impatient people.

You will need a valid OpenAI API Key with an access to the gpt-4o model - check the OpenAI help topic - How can I access GPT-4, GPT-4 Turbo, GPT-4o, and GPT-4o mini to get one.

Using non containerized development environment

0. Overview

You setup everything directly on your machine in bare-metal.

1. Requirements and installation

The backends requires Python 3.12.8. We strongly encourage you to use pyenv to install Python.

pyenv install 3.12.8
pyenv global 3.12.8

pyenv versions
  system
* 3.12.8 (set by /home/cyrille-biard/.pyenv/version)

A backend/.python-version file is part of the repository to ensure your local development environment match fred requirements. Note that pyenv takes care of both Python and pip, but not poetry. Poetry 1.7 is required. It will be part of the constructed virtual env. Please use the make command to build it.

cd backend/
make build

The front end requires node v22.13.0. We strongly encourage you to use nvm to install and manage node. Similarly use the make command.

cd frontend
make build

Install NVM on Linux Then

Use NVM to install the expected release of nodeJS
nvm install 22.13.0

2. Connection

In one terminal:

export OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
cd backend
make run

In another terminal:

cd frontend
make run

Then open https://localhost:5173 in your local browser.

Using Docker development environment

Watchout: this is WIP. The docker compose make easier to develop the frontend and the backend deploying and configuring the following required compoments for you:

0. Overview

You setup everything on Docker. The provided dockerfiles correctly deals with all requirements issues as well by leveraging the same Makefiles.

  • keycloak
  • opensearch and opensearch-dashboards
  • minio
  • a dummy kubernetes cluster

This guarantees we all share the same environments and Docker image.

1. Requirement

According to the distribution of your docker host, install the following packages:

2. Prepare your Linux docker host

2.1. Proxy environment variables

If you use a proxy to access to the internet, make sure your workstation won't use it to access to the local or container networks.

export PROXY_URL="<PROXY_URL>"
export https_proxy=$PROXY_URL
export http_proxy=$PROXY_URL
export ftp_proxy=$PROXY_URL
export no_proxy=localhost,127.0.0.1,10.0.0.0/8,172.0.0.0/8,192.168.0.0/16,0.0.0.0,$(hostname -i),$(hostname -s),$(hostname -f | tr '[[:upper:]]' '[[:lower:]]')

Tips: You can set the lines above into your ~/.bashrc file to set these environment variables when you log in.

You also need to configure the docker daemon to use the proxy.

cat << EOF | sudo tee /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "proxies": {
    "http-proxy": "$PROXY_URL",
    "https-proxy": "$PROXY_URL"
  }
}
EOF

Restart the docker daemon to apply the previous change.

sudo systemctl restart docker
2.2. Kernel tunning for opensearch container

Increase the vm.max_map_count - this is a requirement for opensearch.

echo "vm.max_map_count=262144" | sudo tee /etc/sysctl.d/10-opensearch.conf
sudo sysctl -p
2.3. Local network name resolution

Add the entry 127.0.0.1 fred-keycloak into your docker host /etc/hosts to be correctly redirected from your web browser.

grep -q '127.0.0.1.*fred-keycloak' /etc/hosts || echo "127.0.0.1 fred-keycloak" | sudo tee -a /etc/hosts

Ensure that following commands work

ping fred-keycloack
getent hosts fred-keycloack
2.4. Define OpenAI API Key environment variable

Set your OpenAI API Key into the environment variables file ~/.fred/openai-api-key.env that will be used by the backend container.

mkdir ~/.fred
echo "OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>" > ~/.fred/openai-api-key.env

(as a reminder, go back to Get Started to get the link to get an OpenAI API Key)

3. Start the stack

Once your docker host is ready, you can start the docker compose stack. The way to start all containers might depends on your IDE. VSCode has a plugin called Dev Containers that allow to develop directly into the container. But if you do not use VSCode, we provide a script to

You are going to use:

The full environment might take 10-15 minutes to be ready.

3.1. Development with VSCode

Open VSCode and make sure Dev Containers plugin is installed.

Then in VSCode:

  • Press the F1 key
  • Select Dev Containers: Reopen in Container (or Dev Containers: Rebuild and Reopen in Container)
  • Wait until all containers are up and running, and the VSCode extensions are installed in the dev container
  • Open the Run and Debug panel on the left (shortcut: Ctrl + Shift + D)
  • Select Run Backend, click the Play button, and wait for the process to start. It should be listening on port 8000
  • Do the same for Run Frontend, and wait until Vite has started and is listening on port 5173

3.2. Development with another IDE than VSCode

Start all containers with this command:

chmod u+x ./deploy/docker-compose/fred-compose.sh
./deploy/docker-compose/fred-compose.sh start

If you make changes on frontend code, it will be applied without restarting the container.

If you make changes on backend code, you will have to restart the container to apply your changes. Restart it with this command:

docker restart fred-backend

4. Access the web interfaces for dependencies

Some default users are already available and they can connect to fred, opensearch-dashboards and minio:

  • Administrator user : alice
  • Editor user : bob
  • Viewer user : phil

Hereunder the configuration of the following components required by fred:

  • Keycloak:

  • Opensearch:

    • URL: http://localhost:5601
    • Indice: localvector
    • Admin service account: admin
    • Read only service account: fred_ro
    • Read write service account: fred_rw
  • MinIO:

All passwords are Azerty123_ for this ephemeral and local development stack.

5. Deploy Fred backend and frontend

cd backend
make docker-build
make docker-run

cd ../frontend
make docker-build
make docker-run 

Documentation

Documentation is available at https://fredk8.dev.

Contributing

If you are interested in contributing to the project, start by reading the Contributing guide.

License

Fred is apache V2. Checkout the LICENSE for details

Contacts

About

fred multi agent ui and backend

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages