Lesson 8: What are AI Agents?
Topics Covered
- Compound AI Systems: Moving beyond monolithic models.
- Control Logic: Hard-coded program paths vs. LLM-driven reasoning.
- Agent Capabilities: Reason, Act, Memory.
- ReACT: Combining Reasoning and Acting.
1. Compound AI Systems
Models are limited by their training data. If you ask a standard model, "How many vacation days do I have?", it will fail because it doesn't know you.
Compound AI Systems consist of multiple modular components:
- The Model: Generates text/code.
- Tools: Search databases, call APIs.
- Verifiers: Check output quality.
Example: A system that takes your query -> prompts a model to write a SQL query -> searches your HR database -> returns the result to the model -> generates the final answer.
2. Control Logic
In a standard Compound System (like simple RAG), the path is hard-coded by a human developer. Query -> Search Database -> Answer. If you ask about the weather, it fails because it is forced to search the HR database.
Agents replace this hard-coded logic with an LLM:
- Think Fast (Programmatic): Act as programmed, don't deviate. Efficient for narrow tasks.
- Think Slow (Agentic): Create a plan, attack each part, see where you get stuck, and readjust.
3. Agent Components
- Reasoning: The ability to break down complex problems and plan.
- Acting (Tools): External programs the model can call (Search, Calculator, APIs).
- Memory:
- Inner Logs: Storing the model's "thought process."
- History: Remembering past user interactions for personalization.
4. ReACT (Reason + Act)
One popular way to configure agents is the ReACT pattern:
- Prompt: "Think slow, plan your work."
- Reason: The model generates a thought.
- Act: It decides to call a tool (e.g., Weather API).
- Observe: It looks at the tool's output.
- Iterate: If the answer is found, done. If not, revise the plan and loop again.
Example:
- User: "How much sunscreen do I need for my Florida trip?"
- Agent:
- Check vacation memory (10 days).
- Check weather forecast (Sun hours in Florida).
- Check health guidelines (Dosage per hour).
- Calculate total volume.
- Convert to 2oz bottles.
5. Summary
- Narrow Problems: Use programmatic Compound Systems (Efficiency).
- Complex, Varied Problems: Use Agents (Flexibility).