Coding Agent in Practice: A Compliant Real Estate Data Collection Attempt
This article examines how coding agents move beyond code completion by using a real estate price-drop alert tool as a practical case. It covers authorized data-source boundaries, environment setup, API access and context construction, constraint-based prompts, tool execution, and human code review, with a sample Python skeleton that reads secrets from environment variables and limits retries.
Traditional code assistance tools mainly provide code completion and snippet generation. Developers need to manually paste results into projects, which increases debugging cost. A new generation of tools is evolving toward coding agents. They read project context, plan steps, modify multiple files, and attempt to run tests.
Many mainstream coding tools currently offer three common capability categories:
- Task decomposition: generate a brief design description based on requirements and divide it into modules such as input, collection, comparison, and notification.
- Context access: support custom models, expand the context window, and read documents or sample code provided by the user.
- Extension protocols: some versions support external integrations such as MCP (Model Context Protocol). Actual support depends on the tool version and should be verified in the settings page or official documentation before use.
This article does not evaluate a specific product; it discusses a general development workflow. The case uses real estate data collection because such scenarios involve data sources, access restrictions, and personal information, allowing it to test how tools perform under real constraints.
1. Case Scope: Building Price-Drop Alerts on a Legal Data Source
1.1 Requirements and Boundaries
This case builds a listing price-drop alert tool. The user enters a city and price range, and the program reads a listing list from an authorized data service API and compares it with local historical records. When a price drop is found, the program prints the price, address, and drop amount of the listing and notifies the user by email.
This case only handles public data that is authorized or legally obtainable. Before use, confirm the data source website’s terms of service and robots policies, do not collect personal information, and do not use the data for harassment or resale. The data scope is limited to cities explicitly authorized by the data provider rather than attempting to cover all sources.
1.2 Environment Setup
First, download and install the coding tool from official channels. After installation, choose the underlying model. A model with strong coding and reasoning capabilities is recommended, and its context window should be large enough to hold API documentation and sample code.
Second, write explicit constraints into the tool’s project rules, for example: “Do not generate code that bypasses CAPTCHAs, IP bans, or other access controls; all secrets must be read only from environment variables.” Such rules let the tool obey boundaries while generating code, which is more reliable than after-the-fact review.
Third, prepare a local Python environment. Python 3.10 or later is recommended, and install the requests library.
1.3 Data Service Access and Context Construction
Log in to the data provider’s console and create an API key. Follow the principle of least privilege: select only the read APIs needed by this tool and set a reasonable call quota.
Do not write the key into code or commit it to a code repository. It is recommended to read it from an environment variable, such as DATA_API_TOKEN. Keys should be rotated regularly. If a leak is suspected, revoke the key in the console immediately and reissue it.
Read the provider documentation for call limits, return fields, and terms of use. Then copy its official sample request, remove the real key, and save the sample as a context file. Note that this step should save API documentation, not unauthorized APIs obtained from other channels.
1.4 Requirement Prompt
After the context is ready, enter a clear requirement prompt into the tool. Below is the prompt used in this case, with compliance and security constraints added:
Using the data service API documentation in the context, develop a command-line tool for “price-drop alerts for listings in a specified city.”Constraints:1. Call only the authorized APIs in the context. Do not generate code that bypasses CAPTCHAs, IP bans, or other access controls.2. Read the API address and token from environment variables. Do not hard-code them. Do not output the token in logs.3. Set request timeouts; retry only on network exceptions and 5xx status codes; stop the current round on 429.4. Use SQLite to store historical prices, use listing ID as the deduplication key, compare prices, and output listings with price drops.5. Read the SMTP server, account, and authorization code from environment variables; use an SSL connection.6. The output code must include comments and unit tests for key functions.
This prompt contains three types of information: API source, behavior boundaries, and engineering requirements. The tool needs explicit constraints on what it must not do so that it avoids crossing boundaries when generating code.
2. Tool Execution and Code Review
2.1 Tool Execution Path
After receiving the prompt, the tool usually first generates a brief product requirements document, listing module division, inputs and outputs, and exception scenarios. Then, based on the context, it writes the collection function, historical storage logic, comparison logic, and email module, and generates several test cases with mock data.
This process saves a lot of repetitive coding time. But the generated code cannot be directly treated as reliable, because the tool does not know your account permissions, actual response structures, or runtime environment.
2.2 Generated Code Example
Below is the code skeleton after manual correction. The field structure is hypothetical and should follow the provider documentation.
import osimport smtplibimport sqlite3import loggingfrom email.message import EmailMessageimport requestslogging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s %(message)s")logger = logging.getLogger("price_drop_monitor")# API URL and token are read from environment variables; no secrets are stored in codeAPI_URL = os.environ["DATA_API_URL"]API_TOKEN = os.environ["DATA_API_TOKEN"]REQUEST_TIMEOUT = 15MAX_RETRIES = 3DB_PATH = "listings.db"def init_db(path=DB_PATH):"""Initialize the local historical price database, with listing ID as the primary key."""conn = sqlite3.connect(path)conn.execute("""CREATE TABLE IF NOT EXISTS listings (id TEXT PRIMARY KEY,city TEXT,address TEXT,price INTEGER,updated_at TEXT DEFAULT CURRENT_TIMESTAMP)""")conn.commit()return conndef fetch_listings(city, price_min, price_max):"""Call the authorized data API.Retry only on network errors and 5xx; stop immediately on 429; return None for other status codes.Return a JSON dictionary, or None on failure."""payload = {"city": city, "price_min": price_min, "price_max": price_max}headers = {"Authorization": f"Bearer {API_TOKEN}","Content-Type": "application/json",}for attempt in range(1, MAX_RETRIES + 1):try
