---
# System prepended metadata

title: 'CHAI: An Operating System for Agentic AI'

---

# CHAI: An Operating System for Agentic AI  
### Why we need a new runtime for the age of AI  
As generative AI becomes deeply embedded in systems from the cloud to the edge, we must sidestep the pitfalls of fragile, ad-hoc integrations and build a trustworthy, scalable foundation for AI deployments. Today’s AI systems—often modular pipelines of models, scripts, and black-box tools—lack the robustness needed for mission-critical environments.

In networking, for example, AI primarily powers the management plane, supporting tasks like anomaly detection or intent translation through platforms such as Cisco DNA/Meraki AIOps or Juniper Marvis. But with the shift toward self-driving configurations, predictive fault handling, and adaptive QoS, AI functionality is moving closer to the edge and potentially into device firmware.

## CHAI: Compact Hierarchical Agentic Intelligence  

CHAI is a runtime and execution fabric that treats AI agents like processes in an operating system. Its design introduces three primitives:

**Managers Layer**
Instead of a monolithic controller, CHAI provides a layer of orchestration managers. Each manager governs a specific operational domain—task scheduling, resource allocation, policy enforcement, observability.
This mirrors control plane services in Kubernetes, kernel subsystems in Linux, or NOS agents in networking. The separation of concerns makes the system modular, fault-tolerant, and evolvable.

**Micro-agents**
These are ephemeral execution units, comparable to FaaS invocations or short-lived pods. Each is stateless, sandboxed, and executes a single step before termination. By constraining scope, micro-agents become auditable, portable, and resilient to cascading failures.

**MCP (Model Context Protocol)**
MCP acts as the syscall/IPC layer of the runtime. It standardizes how micro-agents interact with tools, APIs, and external resources, abstracting heterogeneity. Conceptually, MCP plays a role similar to WASI for WebAssembly or gRPC for distributed systems.

---  

## Architecture at a Glance  

```text
+----------------------------------------------------+
|                     Manager                        |
|  (plans, budgets, policies, audit logs)            |
+--------------------+-------------------------------+
                     |
                     | spawns
                     v
        +--------------------------+
        |   Micro-Agent            |  -->  MCP call -->  [Tool Server]
        |  (retrieval/reason/act)  |                     (DB, API, Sensor, etc.)
        +--------------------------+
```        
- **Manager** = scheduler + policy + auditor  
- **Micro-agents** = lightweight, stateless workers  
- **MCP** = syscall-like layer for tools and services  
---

## How CHAI Works  

CHAI organizes an agentic system into three core layers:  

### 1. The Manager (stateful brain)  
- Plans tasks and builds execution graphs.  
- Assigns budgets for compute, memory, and time.  
- Enforces **policies and capabilities** (what an agent can or cannot do).  
- Keeps a **deterministic audit log** of every action.  

Think of it as the **scheduler** in an operating system.  

---

### 2. Micro-agents (stateless workers)  
- Each is a lightweight **sandboxed process** that runs a single step: retrieve data, reason, or perform an action.  
- They spin up quickly, run in isolation, and terminate when done.  
- They don’t hold hidden state — everything is explicit and logged.  
These are like **processes or threads** in your OS: controlled, cheap, and replaceable.

#### Runtime Options  
Micro-agents run inside a **sandboxed execution environment** that ensures:  
- fast startup and teardown  
- strong isolation and security  
- fine-grained resource control  
- portability across heterogeneous edge devices  

Possible technologies include:  
- **WebAssembly (WASM):** portable, sandboxed, and fast to start  
- **eBPF or P4 plug-ins:** widely used in networking for programmable pipelines  
- **Containers or microVMs (Docker, Firecracker):** mature ecosystem with tooling support  
- **RTOS tasks:** lightweight and efficient for embedded firmware environments  

The architectural principle remains the same: **micro-agents are deterministic, auditable, and resource-bounded**, regardless of the runtime technology.

---

### 3. The Tool Layer (via MCP)

Agents don’t access APIs directly. Instead, they use **MCP — the Model Context Protocol**.

MCP provides a **client–server pattern** between agents and tools:

- **MCP Client** (inside CHAI Manager or micro-agent)  
  Issues requests and consumes structured responses.  
- **MCP Server** (the tool)  
  Exposes capabilities in a standard contract: tools, resources, prompts, events.  

Key operations (think of them as syscalls for AI):  
- `list_tools()` → discover available functions  
- `call_tool(name, args)` → invoke one securely with structured inputs  
- `read_resource(uri)` → fetch data streams or files  
- `subscribe(event)` → receive live updates  

Transport is typically **JSON-RPC over stdio or WebSockets**, but abstracted away by the runtime.  

**Why it matters:**  
- **Discoverability** → agents can query what exists, not rely on hardcoded APIs.  
- **Uniformity** → every tool, from SQL to a PLC sensor, looks the same at call time.  
- **Governance hooks** → CHAI intercepts these calls to enforce policy, apply capability tokens, and log transcripts.  

In other words: MCP defines the **system call interface** for agentic AI, while CHAI is the **kernel that executes and governs them**.

---

## Why This Matters

CHAI directly addresses the pain points in today’s AI-driven systems — whether they use large models, smaller ML modules, or rule-based analytics:  

- **Trustworthiness** Every action is logged and replayable. You know *what the agent did* and *why*.  
- **Safety & Governance** Tool use is mediated by policies and capability tokens. No agent can “go rogue” or exceed its scope.  
- **Efficiency** Micro-agents start rapidly in constrained environments with minimal overhead. You gain isolation, determinism, and auditability.  
- **Portability** MCP gives interoperability: plug into databases, CRMs, sensors, or cloud APIs without bespoke glue code.  

In a networking context, this applies not just to LLM-based assistants but also to **telemetry summarizers, anomaly detectors, QoS optimizers, and predictive maintenance modules**. CHAI ensures these run under strict resource budgets, with isolation and auditability — something today’s on-device stacks (e.g., **SONiC containers**) don’t enforce. And while monitoring platforms like **Prometheus/Grafana** provide powerful off-device telemetry collection and visualization, they don’t address how intelligence executes safely on the device itself.

---

## A Simple Example

Imagine a standalone AI system on a retail floor.  

**Today:**  
- An LLM calls a Python function that queries inventory.  
- That function connects directly to the database with no sandbox.  
- If the query is written poorly, it may:  
  - expose sensitive customer or pricing data,  
  - lock tables or consume excessive resources, slowing down the system,  
  - or overwrite records if a write is accidentally triggered.  
- The result is not always a literal crash, but it can mean **downtime, data leakage, or corrupted state**.  

**With CHAI:**  
- The Manager spawns a micro-agent for “check stock.”  
- The micro-agent uses `call_tool("inventory.query", {...})` via MCP.  
- Rules ensure it can only run *read-only queries* scoped to stock levels, never customer data or writes.  
- The activity is logged: request → tool call → response.  

Now you have **safety, clarity, and auditability** by design — instead of fragile direct access.  

(A similar example in networking: a CHAI micro-agent could fetch interface counters through an MCP tool, scoped only to read telemetry. Unlike a free-floating script, it would run under strict resource limits and with a full audit log.)

---

## Where CHAI is Needed

### 1. Edge AI in Resource-Constrained Environments  
Factories, clinics, and retail branches need **low-latency, offline-first autonomy**. CHAI ensures agents can run safely on constrained hardware with predictable resource use and auditable behavior.  

### 2. Networking at the Edge  
Branch offices, 5G base stations, and enterprise WANs increasingly need local intelligence. Today, AI-driven orchestration is mostly done off-device by platforms like **Cisco AIOps, Juniper Marvis**, or open-source controllers such as **ONOS/ODL**. CHAI complements these by enabling trusted **on-device execution**:  
- **Telemetry summarization** — micro-agents compress raw flows into actionable metrics.  
- **Policy enforcement** — ACLs, QoS, and traffic shaping applied safely through MCP tools with full audit.  
- **Fault detection & healing** — local reroutes or restarts triggered within strict budgets and policies.  

### 3. Cross-Domain Reliability & Governance  
Beyond networking, CHAI’s runtime properties make it valuable wherever governance and reproducibility matter:  
- **Config drift control** — compare against golden configs and flag or roll back inconsistencies.  
- **Regulated industries** (finance, healthcare, public sector) — enforce audit trails and policy compliance.  
- **Multi-tenant systems** — isolate workloads per tenant or workflow.  
- **Mission-critical systems** — ensure reproducibility and bounded execution even under failure conditions.  

---

## Architect’s Analogy: Think *cgroups* and *QoS*

- **Linux cgroups** let you assign CPU and memory quotas to processes so no single process can hog the machine.  
- **Kubernetes QoS** ensures critical pods keep running under load, while best-effort ones may be throttled or evicted.  

**CHAI works the same way for agents**: it ensures critical micro-agents always get their fair share of resources, while less important ones are contained.

---

## Why Now  
The AI ecosystem is converging on **MCP** as a universal protocol for tool access. But MCP alone doesn’t solve the execution problem — it’s the equivalent of syscalls without an operating system.  

- **Management-plane platforms** such as **Cisco AIOps** and **Juniper Marvis**, or open-source controllers like **ONOS/ODL**, provide orchestration and analytics — but these remain off-device.  
- **On-device systems** like **SONiC** or **eBPF** extend programmability and telemetry — but they don’t provide a safe, policy-driven runtime for AI processes.  

**CHAI complements both**: it is the missing execution layer inside devices, governed by policy and auditability.  

Together, MCP + CHAI do for AI what TCP/IP + operating systems did for networking:  
- MCP provides the **standard protocol**.  
- CHAI provides the **execution environment**.  

This combination turns prototypes into **real, enterprise-ready systems**.  

---

## Closing Thought  
Architects know that **protocols alone don’t make systems**. It took operating systems to make hardware usable. We’re at the same inflection point with AI in networks: protocols like MCP are emerging, but without a runtime, they can’t be deployed safely on devices.  

**CHAI is that runtime.** If we want agentic AI to move from fragile demos to trustworthy, production-grade systems, we need exactly this kind of architecture.  
