
Harness Hijack: AI Models Swapping Brains Mid-Story
I built a relay novel where Claude, Mistral, and Qwen hijack the same AgentCore Harness session mid-story, proving the context never breaks when the model does.
Amazon Bedrock AgentCore just shipped a new layer called Harness, and one line in the docs stopped me mid-scroll:
Switch providers between turns in the same session, and the conversation continues. Context carries over.
You call
InvokeHarness with the same runtimeSessionId every turn. You can change the model field to a completely different provider — Claude one turn, Mistral the next — and the harness keeps the conversation going as if nothing happened. Plan with one model, execute with another. No manual message replay, no re-building conversation history yourself.That's a genuinely new trick. Most multi-model demos I've seen (including one of my own, an AI debate battle app) run each model in its own isolated call and stitch the transcript together in application code. Harness does the stitching for you, at the session layer.
I wanted to see it with my own eyes, not just read about it. So I built something that makes the effect impossible to miss: a relay novel where the audience votes on which AI model takes over the story next, mid-narrative, and the model has to keep writing as if it always remembered what came before — because, from its point of view, it does.
What it does
Harness Hijack runs one continuous AgentCore Harness session. Every 20 seconds, voting opens for the next "brain": Claude Sonnet 4.6, Claude Opus 4.5, Mistral Large 3, or Qwen3 VL 235B. Whichever model wins the vote writes the next paragraph — and it has to pick up exactly where the previous model, on a completely different provider, left off.
Here's an actual run from testing. Claude Sonnet 4.6 opened the story:
Fog crept up the cobblestones along the river that night. Luca Seran stood at the foot of the Velta bridge, an old leather bag in his arms. Seventeen years since he'd last seen this town, and it was quieter than he remembered, darker too. Only the clock tower across the bridge hadn't changed — three faces turned to the sky, every hand frozen at the same time, 2:14 AM.
Two rounds later, the vote flipped to Mistral Large 3 — a different company, different training data, nothing in common with Claude except the session ID. Its first line:
Luca took the lantern from the old woman without thinking, studying her face in its glow. A small mole on her wrinkled cheek — the same one he'd seen as a child, on a woman outside the town bakery.
No name reminder in the prompt. No "here's what happened so far" summary I had to write myself. I only ever send one line per turn — "continue the story" — and the harness threads Luca, the brass key, the master's disappearance, all of it, into the next model's context automatically.
The architecture is smaller than you'd expect
I already run a similar multi-model app (an AI debate arena) on AgentCore Runtime, and that one needed a Python agent written with Strands, packaged, and deployed as its own service. Harness skipped that step entirely. It's fully managed — you
InvokeHarness directly from wherever your backend lives.So the whole thing is just:

Next.js on Vercel ├─ /api/state → read current round + votes from DynamoDB ├─ /api/vote → conditional update, only counts during voting └─ /api/advance → claims the round, calls InvokeHarness, saves the result │ ▼AgentCore Harness (one harnessArn, one runtimeSessionId) │ ▼Claude Sonnet 4.6 / Claude Opus 4.5 / Mistral Large 3 / Qwen3 VL 235BNo cron job runs the show. Whichever browser tab happens to be polling when the voting deadline passes fires the advance call, and a DynamoDB conditional write makes sure only one of them actually wins the race and calls the model. Everyone else's request just no-ops.
Three things that broke, and what I learned
IAM permission scoping was not where I expected it. The docs say
InvokeHarness needs both bedrock-agentcore:InvokeHarness and bedrock-agentcore:InvokeAgentRuntime . I assumed the second one applied to the underlying runtime resource the harness creates behind the scenes, so I scoped it there. Wrong — AWS checks it against the harness ARN itself. I only found this from the actual AccessDeniedException , not from re-reading the docs more carefully.Managed memory needs its own permissions, even though nobody told the execution role to use memory. Every harness gets a managed memory resource by default unless you turn it off, and the underlying agent loop calls
ListEvents against it on every turn. Skip that permission in your execution role and every single invocation dies with AccessDenied on an operation you never explicitly asked for.Not every model behaves the same inside a harness, even if it invokes fine on its own. I originally picked four models for variety: Claude Sonnet, Nova Pro, DeepSeek V3.2, and Llama 4 Maverick. Testing them one by one inside the actual harness (not just raw Bedrock Converse) turned up real problems — Nova Pro leaked its
<thinking> reasoning straight into the visible story text, DeepSeek V3.2 occasionally emitted stray special tokens at the start of its output, and Llama 4 Maverick failed outright with "this model doesn't support tool use in streaming mode," even though I never configured any tools. My best guess is the harness's Strands-based orchestration attaches some default tool scaffolding regardless, and Llama 4 just refuses it under streaming. I swapped in Mistral Large 3 and Qwen3 VL 235B instead, and both write clean.One bug I caught after deploying
Right after the first production deploy, I found two consecutive rounds in the transcript with identical text but different model labels — Mistral credited for a paragraph, then the exact same paragraph committed again under Claude a round later. My
commitRound DynamoDB write had no ConditionExpression , so nothing stopped a duplicate write from silently appending the same content twice under two different round numbers. I added a condition requiring the row's current round to still match what the writer expected before committing, so any duplicate or retried write now fails harmlessly instead of corrupting the transcript. Worth remembering: an "atomic claim" on one write doesn't protect the write that happens after it.Why this matters beyond a novelty demo
The interesting part isn't the relay novel — it's what the relay novel proves. If you're building anything that plans with a cheap, fast model and hands off to a stronger one for the hard part (or the reverse — draft with a big model, polish with a fast one), Harness removes the part where you'd normally serialize and replay message history by hand every time you switch. You just change one field in the next call.
I'll take a shortcut over hand-rolled context management every time I can get one for free.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article