Skip to main content

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

  1. Reasoning: The ability to break down complex problems and plan.
  2. Acting (Tools): External programs the model can call (Search, Calculator, APIs).
  3. 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:

  1. Prompt: "Think slow, plan your work."
  2. Reason: The model generates a thought.
  3. Act: It decides to call a tool (e.g., Weather API).
  4. Observe: It looks at the tool's output.
  5. 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:
    1. Check vacation memory (10 days).
    2. Check weather forecast (Sun hours in Florida).
    3. Check health guidelines (Dosage per hour).
    4. Calculate total volume.
    5. Convert to 2oz bottles.

5. Summary

  • Narrow Problems: Use programmatic Compound Systems (Efficiency).
  • Complex, Varied Problems: Use Agents (Flexibility).