# AI Agent Architecture: Where Does Your Agent Actually Run?

## Executive summary

An AI agent is not a single workload but a composite system comprising four distinct planes: Reasoning (Inference), Agent Loop, Action Plane (Tool Execution), and State. Each plane has unique resource, security, and failure profiles, requiring independent scaling and deployment strategies to ensure production reliability.

## Key takeaways

- The Four Workloads of an AI Agent: The agent is broken down into four components: the reasoning workload (inference), the agent loop (lightweight code), the action plane (tool calls), and persistent state.
- Decoupling Resource Allocation: Each of the four planes must be scaled using its own specific signal (e.g., KV cache pressure, job queue depth, storage), as a single autoscaler is insufficient.
- Security and Sandboxing of Tools: The Action Plane, which executes external calls (HTTP, DB queries), is the security-critical component. It must be sandboxed using ephemeral pods and a default deny network policy, ensuring the tool has its own scoped identity.
- The State Fork: In-Process vs. Externalized: The single biggest architectural decision is whether state lives in the agent process (e.g., a Python list) or is externalized to a persistent store (e.g., Postgres or Redis). Externalization is critical for resilience.

## Technical details

- Reasoning Plane (Inference): This plane involves forward passes through the transformer and is compute-heavy, being GPU, memory, and compute bound. On a cluster, it is typically deployed using vLLM or llm-d and pinned to GPU nodes.
- Agent Loop Deployment: The agent loop is lightweight code whose latency is primarily network waiting. It should be deployed as a stateless service on cheap CPU nodes and scaled horizontally using HPA, never co-scheduled on GPU nodes.
- Action Plane Security: The Action Plane is where side effects occur. To maintain security, the tool must be given its own credentials with the shortest possible lifetime, and the model's output must never inherit the agent's keys.
- Resilience and Checkpointing: For production reliability, state must be externalized. A checkpoint must be performed before every tool call, and tool calls should be made idempotent to handle retries after a crash.

## Practical implications

- Requires a shift from monolithic agent deployment to managing four distinct, independently scalable workloads.
- Mandates strict security boundaries (sandboxing, dedicated service accounts) for the Action Plane to mitigate risks from model outputs.
- Requires robust state management (external persistence) to ensure agents can survive pod crashes, rescheduling, and scale-to-zero events.

## Topics

AI Architecture, Agentic AI, Microservices, Kubernetes, LLM Deployment, Security, vLLM, llm-d, Postgres, Redis, PVC

Source: https://www.youtube.com/watch?v=_iTbNy5aOR0
