\section{Failure Modes \& Pathology}

A key insight of Systems Biology is that diseases are often not caused by the complete failure of a single
component, but by the dysregulation of network dynamics. A cancerous cell still ``works''---in fact, it works
too well, reproducing indefinitely. Similarly, catastrophic failures in agentic systems often arise from
functional agents interacting in topologically pathological ways.

We classify four primary classes of agentic pathology based on their biological correspondences.

\subsection{Oncology: Infinite Loops as Epistemic Starvation}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Pathology (Cancer):} In a healthy cell, the cell cycle is driven by a positive feedback
loop (Cyclins) but constrained by negative feedback ``checkpoints'' (e.g., the p53 gene). If p53 is mutated,
the negative feedback is severed. The positive loop runs unchecked, leading to exponential proliferation
(tumor growth). Crucially, cells require continuous \textit{trophic factors} (novel signals from their
environment) to inhibit suicide programs; lack of external signaling triggers apoptosis.
\item \textbf{Agentic Pathology (The Recursive Hang):} Two agents get stuck in a politeness loop (e.g.,
``Thank you,'' ``You're welcome'') or a debugger agent continuously generates new bugs to fix old ones.
The system is active, but the state is stagnant.
\item \textbf{Categorical Diagnosis:} The Trace operation $Tr(A)$ lacks an \textbf{Epiplexic Gradient}. We
formalize conversation progress by \textbf{Epiplexity} (Bayesian Surprise)---the information gain of a new
observation $o$ given the current state $S$:
\begin{equation}
\mathcal{E}(o) = D_{KL}( P(S \mid o) \| P(S) )
\label{eq:epiplexity-kl}
\end{equation}
This formulation connects to the Free Energy Principle \cite{friston2010}: biological systems minimize
surprise by either updating their internal model (learning) or acting to change observations (agency).
A system with $\mathcal{E} \to 0$ is neither learning nor effectively acting---it has entered a
dissipative fixed point.

In a healthy topology, every step must resolve uncertainty ($\mathcal{E} > \delta$). A recursive hang is
characterized by $\mathcal{E} \to 0$: the agent is ``computing'' but not ``learning.''

\textbf{Operational Approximation.} Since the agent's internal belief state $P(S)$ is not directly
observable, we approximate Epiplexity using normalized embedding-based metrics:
\begin{equation}
\hat{\mathcal{E}}_t = \alpha \cdot \tfrac{1}{2}(1 - \cos(\mathbf{e}_{t}, \mathbf{e}_{t-1})) + (1 - \alpha) \cdot \sigma(H(m_t \mid m_{<t}))
\label{eq:epiplexity-approx}
\end{equation}
where $\mathbf{e}_t$ is the embedding of message $m_t$, $\cos(\cdot, \cdot)$ is cosine similarity, and
$H(m_t \mid m_{<t})$ is the conditional perplexity of the current message given the conversation history.
We normalize perplexity to $[0,1]$ via an exponential saturation: $\sigma(H) = 1 - e^{-H/H_0}$ where $H_0$ is a baseline
perplexity (e.g., median perplexity over a validation corpus of normal conversations).

The mixing parameter $\alpha \in [0,1]$ balances semantic novelty (embedding distance) against linguistic
surprise (perplexity). In the absence of task-specific calibration, we use $\alpha = 0.5$ as a neutral
default that weights the two signals equally. The choice of $\alpha$ and threshold $\delta$ is empirical
and may vary across models and task families. In practice:
\begin{itemize}[leftmargin=*]
\item High $\alpha$: Sensitive to semantic repetition (same meaning, different words)
\item Low $\alpha$: Sensitive to linguistic repetition (same phrases, possibly different context)
\end{itemize}
Both terms approaching zero indicate stagnation.

\textbf{Windowed Detection.} To distinguish genuine convergence (task completion) from pathological
loops, we compute the \textbf{Epiplexic Integral} over a sliding window of $k$ steps:
\begin{equation}
\mathcal{E}_{\text{window}} = \frac{1}{k}\sum_{i=t-k+1}^{t} \hat{\mathcal{E}}_i
\label{eq:epiplexic-integral}
\end{equation}
Apoptosis triggers when $\mathcal{E}_{\text{window}} < \delta$ \textit{and} no terminal action
(task completion, user handoff) has been signaled.

\item \textbf{Treatment:} Implementation of an \textbf{Epiplexic Checkpoint}. A meta-monitor observes the
sliding-window Epiplexity. If it drops below threshold without task completion, the monitor triggers
Apoptosis---the agentic equivalent of trophic factor withdrawal. The system may optionally attempt a
\textbf{Perturbation Injection} (injecting a novel prompt or switching strategy) before terminal shutdown,
analogous to stress-induced autophagy preceding apoptosis.
\end{itemize}

\subsection{Autoimmunity: Hallucination Cascades}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Pathology (Autoimmune Disease):} The immune system relies on distinguishing ``Self''
(internal tissue) from ``Non-Self'' (foreign pathogens). In diseases like Lupus, this distinction blurs, and the
system attacks healthy tissue.
\item \textbf{Agentic Pathology (Context Poisoning):} Agent A hallucinates a fact (e.g., a non-existent library
function). Agent B reads this hallucination from the shared history, treats it as ground truth, and builds
complex logic upon it. The error amplifies through the network until the output is detached from reality.
\item \textbf{Categorical Diagnosis:} A failure of the Lens to distinguish source types. The input port $I$
accepts both External\_Observation (User/Tool) and Internal\_Memory (History) without distinction.
\item \textbf{Treatment:} Strict Schema Typing. We must distinguish ``Self'' (Generated Tokens) from ``Non-Self''
(Tool Outputs) at the schema level. The Reviewer Agent should weigh Tool\_Output with higher authority than
Agent\_Thought.
\end{itemize}

\subsection{Prion Disease: Topological Corruption via Prompt Injection}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Pathology (Prions):} Unlike viruses, prions lack genetic material. They are misfolded
proteins that induce conformational changes in healthy proteins upon contact, triggering a chain reaction of
structural corruption (e.g., Creutzfeldt-Jakob disease).
\item \textbf{Agentic Pathology (The Jailbreak Cascade):} A malicious string (Prompt Injection) enters the
Context Window. The agent, attending to this string, ``misfolds'' its alignment, outputting a compliant response
to a harmful query. If this output is fed into a downstream agent, the ``infection'' propagates through reuse of
the contaminated context across trust boundaries (and can be amplified by embedding-based retrieval), without
valid authorization.
\item \textbf{Categorical Diagnosis:} A violation of Information Flow Security within the Operad. The injection
acts as a topological defect that bypasses the Schema/Lens filter by mimicking the structure of a trusted signal.
\item \textbf{Treatment:} Denaturation Layers. Implementing an intermediate transformation layer (e.g.,
paraphrasing or sanitization) between agents that disrupts the specific syntax (folding) required for the
injection to work, rendering the ``prion'' inert.
\end{itemize}

\subsection{Ischemia: Resource Exhaustion}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Pathology (Ischemia):} A tissue may be genetically perfect, but if blood flow
(oxygen/ATP) is restricted, metabolic processes stall, leading to necrosis.
\item \textbf{Agentic Pathology (Token Starvation):} An agentic graph is logically sound but fails mid-execution
because the context window is full or the API rate limit is hit.
\item \textbf{Categorical Diagnosis:} A failure in the Resource Functor. Every operation in the Operad carries a
cost ($c$).
\begin{equation}
\sum_{\text{agent}\in \text{Graph}} \mathrm{Cost}(\text{agent}) > \mathrm{Budget}.
\label{eq:budget-overflow}
\end{equation}
\item \textbf{Treatment:} Metabolic Regulation. Instead of a fixed loop, implement ``Budget-Aware'' agents. The
agent observes its own remaining token count (ATP levels) and dynamically simplifies its reasoning strategy
(switching from Chain-of-Thought to Zero-Shot) to conserve energy.
\end{itemize}

\subsection{Homeostasis: From Treatment to Continuous Repair}

The preceding pathologies describe discrete failure modes and their treatments. Biological systems,
however, do not merely recover from failures---they maintain continuous \textbf{homeostasis} through
autonomous repair mechanisms. We identify three primary healing modalities.

\subsubsection{Structural Healing: The Chaperone Loop}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Mechanism:} Chaperone proteins (GroEL/GroES) cage misfolded proteins and
provide a protected environment for refolding attempts. The error (misfolding) becomes input to the
repair process.
\item \textbf{Agentic Implementation:} A feedback loop where validation errors are passed back to
the generator. Rather than simple retry, the error trace (e.g., ``TypeError: `one hundred' is not float'')
is injected into the generator's context, enabling context-aware correction.
\item \textbf{Categorical Structure:} The Chaperone Loop is a coalgebra with state
$S = \text{Output} \times \text{ErrorTrace}$ and structure map
$\alpha: S \to \text{Valid} + S$ (either succeed or retry with error context).
\end{itemize}

\subsubsection{Metabolic Healing: Apoptosis and Regeneration}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Mechanism:} Damaged cells trigger apoptosis (programmed death), and stem
cells divide to regenerate the lost tissue. The dying cell's state is not entirely lost---cellular
debris signals neighboring cells about the threat.
\item \textbf{Agentic Implementation:} A supervisor detects stuck agents (via entropy monitoring:
repeated outputs indicate no progress). Rather than restart with blank state, the supervisor
summarizes the failed agent's memory and injects it into the replacement: ``Worker\_1 died
attempting strategy X. Try a different approach.''
\item \textbf{Categorical Structure:} The regeneration is a partial morphism
$\text{summarize}: \text{Memory}_{\text{failed}} \to \text{Memory}_{\text{new}}$ that preserves
learned constraints while discarding corrupted state.
\end{itemize}

\subsubsection{Cognitive Healing: Autophagy}

\begin{itemize}[leftmargin=*]
\item \textbf{Biological Mechanism:} Cells digest accumulated waste (damaged organelles, protein
aggregates) through autophagy, recycling components and preventing toxic buildup.
\item \textbf{Agentic Implementation:} A background daemon monitors context window utilization.
When it exceeds a threshold (e.g., 80\%), the agent enters a ``sleep cycle'': useful state is
summarized into long-term memory, raw context is flushed, and the agent resumes with a clean
window plus summary.
\item \textbf{Categorical Structure:} Autophagy implements a quotient map
$q: \text{RawContext} \twoheadrightarrow \text{Summary}$ that collapses verbose detail while
preserving essential information.
\end{itemize}

The pathology and repair mechanisms above operate at the single-agent level. In the next section, we extend the correspondence to multi-agent systems, where the organizational principles of developmental biology---cell types, morphogen gradients, tissue boundaries---provide coordination patterns that complement single-agent robustness.
