Zero Labs
Industry News / AI

The Agent Boundary Problem: Designing Multi-Role AI Systems with Memory and Orchestration

Source · Towards AI By Sahil Memon

From the publisher’s feed, collected in the ZeroLabs newsroom.

A role-based voice interview system I built runs in production using a 20B-parameter model, with a measured Time-to-First-Token of 557ms at the median and 758ms at the 95th percentile. Those numbers exist because of one architectural decision made early: the technical interviewer, the system-design interviewer, and the behavioral interviewer are not three agents. They are one reasoning system wearing three personas, controlled by a deterministic orchestrator. Making that call, and defending it as the system went from prototype to production, is what this piece is actually about.The easier, more obvious path - and the one most teams default to as soon as an application has more than one distinguishable role, is to split everything into agents. One agent researches, another plans, another executes, another checks the result. It looks clean on a whiteboard, and sometimes it’s the right design.But there’s a question that gets skipped surprisingly often: does a different role actually require a different agent, or does it just require the same reasoning system to behave differently?I ran into this directly while building the interview system. It has three stages - technical, system design, and behavioral, and each one needs to sound different, ask different questions, remember different things, and evaluate different aspects of an answer. The obvious implementation is three agents. I wasn’t convinced the roles were actually three different reasoning systems, and that turned out to matter for how the whole thing got built, and for how it performs.First, separate the words“Agent” has become a convenient name for almost any application that calls an LLM, which makes architecture discussions confusing unless the words underneath it get separated. A model is the reasoning engine. A persona changes how that engine behaves - its instructions, priorities, tone, evaluation criteria, and relevant context - without changing anything structural underneath it. An orchestrator controls the workflow: what should happen, and in what order. An agent is a genuinely stronger boundary - it usually owns some combination of its own objective, tools, state, memory, and ability to take independent action.These are different things with different costs. Changing “You are a technical interviewer” to “You are a behavioral interviewer” doesn’t create a new agent - it changes the role of the same reasoning system, and that’s a prompt edit. Changing when a stage transitions is a state-machine edit to the orchestrator. Standing up a genuinely new agent means a new context, a new set of tools, and usually a new network hop. Microsoft’s own Cloud Adoption Framework guidance makes the same distinction independently, noting that distinct roles such as planner, reviewer, and executor might suggest multiple agents but don’t automatically justify a multi-agent architecture, since a single agent using persona switching and context-aware policies can often satisfy role-based behavior without added orchestration. That’s not a coincidence - it’s the same cost structure showing up wherever people have actually measured it instead of assumed it.That leaves two possible architectures:Separate agents2. One reasoning system with multiple rolesA three-stage interview is a useful test caseSuppose a candidate goes through three rounds - technical, system design, and behavioral, each with a genuinely different job. The technical round probes language fundamentals, frameworks, and implementation detail. The system-design round cares about scalability, reliability, and trade-offs. The behavioral round asks about decisions, conflicts, and past experience. So why not three agents?Because everything that makes the interview one continuous experience is still shared across all three: the same candidate, the same job description, the same prior answers, the same session state. The underlying ability to understand natural language doesn’t become a different capability just because the conversation moved from a Java question to a system-design one. The second option isn’t “less AI.” It just puts the boundary somewhere else: in the persona layer and the orchestrator, rather than in separate model instances.Let the application control what it already knowsThe LLM doesn’t need to decide everything. If the application already knows the technical round is followed by system design, asking a model “which interviewer should speak next?” is unnecessary work - a simple state machine already owns that answer. The orchestrator can also enforce how many follow-ups are allowed, whether a stage is allowed to end, when the next stage begins, when the whole session is complete, and what happens after a connection failure.Letting the model decide when a round was complete exposed a predictable failure mode in an early version of the system: a strong candidate answer just invited a better follow-up, so the model kept digging for one more question, then another. That’s reasonable from the model’s perspective, “this is worth continuing” isn’t the same judgment as “this round should continue” - but the interview was time-boxed, and the model had no way to know that on its own. The fix wasn’t a better prompt. It was a timer the orchestrator enforced regardless of what the model wanted to ask next.What’s left for the model is exactly the part that actually requires language reasoning: generating the next question, interpreting the candidate’s answer, phrasing a follow-up, adapting difficulty, and identifying useful evidence in what was said. This generalizes well past interviews - a database transaction doesn’t need an LLM to decide whether to commit, a finite workflow doesn’t need one to invent its next state, and a permission check shouldn’t become a prompt. LLMs earn their place where the application doesn’t already have a deterministic answer, not everywhere a decision needs to be made.The harder problem is memoryChanging personas is easy. Keeping the conversation coherent across those personas is not. The system-design interviewer shouldn’t open with “hello, tell me about yourself” - it needs to know what already happened in the technical round. But passing the full transcript into every request creates a different problem: a 30-45 minute session generates a lot of conversation, and most of it isn’t relevant to the current question, so sending all of it every time is wasteful.The fix is separating conversation context from interview memory. Conversation context is what the model needs right now, the recent back-and-forth. Interview memory is what the system has learned and may need later, structured as its own object:{ "topics_covered": [], "technical_strengths": [], "technical_gaps": [], "design_strengths": [], "design_gaps": [], "behavioral_signals": [], "evidence": []}Each turn, the system builds a smaller context packet instead of the whole history: current stage, current persona, recent conversation, the relevant slice of interview memory, and the current objective. The same pattern applies to a coding agent tracking architecture decisions, files changed, and known test failures across a long session - the working diff is the conversation context, the decision log is the memory. Don’t confuse the transcript with memory; they solve different problems and belong in different structures.Where the voice requirement changes thingsA text application tolerates architectural inefficiency reasonably well, the user sends a message, waits, and reads. Voice doesn’t forgive that the same way. Every unnecessary step in a live conversation - another model call, another context transformation, another handoff, another network request - sits directly between the user and the next spoken word. The user doesn’t experience that as “architecture.” They experience it as silence.I documented the lower-level speech pipeline (streaming recognition, synthesis, interruption handling, audio-state management) separately, so I won’t repeat it here. The relevant point for this piece is simpler: agent boundaries can become latency boundaries. To protect that latency, responses are kept deliberately concise - across a 66-turn sample, the model averaged 34 words per reply and asked exactly one question 98% of the time. That’s not a coincidence either; avoiding cross-agent handoffs on every turn removes an additional source of latency from the critical path.What I actually builtSource: Visual elements generated with Google GeminiThe question became concrete while building an Android application that conducts real interviews through live voice. A candidate provides a job description and resume, then moves through technical, system-design, and behavioral rounds before receiving an evidence-backed evaluation. The implementation uses Agora for the real-time voice layer and a FastAPI backend for orchestration.The interesting architectural choice wasn’t that there were three roles - it was where their responsibilities stopped and the application took over. The backend uses a state-driven orchestrator to control the stages and maintain shared cross-round context, and zero AI calls are spent simply deciding whose turn it is. In production, a 70-turn interview requires exactly 70 LLM calls in the best-case scenario and zero additional routing calls; the orchestrator’s state-transition overhead averages 0.5ms, peaking at 1.3ms, while end-to-end voice latency - from the candidate finishing an utterance to hearing the interviewer’s response, is measured at 1.5–1.8 seconds. A role can be a boundary in behavior without being a boundary in computation.What this design costsNone of this is free, and the friction is worth naming rather than only the upside. One model juggling three personas can bleed between them, a phrasing habit or a piece of context from the technical round leaking into the tone of the behavioral round if the prompt boundary isn’t reinforced turn by turn. Because there’s no hard module boundary, debugging “the system-design interviewer asked something odd” means inspecting the same context-construction code path that serves every other role, rather than isolating one agent’s logs. Evaluation gets harder to keep clean, too — since a persona is just instructions, a regression in one role’s behavior can be caused by a prompt change made for a completely different role, if they share a template.None of that is a reason to default to separate agents. It’s a reason to invest in strict per-turn context construction, per-persona regression tests, clear state transitions, isolated prompt configuration, and role-specific observability. That’s still cheaper than running three agents.So when should you create another agent?There are real cases where the boundary is genuine. If the technical interviewer needs to actually execute a candidate’s code, that component doesn’t just need a different personality - it needs different capabilities, different information boundaries, and different execution responsibilities.That’s a much stronger justification for an agent boundary. Before creating one, five questions are worth asking: Does it need a different model? Different tools? Genuinely different information or memory? A genuinely different objective? Does it need to execute independently? If the only honest answer is “it should behave differently,” a persona is probably enough. If several of the five come back yes, an agent boundary starts making real architectural sense.The architecture can evolveNone of this has to be decided once and for all. A sensible system can start with one model, personas, a deterministic orchestrator, and shared memory - then grow into specialized tools, persistent memory, and asynchronous evaluation layered on top of the same core.Only later, once a specific role needs to execute code independently or take an irreversible external action, does that piece earn its own agent boundary. Scaling the number of users doesn’t automatically mean adding agents; if the application gets ten times more traffic, the first problems are almost always infrastructure problems - concurrency, queues, state storage, rate limits, model capacity, and none of those get solved by turning one agent into five. Scale is not the trigger for an agent boundary. Capability is.For this pipeline, that boundary hasn’t needed to move yet. The three interviewers still run on one reasoning system with three personas, a deterministic orchestrator, and shared memory, because none of the five questions above have come back yes for any of them. The day the technical round needs to actually execute a candidate’s code in a sandboxed runtime, that persona earns its own tools, its own state, and its own agent boundary. Until then, spinning it into a separate agent wouldn’t add a new capability - it would just add another network hop between the candidate and the next spoken word.The Agent Boundary Problem: Designing Multi-Role AI Systems with Memory and Orchestration was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.