Build agents
Ten Build questions for LCAE Mock Exam C. Study them one at a time here, or take the whole timed paper in exam mode.
Try it yourself
Reversed after-hook order
Your create_agent middleware array is [AuthMiddleware, LoggingMiddleware, MetricsMiddleware] and each defines an after_model hook. When the model returns, which after_model hook runs first?
Show answer
Correct answer: C — MetricsMiddleware, because after-hooks run in reverse array order
Before-hooks run first-to-last through the array; after-hooks run last-to-first, nesting like context managers, so whatever was set up first is torn down last. MetricsMiddleware is last in the array, so its after_model runs first. Docs: docs.langchain.com/oss/python/langchain/middleware (Build).
Legal jump targets
A before_model hook wants to short-circuit the agent loop by jumping. Which set lists ALL and ONLY the legal jump targets?
Show answer
Correct answer: A — end, tools, model
A hook may jump only to end, tools, or model, and a hook that might jump declares can_jump_to up front so the conditional edge is drawn before compile. agent is the seductive wrong option because before_agent / after_agent hooks exist, but there is no jump target named agent. Docs: docs.langchain.com/oss/python/langchain/middleware (Build).
Retrying against another provider
A failed model call must be retried against a different provider without the agent loop ever seeing the failure. Which hook shape can do this, and why can an after_model hook not?
Show answer
Correct answer: B — wrap_model_call, because only a wrapping hook still holds the handler and can invoke it again
Only a wrap hook receives the handler and may call it zero, one, or many times, so wrap_model_call can catch the failure and re-invoke. An after_model hook can see that a call failed but has nothing left to invoke. Docs: docs.langchain.com/oss/python/langchain/middleware (Build).
Two limits, two exit defaults
You add both ModelCallLimitMiddleware and ToolCallLimitMiddleware with default settings. When each limit is reached, what does the agent do by default?
Show answer
Correct answer: C — Model Call Limit ends the run; Tool Call Limit lets the agent continue
They look like siblings and differ. Model Call Limit's default exit behaviour is end (out of model calls, the agent cannot think further); Tool Call Limit's default is continue (the agent can still answer without that one tool). Docs: docs.langchain.com/oss/python/langchain/middleware/built-in (Build).
A summarizer that never fires
A SummarizationMiddleware is constructed with only a model argument and attached to a plain create_agent. After a very long conversation, when does it compress the history?
Show answer
Correct answer: C — Never
trigger has no default; keep defaults to 20 messages but nothing fires it, so an unconfigured summarizer silently never compresses. The 85% / 10% figures are the deep-agent preconfiguration, not middleware defaults. Docs: docs.langchain.com/oss/python/langchain/middleware/built-in (Build).
Default deep-agent tools
A deep agent (v0.7) is created with no custom tools. Which of the following are registered by DEFAULT? Select all that apply.
Show answer
Correct answer: A — ls, read_file, write_file, edit_file, glob, grep, plus execute, task, and delete
The defaults are the six filesystem tools plus execute, task, and delete (added in v0.7). There is no default web_search or email tool; anything reaching the outside world you register yourself, and execute is registered regardless but only works with a sandbox backend. Docs: docs.langchain.com/oss/python/langchain/deep-agents (Build).
interrupt_on set to False
In a HumanInTheLoopMiddleware, one tool is mapped to False in interrupt_on. What happens when the agent calls that tool?
Show answer
Correct answer: C — The call runs without pausing (auto-approved)
The boolean answers "should this pause", not "is this allowed". True pauses with all decisions; a config object pauses with only the listed decisions; False means auto-approve, so the tool runs freely. Reading False as "denied" gives exactly the wrong policy. Docs: docs.langchain.com/oss/python/langchain/middleware/built-in (Build).
Configuring the model's temperature
This agent must run at temperature 0 with a 30-second timeout, but as written it cannot express either setting:
from langchain.agents import create_agent
agent = create_agent("openai:gpt-5.5", tools=tools)Which change is correct?
Show answer
Correct answer: B — Build the model with init_chat_model("openai:gpt-5.5", temperature=0, timeout=30) and pass that instance as the first argument
A bare "provider:model" string carries the model's identity and nothing else, and create_agent has no temperature parameter and does not forward model kwargs. Build the instance with init_chat_model and pass the instance. Docs: docs.langchain.com/oss/python/langchain/models (Build).
Skill frontmatter limits
A SKILL.md file's frontmatter sets a name and a description. What are the limits, and what must the name match?
Show answer
Correct answer: B — name 1 to 64 characters and it must match the directory name exactly; description up to 1024 characters
name is 1 to 64 characters and must equal the directory name exactly or the skill silently fails to load; description is capped at 1024 because it loads for every skill on every run. Examiners swap 64 and 1024. Docs: docs.langchain.com/oss/python/langchain/deep-agents (Build).
A reserved tool argument name
You write a tool function and name one of its arguments runtime. The code looks fine but the tool behaves strangely. Why?
Show answer
Correct answer: A — runtime is a reserved parameter name (the injected tool runtime), so it collides silently with framework injection
config (the runnable config) and runtime (the injected tool runtime) are reserved parameter names. An ordinary argument named runtime collides with what the framework injects, a classic spot-the-bug shape. Docs: docs.langchain.com/oss/python/langchain/tools (Build).