---
title: "Components"
description: "Overview of the component system — libraries, environments, instances, and wiring"
source_url: https://ai-ops.com/docs/components/introduction
---

# Components

Components let you deploy custom logic that runs in real-time inside the Koios platform. Use them to build control algorithms, data transformations, state machines, alarm logic, and custom protocol adapters — all without managing external infrastructure.

---

## Key Concepts

The component system has four main building blocks:

| Concept | What It Is |
|---------|-----------|
| **Library** | A packaged collection of component types, uploaded as a `.kcl` (Koios Component Library) file |
| **Environment** | An execution context where component instances run at a shared scan rate |
| **Instance** | A running copy of a component type, placed on an environment's canvas |
| **Wire** | A data connection between an instance's input/output and a tag, another instance, or historical data |

### How They Fit Together

```text
Library (.kcl)              Environment
  ├── Adder                   ├── Instance: "Room Temp Avg" (Adder)
  ├── Latch                   ├── Instance: "Alarm Latch" (Latch)
  └── MovingAverage           └── Instance: "Smoothed Pressure" (MovingAverage)
                                     ↕ wires ↕
                              Tags, other instances, historical data
```

1. **Upload a library** containing one or more component types
2. **Create an environment** with a scan rate (how often components execute)
3. **Add instances** of components to the environment's visual canvas
4. **Wire inputs and outputs** to tags, other components, or historical data
5. **Enable the environment** — the component engine begins executing your logic

---

## Component Types

Libraries can contain four categories of components:

| Category | Use Case | Examples |
|----------|----------|---------|
| **Control** | Feedback loops and setpoint management | PID controllers, fuzzy logic, cascade control |
| **Processing** | Data transformation and aggregation | Scaling, moving averages, unit conversion, filtering |
| **Logic** | Decision making and state management | State machines, latches, edge detection, alarm rules |
| **Protocol** | Custom device communication | Proprietary protocols, data adapters |

Koios ships with a **Core Library** containing common building blocks — math operations, boolean logic, comparisons, signal processing, and more. You can also build and upload your own libraries.

---

## Execution Model

Each environment runs its components in a continuous loop at the configured scan rate:

1. **Read inputs** — resolve all wired input values from tags and other components
2. **Sort by dependencies** — components are automatically ordered so that upstream outputs are available before downstream inputs need them
3. **Execute** — each component's logic runs in dependency order
4. **Write outputs** — results are pushed to wired tags and made available to other components

Components maintain their internal state between cycles. A moving average remembers its buffer, a latch remembers its position, an integrator accumulates over time. State resets when the instance is reconfigured or the engine restarts (offline values provide reset defaults).

> [!NOTE] Error isolation
> If one component fails during execution, the remaining components in the environment continue to run normally. The failed component's status changes to **Error** and the error message is logged. It will retry on the next cycle.

---

## What's Next

- [Component Libraries](https://ai-ops.com/docs/components/libraries.md) — upload, activate, and manage component packages
- [Component Environments](https://ai-ops.com/docs/components/environments.md) — create execution contexts and configure scan rates
- [Component Canvas](https://ai-ops.com/docs/components/canvas.md) — add instances, wire inputs and outputs, and monitor execution
- [Building Components](https://ai-ops.com/docs/components/building-components.md) — develop your own components with the Koios Component Builder
