Foundational Pillars
Lecture Notes
# Core Architecture of an Agent Modern AI agents are built on four foundational pillars. ## 1. Profile and Persona An agent begins with a system prompt that dictates its **Persona**. This defines its role, constraints, and the tone of its responses. ```python # Example of defining an Agent Persona system_prompt = """ You are a Senior DevOps Engineer Agent. Your goal is to diagnose and resolve server outages. You have access to AWS CLI, Kubernetes tools, and Datadog logs. Always verify a service is healthy after restarting it before marking the task complete. """ ``` ## 2. Memory Systems (Short-term & Long-term) An agent must remember what it has done to avoid repeating mistakes or getting stuck in infinite loops. - **Short-Term Memory**: The in-context learning window (e.g., the 128k token window of GPT-4o). It contains the current conversational thread and the immediate history of executed tool actions. - **Long-Term Memory**: Persistent storage (usually a Vector Database like Pinecone or Milvus) where the agent can store key learnings across sessions. ## 3. Planning and Reasoning When given a complex task like "Deploy this Next.js app to AWS," the agent cannot do it in one step. It must use **Task Decomposition**. Advanced agents utilize self-reflection algorithms (like Reflexion). After taking an action, the agent reviews the output and asks itself: *"Did this achieve the intended sub-goal? If not, what went wrong?"* ## 4. Action and Tool Execution This is where the magic happens. Agents interact with the digital world through **Function Calling**. They can browse the web, execute Python code, query databases, or send emails.