npm package: @k1ssh/qbot
Description: QBot SDK is a set of APIs for creating and managing microservices, and Kubernetes deployments. This is the core package for QBot AI.
Latest version: 0.1.0

# qbot

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

QBot SDK is the engine that powers the K1s QBot, your kubepilot assistant. See this as the Kubernetes' `kubelet`, where you can request actions to be performed on your Kubernetes cluster and resources. QBot is an Agent that executes task in an (ZTNA) environment on behalf of a user.

## Concepts

- `tasks`: The tasks are the requests that you can send to the QBot. For example, you can request the QBot to "deploy a new application", or to "scale an existing application", or to "troubleshoot a problem". The QBot will process the request and execute the necessary actions to fulfill the request.
- `resources`: The resources are the objects that the QBot can manage. For example, the QBot can manage Deployments, Services, ConfigMaps, etc.
- `applications`: The applications are the objects that the QBot can manage. For example, the QBot can manage Helm Charts, Kustomize, etc. `applications` are a subset of `resources`.
- `tools`: The tools are the AI tools that the QBot uses to process the requests. For example, the QBot can use the `Helm` tool to deploy a Helm Chart, or the `Kustomize` tool to deploy a Kustomize application. `tools` encapsulate the logic to manage the `applications` and `resources` to simplify the `tasks` a DevOps engineer can perform. The QBot can use multiple `tools` to process a single `task`.

## Components model

The QBot is composed of the following components:

- The **QBot `Engine`**: The main engine that processes the requests and executes the `tasks` through one or more `tools`.
- The QBot `Tools`: AI Tools allow LLMs to interact with the QBot Engine, see tools as the APIs for LLMs. The QBot can use multiple `tools` to process a single `task`.
- `Tasks`: The tasks are acions implemented by tools that the QBot can perform. For example, the QBot can detect the "drift configuration" of an `application`, or can perform a "root cause analysis" of a problem. By executing the `drift_detection` tool that will perform the actions needed. A `task` can be composed of multiple `tools`.
- The QBot `CLI`: The CLI is the interface that the user can use to interact with the QBot SDK. The CLI allows the user to interact with an environment.

Both, the CLI and the QBot Engine, interact with the QBot SDK to perform the actions. The QBot SDK is a set of libraries that encapsulate the logic to interact with the Kubernetes API, Helm, Kustomize, etc.

In an analogy with Kubernetes applications, the QBot Engine is the `kubelet`, the QBot Tools are the `pods`, the QBot tasks are the `deployments`, and the QBot CLI is the `kubectl`, leveraging MCP (Model Context Protocol) to interact with LLMs, MCP would be the `kube-api-server` API. QBot is a `kubelet` for LLMs.

At "[La Rebelion](https://rebelion.la/)" we consider that MCP (Model Context Protocol) is the best way to interact with LLMs, so the QBot API is a group of [MCP Tools](https://agentico.com/tools) that can be used by LLMs to interact with the QBot Engine. The MCP server can expose the MCP API over HTTP, or `stdin` - for CLI, **important in airgapped environments**.

### Components Overview Diagram

![QBot Components](./qbot-components-overview.png)

### Components Diagram Details

![QBot Components Diagram](./qbot-components.png)


To install dependencies:

```bash
bun install
```

To run:

```bash
bun run index.ts
```

## License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

## Acknowledgments

- [Helm](https://helm.sh/)
- [Kubernetes](https://kubernetes.io/)
- [Bitnami](https://bitnami.com/)
- ["La Rebelion" GitHub](https://github.com/la-rebelion/)
- ["La Rebelion" Website](https://rebelion.la/)
- [Agentico](https://agentico.com/)
- [Agentico GitHub](https://github.com/agentico-dev/)
- [K1s](https://k1s.sh/), simplifying Kubernetes for developers.