# Agent definition

> An agent is two things: a reviewable template (AgentClass) and a disposable running instance (AgentSession) — not a process.

Source: https://openap.org/docs/agent-definition

In most frameworks "an agent" is a process: a prompt, a list of tools, an API key, and a `while`
loop. OAP splits that into two things you can actually govern — a **reviewable template** you
version and approve (the `AgentClass`), and a **disposable running instance** that is
scoped and budgeted (the `AgentSession`).

[Video: One reviewable class, two independent sessions — each with its own scope, budget, and audit trail.](https://openap.org/media/agent-definition-demo.mp4)

## Why the split matters

Conflating the *definition* of an agent with a *running instance* of it is where the operational failures come
from: there's no artifact to review before it acts, no boundary on its blast radius, and no backstop when a
run goes sideways. Pulling the two apart fixes all three.

An **AgentClass** is the durable, reviewable definition: which model, which tools, which identity, what it's
authorized to do, where it can be reached, and its budgets. It's a Kubernetes resource — you diff it, review
it, and pin it. An **AgentSession** is one disposable run of that class: a fresh, scoped instance with its own
budget and its own audit trail, torn down when it's done. The class is the thing you trust; the session is the
thing that acts.

## Go deeper

- **[AgentClass & AgentSession](https://openap.org/docs/agentclass-agentsession)** — the template/instance split, field by field.
- **[The agent loop](https://openap.org/docs/agent-loop)** — how a turn runs, and where the safety hooks sit.
- **[Skills](https://openap.org/docs/skills)** — reusable capabilities an agent can be granted.
- **[Packaging](https://openap.org/docs/packaging-oap)** — the `.oap` bundle: shipping an agent and its dependency graph as one signed artifact.

> **Security: How this addresses the OWASP Agentic Top 10**
>
> The class as a reviewable, budgeted, isolated unit is OAP's answer to several agentic threats:
> - [ASI01 — Agent Goal Hijack](https://openap.org/docs/owasp-top10#asi01): tool output cannot widen what the agent may do — every resulting action is checked outside the model, and high-impact actions can be gated. Delimiting tool output as data is a secondary aid.
> - [ASI08 — Cascading Failures](https://openap.org/docs/owasp-top10#asi08): per-session isolation, budgets, and default-on circuit breakers contain blast radius.
> - [ASI09 — Human-Agent Trust Exploitation](https://openap.org/docs/owasp-top10#asi09): the approval design that surrounds every risky action.
