Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Stop your Grok 4.5 agents from blowing past the context window

Long-running agents have a boring failure mode: they accumulate conversation until they hit the model's context window and fall over. xAI ships a fix for Grok 4.5 — a context-compaction endpoint — but you have to call it yourself, on the ri…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Long-running agents have a boring failure mode: they accumulate conversation until they hit the model's context window and fall over. xAI ships a fix for Grok 4.5 — a context-compaction endpoint — but you have to call it yourself, on the right cadence, and feed the result back in a very specific way.



grok-loop-kit does that for you.




npm install grok-loop-kit     # Node (CJS + ESM + types)
pip install grok-loop-kit # Python









The loop






import { GrokLoopClient } from 'grok-loop-kit';

const client = new GrokLoopClient(process.env.XAI_API_KEY!, {
compactEvery: 8, // compact every 8th turn...
compactAtTokens: 8000, // ...or when the rendered context crosses this
});

for (const turn of userTurns) {
const res = await client.sendMessage(turn, tools);
// res._grokLoopKit -> { turnsSinceCompact, estimatedTokensSaved, totalCompactions }
}






Every sendMessage appends the user turn, calls POST /v1/responses, and — when the turn count hits a boundary or the rendered context crosses your token budget — calls POST /v1/responses/compact and rebuilds the transcript from the result.






The gotcha that actually matters



xAI's compaction endpoint returns an item you must feed back into the next request's input verbatim:




{ "type": "compaction", "id": "cmp_…", "encrypted_content": "…" }






Not as a summarized user message — the exact item, unmodified. Get this wrong and you either lose context or corrupt the record. grok-loop-kit handles it (and still degrades gracefully against gateways/mocks that return a plain string).



Does compaction actually preserve information, or does it quietly forget? I tested it adversarially: plant five unguessable vault codes early, run enough turns to force four real compactions (dropping ~10 messages each), then demand exact recall.




✅ 5/5 exact codes recalled after 4 compactions






Since the codes are random, the model can only answer if the compacted encrypted_content genuinely carried them forward. It did.






Native LangGraph



GrokLoopChatModel is a real BaseChatModel, so it drops straight into a LangGraph agent:




import { GrokLoopChatModel } from 'grok-loop-kit/langgraph';
import { createReactAgent } from '@langchain/langgraph/prebuilt';

const model = new GrokLoopChatModel({
apiKey: process.env.XAI_API_KEY,
grokLoop: { compactEvery: 8, compactAtTokens: 120_000 },
});

const agent = createReactAgent({ llm: model, tools: [getWeather] });
const out = await agent.invoke({ messages: [new HumanMessage('weather in Tokyo?')] });






Because LangChain invokes a model with the full history each turn, the adapter compacts that history (a pure function of the incoming messages) rather than keeping a parallel transcript. Tool calls are parsed onto AIMessage.tool_calls. It's verified end-to-end against a live createReactAgent tool loop.



(One 1.0 lesson: extend BaseChatModel, not ChatOpenAI — on LangChain 1.x, ChatOpenAI.withConfig/bindTools clone into a plain ChatOpenAI and silently drop a subclass's _generate.)






Also in 1.0




  • Streaming (SSE) with a token callback

  • Retries with exponential backoff, honoring Retry-After

  • Per-call AbortSignal + request timeout


  • getState() / loadState() for durable, resumable agents

  • An AsyncGrokLoopClient for asyncio

  • 25 Node + 16 Python tests; MIT licensed






When does compaction help?



Compaction replaces the transcript with one dense record. That's a win once the raw transcript outweighs the record — i.e. long conversations. With tiny messages the record can cost more than it saves, so keep compactAtTokens realistic (thousands, not hundreds). It's a large-context optimization, and it keeps your agent inside the window indefinitely.






Repo: https://github.com/Booyaka101/grok-loop-kit · npm i grok-loop-kit



Built with the xAI context-compaction docs.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Stop your Grok 4.5 agents from blowing past the context window

Thematisch verwandte Begriffe: Stop, your, Grok, agents · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-18163 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick