Data Engineering Path · Data & AI
Module 5 Theoretical & Architecture Interview Quiz
10 high-impact technical interview questions for AI Systems Architects and Senior Data Engineers.
Q1: What is the ReAct paradigm, and why is it superior to Chain-of-Thought alone?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
Chain-of-Thought (CoT) relies strictly on internal reasoning from pre-trained weights without the ability to observe external real-world ground truth. For questions involving live databases or APIs, CoT is prone to factual hallucinations.
**ReAct (Reasoning + Acting)** interleaves Thought and Action steps:
1. **Thought**: Formulates a plan or evaluates prior results.
2. **Action**: Calls an external tool (SQL database, REST API, shell).
3. **Observation**: Ingests real-world data returned from the tool.
The next thought conditions on the real observation, eliminating hallucinations and enabling dynamic error correction.
Q2: Why are Directed Acyclic Graphs (DAGs) inadequate for modeling autonomous agents, and how does LangGraph address this?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
DAG frameworks (Airflow, LCEL) enforce one-way acyclic data flow: node $A o B o C$. They cannot represent iterative loops where an agent executes a command, encounters an error, and **loops back to step A** to retry.
**LangGraph** models systems as **Cyclic State Machines**:
- State is managed via a shared TypedDict.
- **Conditional Edges** inspect output state and route dynamically (e.g., if query fails, loop back to the generator node; if valid, proceed to output).
Q3: What is the difference between Function Calling and direct code generation?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
- **Direct Code Generation**: The model emits raw Python or bash code within a markdown fence. The application must extract and execute the string via `eval()` or `exec()`, posing severe security risks.
- **Function Calling**: The application pre-registers explicit, typed function signatures. The model outputs a validated JSON dictionary specifying the function name and structured parameters. The model *never executes anything directly*; execution remains completely under application control.
Q4: How do you prevent an autonomous agent from entering an infinite execution loop?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
1. **Hard Recursion Limit**: Enforce a strict maximum iteration ceiling (e.g., `max_turns = 10`).
2. **Execution Timeout**: Enforce wall-clock timeouts on total execution.
3. **Loop Detection**: Track historical action signatures; if the agent invokes the exact same tool with identical parameters 3 times consecutively, abort and request human assistance.
4. **Token Budgeting**: Cap cumulative token spend per session.
Q5: What is the "Human-in-the-Loop" pattern in LangGraph?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
The pattern pauses agent execution before sensitive or irreversible operations (e.g., executing DDL updates, transferring funds, sending emails).
LangGraph serializes the entire state machine to a persistent checkpoint database (PostgreSQL/SQLite) and stops execution. Once a human reviews the proposed action and approves via an API or Slack webhook, the graph loads the checkpoint and resumes execution seamlessly.
Q6: What are the three primary multi-agent collaboration architectures?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
1. **Hierarchical (Supervisor)**: A manager agent delegates tasks to specialized sub-agents and synthesizes results.
2. **Sequential (Assembly Line)**: Agents execute sequentially (e.g., Analyst $ o$ Coder $ o$ Tester).
3. **Collaborative Debate / Consensus**: Multiple agents critique and audit each other's outputs to eliminate single-agent bias.
Q7: What is the difference between Short-Term Buffer Memory and Long-Term Vector Memory for an agent?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
- **Short-Term Buffer Memory**: Temporary session state (chat turns, tool observations) stored in RAM or context window. Wiped when session ends.
- **Long-Term Vector Memory**: Key insights, user preferences, and historical problem solutions embedded and persisted in a vector database (Pinecone/pgvector). Recalled semantically across separate sessions weeks later.
Q8: How should database security be architected when giving an AI agent SQL execution capabilities?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
1. **Read-Only Database User**: The database connection string must connect as a user with strictly `SELECT` permissions.
2. **Query Dry-Run**: Run `EXPLAIN` on the generated query first to verify execution cost before running.
3. **Row Limits**: Append an enforced `LIMIT 100` clause to prevent runaway full table scans.
4. **Query Timeout**: Enforce strict statement timeouts (e.g., 10 seconds).
Q9: What is Self-Reflection in autonomous agents?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
Self-reflection is the process where an agent evaluates its own prior actions against target success criteria before concluding. For example, after generating a PySpark pipeline, a reflection prompt asks: *"Does this code handle NULL values? Are joins broadcasted properly?"* If flaws are identified, the agent refactors the code before presenting it.
Q10: What is LangSmith / LangFuse and why are they critical for debugging multi-agent workflows?
👉 Reveal Answer & Architectural Deep Dive
**Answer**:
Multi-agent systems execute dozens of non-deterministic LLM calls and tool dispatches. Without distributed tracing, diagnosing why an agent failed is impossible.
Platforms like LangSmith and LangFuse provide **full execution tree visualization**: inspecting exact input prompts, tool call arguments, execution latencies, and token costs for every step in the agent's decision tree.