KDCube
← Engineering
KDCube Engineering · Deep Dive

The model input — what the agent receives, and where it comes from

One ordered block of input, assembled fresh for every call: a per-agent instruction envelope, tool and skill catalogs, a growing timeline, and a volatile tail — each part with a provenance.

22 June 2026Engineering9 minExperienceWorkshop Manual
model inputcontext layoutper-agent prefixtimelineinstruction envelopelive viewannounce

Every time an agent thinks, it receives exactly one thing: an ordered block of input. Not a database, not a session object — one stretch of text and content, read top to bottom, assembled fresh for that call. Everything the agent knows on that turn is in there, and everything in there came from a specific place.

This is the first of three entries about that input. Here we map its structure — the parts, in order — and the provenance of each part: who chose it, and why it sits where it sits. We won't cover how the input is kept warm and updated across calls (that's #2), or how the volatile tail at the very end is built (#3). Just the shape, and where the shape comes from.

THE THROUGH-LINE

The input is per agent. Our resident agent, ReAct, is not a single fixed prompt — an app can run several agents, and a different agent means a different instruction, a different tool set, a different skill set. The front of the input changes depending on which agent is being asked.

01The five parts, in order

Read top to bottom, the input has a stable front, a growing middle, and a volatile tail:

  1. the instruction envelope — who the agent is and how it must behave;
  2. the tool catalog — what it can call;
  3. the skill catalog — what it can run;
  4. the timeline — the running record of events, oldest → newest;
  5. the tail — sources and the live view, always last.

Parts 1–3 are the agent's identity and capabilities. They're stable and the same across many calls — which is exactly what makes them cacheable (more on that in #2). Part 4 grows as the conversation and the turn progress. Part 5 is recomputed every round and never cached. Let's take them one at a time.

02The instruction envelope — the per-agent prefix

The envelope is the very front of the input, and it's a stack of instruction layers, composed in a fixed order:

  • a runtime instruction — the non-negotiable operating protocol the runtime itself depends on, shared by every compatible agent;
  • the selected agent's instruction — the body that defines this agent's role and behavior;
  • an integration / domain instruction — what this app and its domain add on top;
  • optional custom suffixes — per-deployment or per-user additions.

This is where "per agent" becomes concrete. The runtime layer is shared, but the agent layer is not: ask agent A and you get A's instruction; ask agent B and you get B's. A different agent is, quite literally, a different prompt prefix. The same is true of a subagent — it's not a cheap continuation of the main agent, it brings its own envelope and starts its own story.

The envelope is assembled, not authored in one piece. An app can take the broad default body, pick a lighter named profile, or compose a specific set of named blocks — but whatever it picks, the runtime protocol is always prepended and the catalogs (next) are always appended. The order is fixed; the contents are the app's choice.

SINCE FIRST PUBLICATION

The agent instruction body has become a ladder of three signal-equivalent sizes — full (~27.7k tokens), lite (~10.6k), extra-lite (~7.9k) — and the profile is user-pickable per conversation, right next to the model picker. The envelope structure described here is unchanged; what varies is which body fills the agent layer. See One Agent, Three Instruction Sizes — Same Signals and Instruction profiles: a pickable brain-style for your agent.

The envelope is also computed from the agent's tool roster: capability teachings (code execution, rendering, web) render only when their tool is wired, and the reply protocol itself gains the code channel only with the exec tool present. How that conditioning works is its own entry.

03The tool catalog — what this agent can call

Right after the instruction body, the input lists the tools this agent can call — each with its name and how to use it. Importantly, in the current decision path these tools are rendered as text inside the envelope, not as a separate machine-readable tool schema. To the agent, the catalog reads like part of its instructions: "here is what's available to you right now."

The catalog is configured per agent. One agent might see web search, code execution, and memory; another might see only a document renderer. Two agents with the same instruction body but different tool sets are two different inputs. And because users (or the runtime) can sometimes choose which tools an agent gets, the catalog can differ between two runs of the same agent, too.

The catalog renders in a full or a compact form — a per-agent, user-overridable facet — and the difference is purely format: dense lines and no prose examples versus banner layout. Each tool's contract — purpose, every parameter description, the return description, the constraints — renders in full in both forms. A truncated description is a lost contract: the model acts on the missing half.

04The skill catalog — what this agent can run

Next, the skill catalog — the higher-level, composed capabilities the agent can invoke as a single unit. Same story as tools: rendered as text in the envelope, and configured per agent. The catalog tells the agent a skill exists; the agent loads the skill's detailed instructions only when it decides to use it.

Together, parts 1–3 are the stable, per-agent prefix: identity, then tools, then skills. Change any byte in here — a different agent, a custom suffix, a different tool selection — and you've changed the prefix. That's the seam that #2 cares about, because the prefix is the part worth caching.

05The timeline — the running record of events

Below the envelope comes the timeline: the conversation and the current turn, rendered as a stream of blocks, oldest at the top, newest at the bottom. This is the part that grows. It has three regions, in order:

  • History blocks — prior turns (the user's message, the agent's work, its answer), plus any summaries of older stretches that have been compacted away, plus preserved beacons (internal anchors the agent left for itself). This is "what happened before now."
  • Current-turn user blocks — the request that started this turn, plus any attachments.
  • Turn-progress blocks — everything the agent has done so far this turn: tool calls and their results, short progress notes, and any live user follow-ups or steers that arrived mid-turn. This region keeps growing as the turn advances, round by round.

The timeline is where provenance is richest. History comes from stored turn logs and a summary index, loaded at turn start. The current user blocks come from the incoming request. The progress blocks are written by the agents themselves as they work — each tool result the agent sees is a block it (or a helper) appended a moment earlier. The timeline is, in effect, the agent's own running notebook, read back to it each round.

06The tail — sources and the live view

Finally, always appended last, after the timeline:

  • an optional sources pool — the citable sources gathered this turn; and
  • the live view (we call it the announce) — the volatile, immediate signals the agent must not lose track of: current budget, live user interrupts, and a fresh projection of state that changes every round.

The tail is deliberately separate from everything above it. The front and the timeline are stable enough to cache; the tail is recomputed every round and is never cached. That's why fast-moving state lives here and not in the instruction envelope — putting volatile state up front would churn the stable prefix on every call. The live view is its own small structured world, and it's the subject of entry #3.

07The whole shape

ONE MODEL INPUT — READ TOP → BOTTOM Instruction envelope runtime instruction (shared by compatible agents) selected agent instruction (THIS agent → THIS prompt) integration / domain instruction · optional custom suffixes Tool catalog the tools this agent can call (text in the envelope) Skill catalog the skills this agent can run (text in the envelope) Timeline — oldest → newest oldest history blocks (prior turns · summaries · beacons) current-turn user blocks (request · attachments) turn-progress blocks (tool calls/results · notes · live steers) Tail — sources + the live view ALWAYS LAST sources pool (optional) live view / announce — the volatile, immediate signals per-agent prefix · stable grows oldest → newest volatile · recomputed each round stable per-agent prefix growing timeline volatile tail. The shape never changes — only which agent fills the front, how long the timeline has grown, and what the tail says this round.
One model input, read top → bottom: stable per-agent prefix, growing timeline, volatile tail.

The shape never changes — only which agent fills the front, how long the timeline has grown, and what the tail says this round.

08A small per-agent example

Two agents in the same app, same conversation, same user request:

SAME CONVERSATION, TWO AGENTS — THE FRONT IS KEYED TO THE AGENT front differs per agent front differs per agent Agent researcher runtime instruction (same) RESEARCHER instruction (differs) tools: web_search, fetch (differs) skills: source_triage (differs) Agent writer runtime instruction (same) WRITER instruction (differs) tools: doc_render (differs) skills: report_layout (differs) shared — same conversation underneath Timeline — oldest → newest same history, same request (shared) Tail — sources + live view RECOMPUTED · SHARED recomputed each round (shared) Two different inputs over one conversation — the timeline they share; the envelope and catalogs they don't.
Same conversation underneath, two different inputs — the front is keyed to the agent.

Same conversation underneath, but two different inputs — because the front is keyed to the agent. The timeline they share; the envelope and catalogs they don't.

09Where this goes next

That's the structure and the provenance: a stable, per-agent prefix of instructions and catalogs; a timeline that grows oldest → newest from stored history and in-turn work; and a volatile tail that's rebuilt every round.

Two follow-ups build on this map:

Read more

KDCube Engineering
22.06.2026 · updated 19.07.2026