PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Zillow

Write pseudocode for a ReAct-style loop

Last updated: Apr 12, 2026

Quick Overview

This question evaluates the ability to design a ReAct-style agent control loop and related competencies such as state management, tool orchestration, observation handling, error management, and safeguards for termination and resource limits.

  • medium
  • Zillow
  • Coding & Algorithms
  • Machine Learning Engineer

Write pseudocode for a ReAct-style loop

Company: Zillow

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Coding prompt (pseudocode) Write **pseudocode** (does not need to compile) for a **ReAct-style agent loop** that alternates between **reasoning** and **actions**. ### Requirements - The agent receives a **user question**. - On each iteration, the model produces something like: - `Thought`: internal reasoning about what to do next - `Action`: the name of a tool to call (e.g., `Search`, `Calculator`, `LookupDB`) or `Finish` - `ActionInput`: arguments for the tool - If an `Action` is chosen: - Call the tool, obtain an `Observation`. - Append `Observation` back into the context for the next iteration. - Stop when the model chooses `Finish` or when a maximum number of steps is reached. - Include basic safeguards: - max steps / timeouts - handling tool errors - preventing infinite loops ### Deliverable Provide the loop structure and the data you keep in state (e.g., conversation history, scratchpad, tool outputs).

Quick Answer: This question evaluates the ability to design a ReAct-style agent control loop and related competencies such as state management, tool orchestration, observation handling, error management, and safeguards for termination and resource limits.

Related Interview Questions

  • Implement k-th largest in a number stream - Zillow (medium)
  • Find max min-plus-max over all subarrays - Zillow (medium)
  • Implement placeholder-based pattern matcher - Zillow (medium)
Zillow logo
Zillow
Nov 8, 2025, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
2
0

Coding prompt (pseudocode)

Write pseudocode (does not need to compile) for a ReAct-style agent loop that alternates between reasoning and actions.

Requirements

  • The agent receives a user question .
  • On each iteration, the model produces something like:
    • Thought : internal reasoning about what to do next
    • Action : the name of a tool to call (e.g., Search , Calculator , LookupDB ) or Finish
    • ActionInput : arguments for the tool
  • If an Action is chosen:
    • Call the tool, obtain an Observation .
    • Append Observation back into the context for the next iteration.
  • Stop when the model chooses Finish or when a maximum number of steps is reached.
  • Include basic safeguards:
    • max steps / timeouts
    • handling tool errors
    • preventing infinite loops

Deliverable

Provide the loop structure and the data you keep in state (e.g., conversation history, scratchpad, tool outputs).

Submit Your Answer

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Zillow•More Machine Learning Engineer•Zillow Machine Learning Engineer•Zillow Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.