Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. Multi-agent systems become powerful when they can adapt, but they become production-ready only when that adaptation is controlled. In this episode, we continue our Google ADK series and explore how ADK brings flexibility, structure, and reliability to multi-agent execution. We move beyond static workflows into dynamic orchestration: letting an agent decide which agent should act next, when a tool should be called, when a task should be escalated, and how the full execution path can be observed. You’ll learn: * How agents delegate work dynamically, including when to introduce Human-in-the-Loop review * How to build orchestration logic beyond built-in workflow agents, using custom agents, agent-as-tool patterns, and callbacks * How plugins help apply shared rules and behaviors across every agent in a system 👉 Enjoyed this episode? Subscribe to The AI Practitioner to get future articles and podcasts delivered straight to your inbox: aipractitioner.substack.com Get full access to The AI Practitioner at aipractitioner.substack.com/subscribe
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
[music]
SPEAKER_00welcome back to the ai practitioner i'm lina faik ml engineer consultant and lecturer in advanced machine learning at sorbonne university i help companies turn their data into real outcomes with ai and this is where i share what i learned from actual projects the deep technical write-ups live on Substack at aippractitioner.substack.com and these conversations are the audio companion today i'm joined by sam Sam builds ML systems for a living, has wired plenty of tools together but hasn't gone deep
SPEAKER_00on agent orchestration frameworks yet which makes him exactly the right person to keep me honest
SPEAKER_01today. Happy to be here so what's on the table today?
SPEAKER_00Okay picture this I've got a little writing assistant I built with Google's agent framework you give it a broad theme it turns that into a concrete scientific question writes a first draft reviews the draft improves it and stops clean little pipeline and then someone hands it a request that's already a precise question fully formed and the system dutifully runs it through the whole question selection stage anyway as if it were still a vague theme
SPEAKER_01so it re-answers a question nobody asked exactly it treats every request
SPEAKER_00the same way and that's the moment you realize a fixed path isn't good enough the pipeline was correct it just wasn't adaptive
SPEAKER_01hold on though that sounds like a routing problem and routing is old couldn't you just write an if statement if it's a question skip step one done
SPEAKER_00that's the honest first instinct and for clean inputs it even works the problem is the input isn't clean it's natural language someone might paste a broad theme or a sharp question or the third paragraph of that draft is too dry fix it three completely different intentions no tidy flag telling you which is which so instead of a hard-coded branch you put a coordinator agent at the front whose only job is to read the request and decide where it goes
SPEAKER_01so the coordinator is basically a receptionist that's the exact analogy i use
SPEAKER_00a help desk the front desk doesn't fix your problem it listens then sends you to support or billing or compliance my coordinator has three doors broad theme goes to the theme agent for question selection precise question skips straight to drafting and adjust this existing draft also goes to drafting but with your instruction tucked into the shared state so the next agent sees it and when it picks a door does it come back no and that's the part worth slowing down on in this framework that's called a transfer and the transfer is
SPEAKER_00a real handoff control moves to the specialist and does not return to the coordinator the receptionist doesn't hover over your shoulder at the billing desk two small pieces make it work you declare which agents the coordinator is allowed to hand off to and then the actual handoff just names the target but here's the thing that bit me the routing is only as good as your agent descriptions the model chooses the door by comparing your request against each agent's description so if two agents have vague or overlapping descriptions
SPEAKER_00the choice gets flaky sharp non-overlapping boundaries are doing more work than the fancy orchestration it's almost boring how much it comes down
SPEAKER_01to writing clear descriptions okay so the coordinator gets you to the right starting point but you mentioned a human somewhere in here yeah
SPEAKER_00and this is one of my favorite pieces sometimes the agent genuinely shouldn't decide alone in my pipeline the theme agent doesn't pick the final question it proposes three candidates and then it stops and asks me to choose one or edit one before anything gets written so it just pauses mid run it suspends the whole run the tool fires a confirmation request the run goes to sleep and a little dialogue pops up with the three options nothing happens until a human answers when I pick or edit one the exact same tool call wakes back up reads my answer stores the chosen question
SPEAKER_01and hands off to the drafting stage that's nice because the classic version of this is the agent charges ahead and you find out afterward it committed to the wrong thing
SPEAKER_00right think of a support agent that drafts a refund you don't want it emailing the customer you want a manager to approve it first same shape propose pause let a human decide then continue with that decision baked in i won't walk through the two-step code on mic the pause and resume pattern is spelled out in the article
SPEAKER_01fair so we've routed the request and we've got a human in the loop what actually runs the right review improve part so this is the heart
SPEAKER_00of it most frameworks give you a few built-in patterns for free run agents one after another run them in parallel or loop the same steps until some condition stops you and those are great when the path is predictable and
SPEAKER_01a loop sounds perfect here write critique revise repeat until good enough why isn't
SPEAKER_00that the whole answer because every round shouldn't be identical here's what i mean the critic looks at a draft and comes back with a verdict sometimes the problem is factual a claim that needs checking sometimes it's purely stylistic a sentence that's too long too dry those two need completely different next moves if it's factual the next draft should go pull in some research if it's just style doing a research step is wasted money and noise a plain loop can't make that call it just repeats so you need a decision in between
SPEAKER_00the steps exactly and that's where you drop down from a built-in loop to a custom agent it's not another language model, it's plain python orchestration it runs the writer runs the critic reads the verdict and then decides what the next round needs approved stop factual issue set a research flag for the next round just style revise no research that one flag is the whole trick empty means revise as is filled means ground the next draft with new information i'll skip the actual python on mike the full loop is in
SPEAKER_01the article so the difference between a loop and this custom thing is really the difference between do the same thing again
SPEAKER_00and look at what happened and decide that's the cleanest way to say it a loop repeats a custom agent adapts use the built-in one for fixed paths reach for custom the moment you need a decision between steps quick thing you said
SPEAKER_01the critic returns a verdict how does the code even read
SPEAKER_00that is it structured good question and there's a genuine trade-off here the critic returns plain text with a few tagged fields verdict category fixes i could force a strict Structured output behaves differently across model providers and an agent locked into a strict output format can't also use tools or handoff control. The tag text is looser, but it's flexible, and it fails safely. If the parser can't read the verdict for some reason, the loop defaults to revise not approve.
SPEAKER_00i'd rather it do one more round than wrongly declare victory failing
SPEAKER_01toward more work instead of false confidence i like that okay you mentioned the writer pulls in research is that another handoff this is a great distinction
SPEAKER_00and it tripped me up early no it's not a handoff when the writer needs a fact checked it calls a research agent as a tool and the key word is calls the writer stays in charge the research agent runs searches the web summarizes hands back a result and control returns to the writer compare that to the coordinator earlier which transferred control away
SPEAKER_01and never got it back so one is you take over and the other is go look this up and report back to me
SPEAKER_00perfect a transfer is handing off the whole project an agent as a tool is asking a colleague to check one fact while you keep writing and notice research isn't called every single round that would burn money and add noise it only fires when the critic flagged something factual the orchestration decides whether research is needed the writer just acts on the signal
SPEAKER_01there's a theme here the smart decisions live in the orchestration and the agents stay kind of dumb and focused that's the design philosophy
SPEAKER_00in one sentence honestly keep the agents narrow put the judgment in the layer around them there's one more piece in that spirit sometimes you don't want the model to decide anything you just want a small piece of code to run automatically at a fixed moment after the writer produces a draft I run a quick style check word count overly long sentences em dashes passive voice wait is that the model grading itself no and that's the point it's a callback it runs on its own right after the model responds the model doesn't choose to call it
SPEAKER_00and crucially it doesn't rewrite anything It just records what it found. Then the critic reads that little report and folds it into its feedback so the writer fixes it next round There's a simple rule for these If the callback returns nothing, it just observed and the run continues if it returns a value, it can step in and replace what would have happened like a guardrail blocking a bad response Here I only wanted to observe
SPEAKER_01And i'm guessing you don't want heavy logic in there
SPEAKER_00Right callbacks are for small mechanical checks and lightweight logging not for expensive reasoning keep them cheap
SPEAKER_01so that style check is attached to the writer what if you want the same rule everywhere like count tokens
SPEAKER_00across every agent right you read my mind that's the last piece a callback is local it belongs to one agent if you wanted token counting on all of them you'd be pasting the same callback everywhere and forgetting one so instead there are plugins a plugin is registered once at the application level and it watches the whole run local versus global a callback for one agent a plugin for the entire system and you used it for cost tracking metrics yeah one plugin counts token usage across every model call resets cleanly at the start of each run and watches
SPEAKER_00the events flowing by drafts critiques the convergence markers one consolidated view without smearing measurement logic across all the agents and that measurement gave me the most counterintuitive result of the whole project go on i ran the exact same question twice same pipeline same prompts same logic the only thing i changed was the underlying model gemini flash one time claude sonnet the other both converged in three rounds both approved by the critic final drafts landed in a similar length
SPEAKER_00so far boring which is actually the good news it proves the design is model agnostic
SPEAKER_01okay okay so where's the twist the token counts and
SPEAKER_00the cost don't move together gemini logged almost twice as many tokens as claude partly reasoning tokens under the hood
SPEAKER_01so gemini cost more more tokens bigger bill that's the trap it was
SPEAKER_00about seven times cheaper nearly double the tokens a fraction of the cost because the price per token was so much lower if you tried to guess the bill from the token count you'd have been badly wrong and in the wrong direction huh
SPEAKER_01so fewer tokens is not the same as cheaper not even close
SPEAKER_00and i want to be honest about what this is it's a single run each not a benchmark live web search sampling the specific topic all of that moves the numbers but the shape of the lesson holds watch cost directly don't infer it from tokens the full table both models side by side is in
SPEAKER_01the article this is making me want to actually try it so if i'm at my desk monday morning and i want to build something like this on my own data where do i even start
SPEAKER_00start with the boring part not the orchestration the boundaries write crisp non-overlapping descriptions for each agent because that's what makes the routing reliable then add exactly one adaptive decision just one where a plain loop would repeat but you actually want it to branch get that working before you reach for the human check or the plugins those earn their place but they're step two the full write-up with all the code the pause and resume pattern and the complete cost breakdown is on Substack at aipractitioner.substack.com links in
SPEAKER_00the caption
SPEAKER_01Honestly, not what I expected. I thought you'd tell me to start with the fancy orchestration
SPEAKER_00The Fancy Orchestration is the easy part To copy The thing i'd leave you with Is this None of these pieces are exotic on their own Routing A human check A decision inside a loop A couple of quiet observers What makes a system feel real Isn't any single one of them It's putting the judgment in the orchestration And letting each agent stay small and focused That's the whole game
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could learn from every interaction...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could continuously improve their...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if AI agents could improve their own prompts...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if the key to better AI agents isn’t writing...
Prefer reading instead? The full article is available here. The podcast is also available on Spotify and Apple Podcasts. Subscribe to keep up with the latest drops. What if improving an AI agent’s performance had less...