Title: Quiz 7 — Code-First Agent Frameworks I: LangGraph and Pydantic AI
Course: AIINFRA 300: Agentic AI & the Model Context Protocol (MCP) > Section: Week 07 — Code-First Agent Frameworks I: LangGraph and Pydantic AI

Q: In LangGraph, what does a node function take as input and return?
- A prompt string; returns a completion string
- The current State; returns a partial update to the State
- A `Command` object; returns an `interrupt()` payload
- Nothing; nodes are stateless triggers
A: The current State; returns a partial update to the State

Q: For anything beyond a demo, LangGraph runs should use a durable checkpointer such as Postgres or SQLite rather than relying only on in-memory state.
- True
- False
A: True

Q: What is the minimum Python version required to install and use LangGraph (as of this week's material)?
- Python 3.8+
- Python 3.9+
- Python 3.10+
- Python 3.12+
A: Python 3.10+

Q: What is the recommended state type for LangGraph state definitions, and why is it preferred over Pydantic/dataclass coercion?
Feedback: Sample/expected answer: `TypedDict`**** — it has the lowest overhead and full support for checkpointing and streaming.

Q: Which statement correctly describes Pydantic AI's core design?
- It models agents as a graph of nodes and edges with a checkpointer
- It treats an agent as schemas plus Python functions, validating output types at the boundary
- It requires a paid API key and cannot run against local models
- It replaces the need for any tool-calling logic
A: It treats an agent as schemas plus Python functions, validating output types at the boundary

Q: It's safe and recommended to wrap interrupt() calls in a try/except block to gracefully handle the pause.
- True
- False
A: False

Q: A classmate says, "LangGraph is strictly more powerful, so I should always use it instead of Pydantic AI." What is the flaw in this reasoning?
Feedback: Sample/expected answer: The frameworks model agents differently, not on a single power scale — the right choice depends on whether the workflow is mostly linear (favoring Pydantic AI) or a genuine state machine needing branching, durability, and audit trails (favoring LangGraph).

Q: What is a common beginner mistake when defining LangGraph state?
- Using a `TypedDict` instead of a class
- Making state too minimal to be useful
- Over-modeling state with many unnecessary fields, adding complexity and bugs
- Forgetting to import `StateGraph`
A: Over-modeling state with many unnecessary fields, adding complexity and bugs