# OpenAI 12-Hour Prompt Caching: Stop Truncating Agent Context > OpenAI's 12-hour prompt cache eliminates the need to cut context to save costs. Locking core business rules into a cached base cuts costs and boosts stability. Source: https://www.starbox.work/en/insights/ai-news/2026-10-21-openai-12h-prompt-caching-agents/ (Starbox AI Insights, updated 2026-10-21) On October 21, 2026, OpenAI announced that an optional 12-hour prompt cache window is now available via its API. Tibo from OpenAI also confirmed that caches for authenticated users in Codex and Work persist indefinitely, guaranteeing cache hits even when resuming sessions hours later. This 12-hour prompt caching update directly alters the unit economics of enterprise AI agents. I am Xiaoxing from Starbox AI, and here is what this shift means for teams running AI in production. A founder running an export business for precision industrial hardware once walked me through their customer support challenge. Overseas buyers typically responded with three- to four-hour gaps due to time zone differences. To keep API bills down, the engineering team set an aggressive timeout to flush the agent's context. The result was counterproductive. Every time an overseas buyer replied to an email, the agent had to reload tens of thousands of words across product catalogs, troubleshooting checklists, and API schemas. Instead of saving money, full input fees were incurred repeatedly, and the agent frequently asked questions it had already resolved in previous turns. The buyer experience suffered as a consequence. ## Why 12-Hour and Permanent Caching Reshapes Agent Economics Under earlier prompt caching setups, caches expired quickly once an agent went idle. If an internal workflow or customer communication paused past that brief window, the cache evicted. The next API call had to re-process and pay full price for the entire context, keeping agent inference costs high. With a 12-hour window, an agent that operates on intermittent intervals throughout the workday can reuse shared instructions, schemas, and historical context while benefiting from discounted cached input pricing. For logged-in Codex and Work users, session caches do not expire at all. Many engineering teams operated under an outdated rule of thumb: shorter prompts save money. They aggressively trimmed system instructions, truncated conversation history, and split knowledge bases into micro-chunks. That approach may have saved fractions of a cent under older pricing models, but it destroyed logical continuity and forced models to guess missing context. With 12-hour and indefinite caching, the optimal financial strategy is reversed: you should place your complete, unedited SOPs, API contracts, and brand manuals directly into the prompt prefix and let the provider lock them into cache. ## Long-Context Optimization: Building a Resident Prompt Base Because the caching window now covers half a day, engineering workflows need to shift from assembling fragmented prompts on the fly to managing structured, layered context. The core rule of long-context optimization is strict separation: keep unchanging reference material at the front, and push variable interaction data to the back. Large language models match cached tokens sequentially from index zero. Placing static content first ensures maximum cache utilization. | Prompt Layer | Content Included | Update Frequency | Caching Strategy | | :--- | :--- | :--- | :--- | | **Layer 1: Business Foundation** | Brand positioning, industry terminology, output formatting constraints, safety rules | Very low (weekly or monthly) | Reused all day; hits 12-hour or permanent cache | | **Layer 2: Tooling Contracts** | JSON schemas for external APIs, action function signatures, validation logic | Low (updated during system deployments) | Placed immediately behind Layer 1; shared across agents | | **Layer 3: Task SOPs** | Workflow decision trees, standard troubleshooting steps, multi-phase execution guides | Medium (adjusts with internal policy updates) | Cached in batches by task category | | **Layer 4: Dynamic Session Data** | User queries, run-time parameters, real-time tool outputs, execution logs | High (changes every turn) | Billed at standard input rates; excluded from prefix cache | ## Checklist: Refactoring Your Agent's Resident Cache Layer If your team is running production agent workflows, review your API architecture against this checklist: - [ ] **Verify static prefix length**: Confirm that your business foundation and tool schemas meet the minimum [Token](/en/glossary/token/) threshold required to trigger provider caching. - [ ] **Standardize prefix sequence**: Ensure the initial 80% of instructions, formatting requirements, and schema definitions are completely identical across all agent calls. Do not prepend dynamic values like timestamps or randomized request IDs to the prompt. - [ ] **Decouple tool schemas from execution results**: Keep function definitions inside the static prefix, and append raw tool execution outputs to the dynamic section at the end of the payload. - [ ] **Align caching policies to operational cycles**: Configure customer service tickets, [sales lead](/en/glossary/sales-lead/) qualification queues, and multi-stage approval processes to use the 12-hour cache mode. - [ ] **Track cache hit rates**: Extract cache hit metrics from API response headers. If hit rates drop, audit your deployment pipelines to ensure frontend code is not introducing dynamic variations into the prefix. ## Observations from Starbox AI Across our work deploying AI systems for over 500 enterprises, marketing and operations teams regularly run into cost inflation and latency spikes caused by multi-turn revisions. Inside Starbox Content Factory, our system relies on structured [brand knowledge base](/en/glossary/brand-knowledge-base/) assets and topic libraries. Specialized writing agents generate cross-platform content across nine distinct narrative perspectives—covering primary brand messaging, third-party endorsements, and broader market context. Orchestrating these agents at scale requires continuous access to standardized brand knowledge. When underlying models expand cache retention to 12 hours, systems that rely on deep brand repositories can sustain high-frequency, long-cycle agent workflows at significantly lower infrastructure costs. Reducing production time from two to four hours down to five to ten minutes per asset depends on this foundation: stable, structured context permanently accessible to the model, rather than forcing it to reconstruct requirements on every call. Longer prompt cache retention looks like an infrastructure discount on the surface. In practice, it shifts how production AI systems should be engineered. Fragile, fragmented prompt chains that constantly purge context are no longer cost-effective. Organizations that codify their operational playbooks into comprehensive, resident prompt foundations will operate with lower costs and significantly fewer execution errors.