Memory and multi-agent systems in TypeScript · Chapter 16 of 16

Interview round

By the end of this chapter you have fixed five timed bugs, one idea each, from across the whole lab: a compaction that loses a message, a date read in the wrong year, a newest value that is not the fact, a confusion matrix that flatters a router, and a hop limit that never stops. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.

  • Part: Many agents
  • 5 tasks
  • TypeScript
  • In the all labs plan

The first 2 chapters of Memory and multi-agent systems in TypeScript are free. This one comes with the all labs plan.

Why you need this

Karan gives every engineer who joins the assistant team the same round before they own a part of it. "Short broken files, ten minutes each. Every one of them is a bug I have seen in a real memory or a real team of agents. I am not checking that you remember the API. I am checking that you read what the code sent, and measure before you believe." Pooja liked it enough to make it the end of the lab.

Fifteen chapters taught each idea with a lesson beside it. An interview, and a bug report at two in the morning, give you only the broken code. Each question here uses one idea from an earlier chapter, with no hand-holding: the file has the goal, the check has the edge cases. The ideas are below as a refresher, and as what an interviewer listens for. The fixes are not.

What you build: 5 tasks

Each task has tests. You write the code in the lab's editor and press Check.

  1. Task 1 · interview question

    Interview: compact.ts, a compaction that loses a message

    Time yourself: 10 minutes. compact(messages, keep = 4) in compact.ts should return one system message, Summary of the conversation so far: on its first line and then summarise's summary of every message but the last keep, followed by the last keep messages unchanged. An array of keep messages or fewer comes back as a new array with the same messages and no summary request. The array it is given is never changed.

    Run it: after compacting WD1063's session 3, the question about the guest count is answered with an invented number. Fix compact, keeping its name, its parameters and the export; summarise is fine. The check compacts conversations of its own and reads what each summary request held.

  2. Task 2 · interview question

    Interview: today.ts, a date in the wrong year

    Time yourself: 10 minutes. extractDate(sender, text, at) in today.ts should return the ISO date a message gives an event, as of the day the message was sent; at is the message's time, like 2026-10-10T18:20:00+05:30. Run it: a mehndi moved to 21 Jan, said in October 2026, comes back in the wrong year.

    Fix extractDate. Keep its name, its parameters, the export and the Change schema. The check sends messages sent on other days, around a new year too, and reads the request.

  3. Task 3 · interview question

    Interview: newest.ts, the newest value is not always the fact

    Time yourself: 10 minutes. current(weddingId, messages) in newest.ts should return each fact's current value after a wedding's labelled thread messages, as policy section 1 decides: a tentative message never counts; the budget only from the wedding's decides.budget; the guest count only from its decides.guests, the couple or the planner; anything else from anyone; the newest that counts wins, by time.

    Run it: WD1057's budget is the one Kabir asked for. Fix current, keeping its name, its parameters and the export. The check compares all four weddings with facts.json, and tries threads of its own, given out of order.

  4. Task 4 · interview question

    Interview: confusion.ts, a confusion matrix that flatters the router

    Time yourself: 10 minutes. confusion(pairs) in confusion.ts should return matrix[expected][predicted], how many requests for the expected specialist the router sent to the predicted one, with all four labels in both places and zeros included; recall(matrix, label) is the share of the requests for label that went to label, 0 when there are none. Run it: the numbers look good, and they are not the recall.

    Fix what is wrong; route is fine. The check builds matrices from pairs of its own and compares what confusion.ts prints with the router's real replies.

  5. Task 5 · interview question

    Interview: hops.ts, a hop limit that never stops

    Time yourself: 10 minutes. run(text, weddingId, start, maxHops = 3) in hops.ts lets the specialists hand a client's message on and, when a specialist asks for a handover after maxHops of them, gives the conversation to a planner: the path ends with planner and the answer is PLANNER. Run it: R075 goes round a dozen times before the safety net stops it.

    Fix run; keep its name, its parameters, the export and the safety net. The check counts the requests for several hop limits, 0 among them, and tries a question that needs one handover.

What you will learn

  • How to work a timed bug: run it, read what was sent, find the line, prove the fix.
  • Five ideas again, at interview depth: compaction (chapter 3), today's date in extraction (4), authority over newness (6), evaluating a router (10), and hop limits (14).

More in Many agents

Build "Interview round" yourself

Baraat Bliss, a Jaipur wedding planner, must remember months of family decisions across many agents. You build its assistant in TypeScript. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.

The first 2 chapters of Memory and multi-agent systems in TypeScript are free. This one comes with the all labs plan.