Meta tags:
description= Compressed inter-agent context sharing. Reduce token usage by ~80% when agents hand off to each other.;
Headings (most frequently used words):
key, sharedcontext, quick, start, api, configuration, framework, examples, how, it, works, put, content, agent, get, full, stats, keys, and, clear, crewai, langgraph, openai, agents, sdk, on, this, page,
Text of the page (most frequently used words):
ctx (30), full (20), get (18), #sharedcontext (18), stats (16), agent (15), headroom (12), entry (12), the (11), put (10), compression (10), const (10), compressed (9), research (9), content (8), for (8), findings (8), agents (7), true (7), msg (6), context (6), sdk (5), and (5), key (5), memory (5), original (5), import (5), from (5), researcher (5), entries (5), when (5), python (5), typescript (5), tokens (5), works (4), configuration (4), keys (4), api (4), code (4), json (4), pipeline (4), version (4), gets (4), how (3), openai (3), framework (3), clear (3), failure (3), what (3), with (3), text (3), smartcrusher (3), proxy (3), stores (3), returns (3), messages (3), return (3), def (3), summary (3), state (3), details (3), demand (3), output (3), oldest (3), ttl (3), default (3), token (3), all (3), langgraph (2), crewai (2), examples (2), quick (2), start (2), learning (2), across (2), persistent (2), kompress (2), codecompressor (2), under (2), compress_handoff (2), coder (2), result (2), task (2), after (2), moves (2), between (2), maxentries (2), evicts (2), 100 (2), hour (2), 3600 (2), counting (2), claude (2), sonnet (2), 20250929 (2), model (2), new (2), savings_percent (2), 48000 (2), 12000 (2), 60000 (2), savingspercent (2), nonexistent (2), missing (2), 20k (2), router (2), transforms (2), 000 (2), await (2), compresses (2), using (2), needs (2), smaller (2), large (2), hand (2), off (2), each (2), other (2), architecture (2), reference (2), server (2), cache (2), reversible (2), this, page, offline, analysis, coding, analyzes, past, sessions, finds, went, wrong, correlates, fixed, writes, project, level, learnings, hierarchical, temporal, llm, applications, enable, your, remember, conversations, intelligent, scoping, versioning, modernbert, based, passthrough, ast, aware, arrays, routes, best, compressor, hood, calls, same, used, compress, input_filter, handoff, 1000, len, write_code, coder_node, research_summary, do_research, researcher_node, coder_context, researcher_task, raw, completes, agnostic, anywhere, expire, seconds, reached, evicted, max_entries, lists, non, expired, removes, total_tokens_saved, total_compressed_tokens, total_original_tokens, totaltokenssaved, totalcompressedtokens, totaloriginaltokens, aggregated, statistics, none, null, retrieve, compressed_tokens, original_tokens, big_json_output, 4000, compressedtokens, 20000, originaltokens, bigjsonoutput, store, automatically, big_research_output, bigresearchoutput, replayed, typically, saving, handoffs, open, copy, markdown, inter, sharing, reduce, usage, troubleshooting, error, handling, help, limitations, benchmarks, simulation, metrics, monitoring, observability, mcp, tools, litellm, strands, agno, langchain, anthropic, vercel, integrations, management, optimization, ccr, log, image, community, savings, installation, quickstart, introduction, getting, started, search,
Text of the page (random words):
sharedcontext headroom headroom headroom search k getting started introduction quickstart installation community savings compression how compression works smartcrusher code compression image compression text log compression reversible compression reversible compression ccr cache context cache optimization context management memory persistent memory sharedcontext failure learning proxy server proxy server integrations vercel ai sdk openai sdk anthropic sdk langchain agno strands litellm mcp tools configuration configuration observability metrics monitoring simulation api reference api reference architecture architecture benchmarks limitations help error handling troubleshooting sharedcontext sharedcontext compressed inter agent context sharing reduce token usage by 80 when agents hand off to each other copy markdown open when agents hand off to each other context gets replayed in full sharedcontext compresses what moves between agents using headroom s compression pipeline typically saving 80 of tokens on agent handoffs quick start typescript python import sharedcontext from headroom const ctx new sharedcontext agent a stores large output const entry await ctx put research bigresearchoutput agent researcher agent b gets compressed version 80 smaller const summary ctx get research agent b needs full details on demand const full ctx get research full true from headroom import sharedcontext ctx sharedcontext agent a stores large output ctx put research big_research_output agent researcher agent b gets compressed version 80 smaller summary ctx get research agent b needs full details on demand full ctx get research full true api put key content agent store content under a key compresses automatically using headroom s full pipeline smartcrusher for json codecompressor for code kompress for text typescript python const entry await ctx put findings bigjsonoutput agent researcher entry originaltokens 20000 entry compressedtokens 4000 entry savingspercent 80 0 entry transforms router json 0 20 entry ctx put findings big_json_output agent researcher entry original_tokens 20 000 entry compressed_tokens 4 000 entry savings_percent 80 0 entry transforms router json 0 20 get key full retrieve content returns the compressed version by default or the original with full true typescript python const compressed ctx get findings 4k tokens const original ctx get findings full true 20k tokens const missing ctx get nonexistent null compressed ctx get findings 4k tokens original ctx get findings full true 20k tokens missing ctx get nonexistent none stats aggregated statistics across all entries typescript python const stats ctx stats stats entries 3 stats totaloriginaltokens 60000 stats totalcompressedtokens 12000 stats totaltokenssaved 48000 stats savingspercent 80 0 stats ctx stats stats entries 3 stats total_original_tokens 60000 stats total_compressed_tokens 12000 stats total_tokens_saved 48000 stats savings_percent 80 0 keys and clear keys lists all non expired keys clear removes all entries configuration typescript python const ctx new sharedcontext model claude sonnet 4 5 20250929 for token counting ttl 3600 1 hour default maxentries 100 evicts oldest when full ctx sharedcontext model claude sonnet 4 5 20250929 for token counting ttl 3600 1 hour default max_entries 100 evicts oldest when full entries expire after ttl seconds when maxentries is reached the oldest entry is evicted framework examples sharedcontext is framework agnostic it works anywhere context moves between agents crewai from headroom import sharedcontext ctx sharedcontext after researcher task completes ctx put findings researcher_task output raw coder task gets compressed context coder_context ctx get findings langgraph from headroom import sharedcontext ctx sharedcontext def researcher_node state result do_research ctx put research result return research_summary ctx get research def coder_node state compressed summary in state full details on demand full ctx get research full true return code write_code full openai agents sdk from headroom import sharedcontext ctx sharedcontext def compress_handoff messages for msg in messages if len msg content 1000 ctx put msg id msg content msg content ctx get msg id return messages handoff agent coder input_filter compress_handoff how it works under the hood put calls headroom compress the same pipeline used by the headroom proxy and stores the original in memory get returns the compressed version get full true returns the original the compression pipeline routes content to the best compressor json arrays smartcrusher 70 95 compression code codecompressor ast aware text kompress modernbert based or passthrough persistent memory hierarchical temporal memory for llm applications enable your ai to remember across conversations with intelligent scoping and versioning failure learning offline failure analysis for coding agents analyzes past sessions finds what went wrong correlates with what fixed it and writes project level learnings on this page quick start api put key content agent get key full stats keys and clear configuration framework examples crewai langgraph openai agents sdk how it works
|