The Hook:
The difference between a 'Bot' and an 'Agent' is the Loop. A loop allows the system to observe its own mistakes and course-correct. However, an unmanaged loop is a recipe for high latency and runaway API costs.
The P.A.O.R. Cycle
- Plan: Deconstruct the user intent into a Directed Acyclic Graph (DAG) of tasks.
- Act: Dispatch skills to the relevant MCP servers.
- Observe: Ingest the raw output and environmental feedback.
- Reflect: Compare the result against the original goal. Did we succeed?
The Rehydration Problem
Long-running loops shouldn't stay in memory. Our runtime serializes the "Cognitive State" to a persistent store (Firebase) after every cycle. This allows an agent to "wake up" days later and resume a complex task with full context.
Architectural Guardrail
We implement a Max-Cycle TTL. If an agent cannot reach a 'Success' state within 5 loops, it is forced to escalate to a Human-in-the-Loop (HITL) to prevent infinite loops.