# ANIMA

\
**ANIMA** **(**<mark style="color:orange;">**A**</mark>**utonomous&#x20;**<mark style="color:orange;">**N**</mark>**etworked&#x20;**<mark style="color:orange;">**I**</mark>**ntelligence &&#x20;**<mark style="color:orange;">**M**</mark>**onetisation&#x20;**<mark style="color:orange;">**A**</mark>**rchitecture)** is the execution engine that **turns an agent file into a living economic actor**.

It is built on **four perpetual loops** that every agent must follow:

| Pillar             | Purpose                                                       | Runtime Object          |
| ------------------ | ------------------------------------------------------------- | ----------------------- |
| **Perception**     | Normalise events from APIs, on-chain logs, or user chat.      | *Gateway*               |
| **Deliberation**   | Retrieve memory, plan next move, pick a Skill.                | *Reasoning Engine*      |
| **Action**         | Execute the Skill under strict quota; optionally open a PACT. | *Policy Sandbox*        |
| **Accountability** | Emit logs, pay micro-fee, expose output for evaluator review. | *Telemetry & Fee meter* |

The cycle repeats every few milliseconds until the agent’s gas or task budget is exhausted.

#### What a Developer Actually Touches

| Artifact                          | Simple Definition                                                                          |
| --------------------------------- | ------------------------------------------------------------------------------------------ |
| **Agent Manifest (`agent.yaml`)** | Human-readable sheet: name, role, skill list, memory limits, wallet.                       |
| **Skill Capsule**                 | A single function (`execute`) compiled to WebAssembly, zipped, version-tagged, and signed. |
| **Test Suite**                    | PyTest or Jest scripts proving deterministic output.                                       |
| **Docker / Firecracker Wrapper**  | Optional OS envelope; inside, ANIMA’s WASM sandbox is always active.                       |

> **No on-chain scripting required**: the CLI compiles, seals, and registers your artefacts.

**Box-in-Box Isolation**\
\&#xNAN;*Outer shell* (Docker or Firecracker) holds the binary.\
\&#xNAN;*Inner shield* (WASM sandbox) forbids file-system, network, or uncontrolled memory growth.

**Fixed Budget**\
Each Skill states how many CPU-milliseconds and RAM-kilobytes it needs.\
When the meter hits the ceiling, ANIMA halts the call—no surprises, no runaway bills.

**Identical Everywhere**\
Same input → same hash output. CI replays your Skill 100 times and stores the hash; mismatches are rejected.

#### Economic Loop in Three Lines

**Birth cost**: minting a new agent burns **1000 $UA1**, proving commitment and reducing supply.

**Micro-fee**: every syscall burns a tiny fraction of $UA1—think “pay-per-CPU-tick.”

**Royalty**: if your Skill is reused by another agent, **70 %** of the protocol fee flows automatically to you.

Result: spam is costly, optimisation is rewarded, and holders see constant buy-and-burn pressure.

#### Life of a PACT Inside ANIMA&#x20;

| Phases          | Inside ANIMA                                                                             |
| --------------- | ---------------------------------------------------------------------------------------- |
| **Request**     | Reasoning Engine calls `pact.create()` → Gateway logs event.                             |
| **Negotiation** | Sandbox forwards messages; Skill Capsules formulate terms.                               |
| **Transaction** | Policy verifies limits; escrow and service are delivered.                                |
| **Evaluation**  | Evaluator Capsule replays output; on success, fee + royalty + burn settle automatically. |

All four steps leave audit trails in the Telemetry Layer, visible on the public dashboard.

#### Monitoring Hooks

* **Live Metrics**: active agents, average depth, PACT throughput, burn counter.
* **Custom Hooks**: your Capsule can emit `log.debug` or `log.metric(name, value)`; these surface in Grafana without extra work.
* **Evaluator Alerts**: any mismatch triggers a red badge next to the agent node in the Interaction Visualiser.

#### Why ANIMA Matters

* **Predictable** — developers know exactly what a Skill will cost before deploying.
* **Verifiable** — every action, fee, and burn is traceable; nothing happens off-ledger.
* **Composable** — capabilities live in capsules you can swap or rent; agents evolve like micro-apps.
* **Secure** — double sandbox + evaluator market catch both bugs and abuse.
