← Zillow Interview Insights

Zillow·Software Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Applied Scientist interview at Zillow that went pretty deep into agentic system design. One meaty pseudocode question that took up most of the session.

Questions Asked (1)

Q1

Write a ReAct-style agent loop in pseudocode. The loop should alternate between Thought, Action, and Observation steps until a stopping condition is reached. Show how the LLM prompt gets constructed each turn, how tool outputs get appended to the running trajectory, and how the loop terminates (either on a final answer or a step budget).

System DesignTechnical Trade-offsAlgorithms & Data Structures
Author's notes

This took me longer than I expected to get organized in my head.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining the agent state as a growing trajectory of Thought/Action/Observation triples, then present a clean loop that builds the prompt from that trajectory, calls the LLM, parses the output, executes tools, and appends results. Emphasize termination conditions (final answer or step budget) and briefly discuss trade-offs like prompt length and error handling.

Pro tip: Mention that you would include the full trajectory in the prompt each turn to maintain context, but also discuss truncation or summarization strategies for long trajectories to avoid token limits—this shows awareness of real-world constraints.

1. Define the agent state and trajectory

Initialize a list to hold the trajectory (e.g., thoughts, actions, observations) and set a step counter. The trajectory will be the source for constructing the prompt each turn.

2. Construct the prompt from the trajectory

Build a prompt that includes the task description, the ReAct format instructions, and the entire trajectory so far. This gives the LLM the full context to decide the next thought/action.

3. Call the LLM and parse its output

Send the prompt to the LLM and parse the response to extract either a Thought followed by an Action, or a Final Answer. Handle parsing errors gracefully.

4. Execute the action and append observation

If an Action is present, execute the corresponding tool with the given input, capture the output, and append the Thought, Action, and Observation to the trajectory.

5. Check termination conditions

If a Final Answer is produced, return it and exit. If the step budget is exceeded, return a failure or the best answer so far. Otherwise, increment the step counter and loop back to step 2.

Key Points to Mention

  • The ReAct loop alternates between Thought (reasoning), Action (tool call), and Observation (tool output).
  • The prompt is constructed by concatenating the task description, format instructions, and the full trajectory of previous steps.
  • Tool outputs are appended to the trajectory as Observations, which become part of the context for the next LLM call.
  • Termination occurs when the LLM outputs a Final Answer or when a predefined step budget is reached.
  • Error handling: if the LLM outputs an invalid action or the tool fails, append an error observation and continue.
  • Trade-offs: including the full trajectory can exceed token limits; consider truncation, summarization, or sliding window approaches.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.