Skip to content

[ApexAgents] Add a context window setting for Stirrup summarization - #3742

Open
Kh4L wants to merge 2 commits into
arti/apexagentsfrom
spanev/apex-stirrup-context-window
Open

Kh4L wants to merge 2 commits into
arti/apexagentsfrom
spanev/apex-stirrup-context-window

Conversation

@Kh4L

@Kh4L Kh4L commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

Stirrup's ChatCompletionsClient(max_tokens=...) is both the per-request output cap (sent as max_completion_tokens) and the context window the agent uses to decide when to summarize (token_usage.total / client.max_tokens, at 70%). The Apex agent passes max_output_tokens (32768), so Stirrup summarizes at ~23k tokens whatever the policy's context window is. On long tasks the agent then loops read -> summarize -> re-read until it reaches the turn cap.

  • stirrup_runtime.py: context_window_client() subclasses the Stirrup client and overrides only the max_tokens property, so summarization uses the configured window while requests keep max_completion_tokens = max_output_tokens.
  • app.py, configs/apex_agent.yaml: context_window_tokens (apex_agent_context_window_tokens), unset by default, which keeps the current behavior.
  • README and tests.

With a 262k-context policy and apex_agent_context_window_tokens: 262144, the first summary moves from ~23k tokens to ~185k.

#3668 changes the same client setup; this commit rebased onto it is on spanev/apex-context-window-on-prebuilt-world.

Signed-off-by: Serge Panev <spanev@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Sep 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@yaoyu-33 yaoyu-33 added area:agent Agent harnesses and Responses API agent behavior complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer labels Sep 28, 2026
…st placeholders

Signed-off-by: Serge Panev <spanev@nvidia.com>
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Sep 29, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:agent Agent harnesses and Responses API agent behavior complexity:low Localized change in one scope with a small, straightforward review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants