Skip to content

Commit 9e02ec4

Browse files
kevin-dpclaude
andcommitted
docs(agents): trim the breakdown comments (schema + adapter)
Tighten the `context_breakdown` column comment and the tokenBreakdown intro to be brief and to the point. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 2379394 commit 9e02ec4

2 files changed

Lines changed: 7 additions & 13 deletions

File tree

packages/agents-runtime/src/entity-schema.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,8 @@ type StepValue = {
165165
context_input_tokens?: number
166166
// The model's context window for this step.
167167
context_window?: number
168-
// JSON-encoded estimate of how the prompt decomposes across the stable
169-
// request parts — `{ system, tools }` token counts (approximate; char/4).
170-
// The UI derives the remaining "messages" bucket as the real cache-inclusive
171-
// total minus these, so the breakdown always sums to the gauge. Optional and
172-
// additive; older events without it stay valid.
168+
// JSON estimate of the prompt's stable parts — `{ system, tools }` token
169+
// counts (char/4). The UI derives "messages" as the real total minus these.
173170
context_breakdown?: string
174171
}
175172
type TextValue = {

packages/agents-runtime/src/pi-adapter.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -314,17 +314,14 @@ export function createPiAgentAdapter(
314314
const modelContextWindow =
315315
typeof model.contextWindow === `number` ? model.contextWindow : 0
316316

317-
// Approximate token cost of the stable, non-message request parts. These
318-
// are constant for the whole call, so estimate once and persist on each
319-
// step; the UI derives the "messages" bucket as the real cache-inclusive
320-
// total minus these (see token-accountant computeContextBreakdown).
317+
// Stable request parts (constant for the call), estimated once and persisted
318+
// per step; the UI derives "messages" as the real total minus these.
321319
const tokenBreakdown = {
322320
system: approxTokens(opts.systemPrompt),
323321
// Serialize first: approxTokens' array branch charges a flat ~64 per
324-
// non-text block, so passing the AgentTool[] directly would estimate
325-
// ~64×toolCount regardless of the real schema size. JSON.stringify
326-
// captures each tool's name + description + parameter schema (functions
327-
// drop out), which is what actually occupies the prompt.
322+
// non-text block, so the raw AgentTool[] would estimate ~64×toolCount
323+
// regardless of real schema size. JSON.stringify captures each tool's
324+
// name + description + parameter schema, which is what fills the prompt.
328325
tools: approxTokens(JSON.stringify(opts.tools)),
329326
}
330327

0 commit comments

Comments
 (0)