Agentic AI Foundations Series · Part 2 of 6
Part 2: How Agents Think – Reasoning Patterns, Memory, and Guardrails
Agents follow a few well-known thinking styles. Learn the name, the one-line idea, and the keyword that gives it away in a question.
Five thinking styles, one DBA story
The problem: "Users say the month-end report is slow."
- Chain-of-Thought (CoT) – You think aloud before answering: "Slow report → maybe bad plan → maybe stale stats." No tools, just reasoning step by step.
- ReAct (Reason + Act) – You think, run something, look, think again. Thought: check the plan. Action: run DBMS_XPLAN. Observation: full table scan. Thought: check stats… This is the most tested pattern.
- Plan-and-Execute – You write the full plan first (1. AWR, 2. SQL plan, 3. stats, 4. fix), then work through it. Good for long tasks.
- Reflection – After writing your RCA, you review it yourself: "Did I prove the root cause or just guess?" The agent critiques and improves its own output.
- Routing – A triage step sends the issue to the right specialist: performance, storage, or EBS.
When one agent isn't enough
Think of a war room during a P1 outage.
- Supervisor pattern – the incident manager assigns work to the DBA, network, and app teams, then combines their findings.
- Handoff – L1 support passes the ticket (with full history) to L2. L1 is now out of it.
- Agent as a tool – the incident manager asks the network team one question, gets the answer, and stays in charge.
Multi-agent gives specialization and parallel work, but costs more tokens, time, and debugging effort.
Memory: what the agent remembers
- Short-term – tonight's conversation, held in the context window. Gone when the session ends.
- Long-term – saved in a database or vector store and recalled by meaning.
- Sub-types you may see: episodic (past events), semantic (facts), procedural (how to do things).
Guardrails: change control for agents
You would never let a junior DBA run anything in production without controls. Same for agents:
- Input guardrails – block prompt injection, jailbreaks, off-topic requests.
- Output guardrails – catch PII leaks, toxic text, wrong formats, hallucinations.
- Least privilege – a read-only DB user for a reporting agent.
- Human approval for anything irreversible: delete, pay, send.
- Limits – max loop iterations, timeouts, token budgets.
- Tracing – log every step, like an audit trail.
Remember for the exam
- ReAct = Thought → Action → Observation.
- Handoff gives control away; agent-as-tool keeps control.
- Short-term = context window; long-term = vector store/DB.
- Guardrails sit on both input and output.
Self-check
- An agent that drafts an answer, then critiques and rewrites it, uses…? (Reflection)
- A manager agent delegating to specialist agents is the…? (Supervisor pattern)
- Where does short-term memory live? (The context window)
No comments:
Post a Comment