DEV Community

Cover image for Should you split your agent's brain from its hands?

Should you split your agent's brain from its hands?

Elia Secchi on November 30, 2026

Code has become the universal tool for AI agents. Instead of building a custom tool for every task, you give an agent a shell so it can write and r...
Collapse
 
max_quimby profile image
Max Quimby •

The brain/hands framing is clean, and the security point underneath it is the one that matters most: a system prompt is not a boundary. We treat anything the hands read — a web page, a tool result, a file — as hostile input to the brain, because that's exactly the injection path, and no amount of "do not run destructive commands" in the prompt closes it.

On coupled vs decoupled, the deciding factor for us wasn't scaling — it was blast radius and observability. Decoupled (brain outside, hands in a remote sandbox) means every tool call crosses a network boundary you can log, rate-limit, and kill independently of the orchestration loop. That seam is annoying for latency but priceless when an agent misbehaves and you want to sever the hands without tearing down the whole session's state. Coupled is simpler and local until the day you need to forensically answer "what did it actually run," and then the shared sandbox makes that harder. How are you handling session-state durability when the brain lives inside an ephemeral sandbox that can get reaped?

Collapse
 
kami_butt_69b922ade8de012 profile image
Agentic Affairs •

The load-bearing point is that guardrails, approvals and core credentials sit out of reach of generated code in the decoupled layout — a system prompt is instructions, not a security boundary, and this makes that concrete. The trade-off I'd push on is the network hop per tool call: every command to the hands crosses the wire, plus a state save each turn. At what call volume does that overhead make the coupled layout win, or does the sandbox locality of Agent Substrate make it a non-issue in practice?

Collapse
 
heyvaldemar profile image
Vladimir Mikhalev •

The brain's own output is an exit too. Across 168 triages in 56 runs of a Cypress triage agent (42501583888 to 46459395874), a note planted in a failed test got granite-4.0-1b to act on it 12 times and qwen3.5-2b 9 times, almost always by putting a data link into the summary the brain posts to Slack.

That summary goes through a notifier that breaks links and mentions and turns previews off, so the link lands dead. An allowlist in the brain covers what it calls. It also has to cover what it says.

Do the guardrails you put on the Cloud Run side filter the final answer, or only the tool calls?

Collapse
 
kamalmosadegh profile image
Kamal Mosadegh •

The split I'd watch isn't brain vs hands — it's what lands in the session. Every tool call and its result gets appended to the history, and the model pays for all of it on every turn after. I measured it on a realistic transcript: 2,150 tokens down to 592 (−72.5%) with all 55 facts kept, just by tracking facts through the cut instead of quoting a ratio. On a 40-turn run that was 3,683 tokens against Headroom's 57,111. The decoupled layout makes this worse in one specific way: hundreds of file reads become hundreds of network round trips, and each result still lands in the session. So whichever side the brain lives on, the budget that decides whether a long turn survives is the session, not the sandbox.
dev.to/kamalmosadegh/llm-token-com...

Collapse
 
gautamtalksdev profile image
Gautam K •

Splitting the brain from the hands makes a lot of sense, mostly because the hands are where the damage happens. If the shell runs somewhere separate with its own narrow credentials, a confused brain can only do so much. Do you keep the approval for risky commands on the hands side too?

Collapse
 
digbijoylabs profile image
digbijoylabs •

Splitting the planner ("brain") from the executor ("hands") pays off the moment your agent touches anything stateful or irreversible.

When planning and tool execution share one flat transcript, verbose tool outputs rapidly crowd out the original task invariants, and a retry loop ends up arguing with its own raw logs. Separating them lets the planner operate over a small, structured state object (confirmed facts, open goals, rejected paths) while bounded worker executors run in isolated sandboxes with strict timeouts, typed schemas, and idempotency keys—returning only verified results back up to the planner.

Collapse
 
ssufikhan profile image
Sufi khan sulaiman •

The line about a prompt not being a security boundary is the whole post. The split that has been worth the complexity for us is brain outside the sandbox, hands deliberately dumb: a thin tool surface of read, write and run, with policy enforced at the boundary instead of in the system prompt. The failure mode you describe, where a tool output talks the agent into something, mostly disappears once the hands can only do what the boundary allows, whatever the model believes. Did the network hop add noticeable latency on chatty tool loops?

Collapse
 
sara_builds profile image
Sara •

The Cloud Run timeout story really clicked for me. I've seen a "just wrap the local loop in a web service" setup fall apart the first time a turn outlives the request, and then you're suddenly building a task store and reconnect path you didn't plan for. The "does orchestration need a life of its own" test is a useful filter — for a workspace-heavy coding agent that sits idle between turns, keeping brain and hands in one box looks less like a compromise than I used to think. Curious how you keep brain-side tools from becoming a confused-deputy path when one process serves every user.

Collapse
 
aiframe profile image
AI Frame •

The two kinds of idle time framing is what stuck with me. I have mostly built small agents where everything lives in one place, so the coupled setup felt natural, but the point about paying for a sandbox while the model thinks is a real cost once turns get long. The decision questions at the end are a useful shortcut too — if most turns never touch the shell, keeping the brain outside makes a lot of sense.

Collapse
 
mudassirworks profile image
Mudassir Khan •

the line that a prompt is a set of instructions, not a security boundary is the one i wish more agent demos started with. we ran the loop outside the sandbox and the thing that bit us was credentials. the brain held the model and tool tokens so the hands never needed any, and a prompt injected command could not exfiltrate what it could not read.

the cost is latency on every tool call over the network, which hurts on chatty shell loops with dozens of small commands.

have you measured the round trip overhead of the decoupled setup versus a shared sandbox on something like a long refactor task?

Collapse
 
nick_railcall profile image
Nicholas Capozzo •

The line about approval gates being cheap to wait on is a good one, and it raises a question the layout alone doesn't answer: what has changed by the time the person says yes? If a turn sleeps for six hours, the files, the policy or the recipient may not be what they reviewed.

I work on RailCall, and there the approval is checked again right before the action. It's tied to the hash of the exact payload, can expire, and works once. If the payload changed, it's blocked.

In the one-box setup, where you put approvals outside the sandbox, what does the gate compare when the actor wakes up? The original request, or whatever the agent is asking for now?

Collapse
 
sandscale profile image
Sandscale •

Clear framing, and the "a prompt is not a security boundary" line is the right place to start. One thing I'd add to the decoupled column: once the brain holds the model keys and the hands hold nothing, the sandbox's egress policy becomes the main lever, because an injected command can still try to send workspace files out. Default-deny outbound plus the egress gateway you mention covers most of it, as long as DNS also goes through that gateway, or it turns into the side channel.

On the drift con, one approach that helps: treat the sandbox filesystem as the source of truth for files and the session DB as the source of truth for the conversation only, and after each tool result write a small record into the session (tool call id plus a hash of the paths it touched). After a crash you can tell whether the tool already ran without running it again.

Disclosure: I work on Sandscale, which runs agent code in Firecracker microVMs, so I mostly see the hands side. Curious how the coupled side handles a turn that is mid-command when the actor gets snapshotted.

Collapse
 
syedfahads profile image
Syed Fahad •

where do MCP servers land in this split? a remote one holding its own credentials feels like a third box, neither brain nor hands

Collapse
 
vexaloom-labs profile image
vexaloom-labs •

Persisted conversation history gives poisoned instructions a return ticket even after the sandbox is replaced.

Collapse
 
the_daily_flare profile image
The daily flare •

Your 1,000 concurrent requests per instance figure made me rethink how cheap waiting on the model can be.

Collapse
 
ric0c0derlab profile image
Ric0 C0der Lab •

Separating inference from execution is particularly appealing in a homelab. You can upgrade the model without giving it direct access to every system.