Q3) Design a reusable housing-search skill
You are creating an agentic solution to search for rental houses in the Netherlands. The orchestrator below is already defined in Listing 1.
Input: Path, Criteria, Email
Output: One email
Start
Set Websites to Call Read Sites(Path)
Set Matches to an empty list
For each Website in Websites
Set Offers to Call Get Offers(Website)
For each Offer in Offers
Set Accepted to Call Check Offer(
Offer, Criteria)
If Accepted is Yes Then
Append Offer to Matches
End If
End For
End For
Set Selected to Call Select Three(Matches)
Call Send Summary(Email, Selected)
EndImplement the real estate agent’s
Check Offer(Offer, Criteria)in pseudocode or a flowchart. Its two inputs are:Offer: one house record containing its city, monthly rent in euros, area in square meters, and webpage URL.Criteria: the required city, maximum monthly rent, and minimum area.
Return Yes only when all three rules hold:
- The offer’s city matches the required city.
- Its rent is at most the maximum monthly rent.
- Its area is at least the minimum area.
Otherwise, return No. Rent and area equal to their limits are accepted. Leave both inputs unchanged.
The orchestrator receives a text-file path (Path), the student’s email address (Email), and Criteria. Assume valid inputs and successful operations. Every offer is currently available and appears once across all websites.
These operations are already defined.
Read Sites(Path)reads website addresses from the text file. It returns a list in line order, trims spaces, skips blank lines, and closes the file without changing it. An empty file returns an empty list.Get Offers(Website)retrieves today’s available offers from one website address. It returns offer records in listing order without changing the website. A website with no offers returns an empty list.Select Three(Matches)receives a list of matching offers and returns a new list of up to three offers ordered by lowest rent. Equal rents keep encounter order. It leaves the input unchanged; an empty list gives an empty list.Send Summary(Email, Selected)receives an email address and a list of selected offers. It sends one summary email containing each offer’s city, rent, area, and URL in list order. With an empty list, the summary saysNo matching houses found.It returns no value and leaves the list unchanged.
Listing 2 shows the website file sites.txt.
Read Sites("sites.txt")returns the two addresses in file order.Get Offers("https://one.example")returns A01, A02, and A03 from Table 1, in that order.Select Three([A01, B01])returns B01 then A01 because B01 has lower rent.Send Summary("student@example.test", [])sends one email sayingNo matching houses found.
- For city
Enschede, maximum monthly rent1000euros, and minimum area40m², use the offers in Table 1. Which three houses will appear in the email, and in what order? Briefly justify your selection.
| Site | House | City | Rent (EUR/month) | Area (m²) |
|---|---|---|---|---|
| 1 | A01 | Enschede | 900 | 50 |
| 1 | A02 | Enschede | 1000 | 40 |
| 1 | A03 | Enschede | 850 | 35 |
| 2 | B01 | Enschede | 800 | 45 |
| 2 | B02 | Utrecht | 700 | 70 |
| 2 | B03 | Enschede | 850 | 55 |
A skill stores reusable instructions for a task. An AI agent follows instructions and uses available tools. The orchestrator coordinates the search through nested loops over websites and offers; the real estate agent checks individual offers. Each role is a named procedure with explicit inputs and outputs.
A handoff delegates one offer check. The orchestrator passes the offer and criteria to the real estate agent and receives its Yes or No decision. The supplied version waits for that decision before checking the next offer.
In agentic programming, a developer uses an AI coding agent to draft a design, test it, inspect the results, and revise it. The resulting skill can be reused with another website file or different criteria.