JavaScript
Objectives
Get objective diagnostics
Where an objective’s context window is going, component by component. The endpoint to reach for when a run costs more than it should.
GET
JavaScript
An agent that costs too much is almost always spending its window on something you did not expect: a tool set with three hundred tool definitions, a memory appendix nobody trimmed, a tool that returns a megabyte of JSON. This endpoint tells you which.
Everything reads zero before the first model call, because nothing has been assembled yet.
What to do with the answer:
Two different units, side by side
This is the thing to internalize before you build anything on this endpoint.contextLengthsvalues are character counts. Every one of them.inputTokensandcachedInputTokensare tokens.
systemPrompt: 41, right next to inputTokens: 660.
Characters rather than tokens is a deliberate choice: it stores the raw measurement, so the token estimate can improve without rewriting history. Divide the total by inputTokens if you want your model’s rough characters-per-token ratio.
What each component is
The interesting one is almost always
toolDefinitions. In the sample above, before the agent had said a single word, tool definitions were 1,246 characters against a 159-character prompt. Every objective pays that on every model call. That is what tool filters and progressive discovery exist to shrink.
The second most interesting is toolResults, which is what tool result clearing reclaims during compaction.
It only sees the current window
Diagnostics describe the objective’s live context window, and they grow as it runs:Use it to find the fat
Grab a healthy objective mid-run and rank the components. The one at the top is where your money is.toolDefinitionsdominates. Narrow the tool set with an include filter, or turn on progressive discovery so definitions load on demand.toolResultsdominates. EnabletoolResultClearingon the variation, or make the tool return less.skillsMemorydominates. Your manifest is too big. Split the layer, or tighten the entry descriptions.assistantMessagesdominates. The agent is thinking in circles. That is a prompt problem, not a config one.
cachedInputTokens tells you how much of the window the provider served from its prompt cache. A high number is good: the stable head of your prompt (system prompt, tool definitions) is being reused across turns rather than re-billed.
Related
List context windows
Per-window token counts, retained after the objective ends.
Preventing tool bloat
The fix when
toolDefinitions is eating your window.Create a variation
Compaction, tool result clearing, and the trigger threshold.
Compaction
What happens when the window fills anyway.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Example:
"workspace_01HXKD2E5NQM3T9AYWCF133E3Q"
The ID of the objective. Supports "external_id:" prefix for external IDs.
Example:
"obj_01HXKD2E5NQM3T9AYWCFQAZGFV"
Response
OK
Diagnostics from the objective's most recent iteration.