The executive decision: cheaper context is not necessarily better context
A conversational data agent becomes useful when it can sustain a multi-step investigation. An executive might ask why gross margin fell, narrow the answer to a region, exclude a one-time contract, then request a comparison against the approved forecast. Each turn depends on earlier definitions, filters and decisions. Re-sending the entire exchange preserves continuity but consumes more input tokens as the conversation grows. Eventually, context-window limits, latency or cost can undermine the experience.
Snowflake introduced the Cortex Agents Compact API in Preview on September 21, 2026. The endpoint summarizes prior conversation history into a compact representation that can be supplied to later agent runs. That is an important engineering option, not an automatic guarantee of lower total spend or identical answers. A summary can omit a filter, misstate an exception or blur an approved business definition. The central management question is therefore not simply how many tokens can be removed. It is which information must survive for the next decision to remain trustworthy.
For a production analytics assistant, treat conversation compaction as a controlled state transition. Measure the quality of answers before and after compaction, define what must never be lost, and include the compaction operation itself in your cost calculation.
What the Compact API actually does
Snowflake’s documented endpoint is POST /api/v2/cortex/agent:compact. It produces a summary of earlier conversation turns. Subsequent requests to agent:run use that representation rather than replaying the full prior transcript. The feature supports two modes: an inline, stateless transcript and a persisted Snowflake thread. It returns a single JSON response rather than a stream.
The official Compact API documentation explains the request and continuation patterns, including thread boundaries, model selection, access control and usage reporting. The September 21 release note confirms the feature’s Preview introduction. Those are the authoritative sources for implementation details; do not assume the API is identical to general-purpose LLM summarization or to the separate Cortex Agent Run API.
The distinction matters because an agent conversation is not just prose. It may contain user instructions, earlier tool results, SQL interpretation, unresolved follow-ups and implicit business constraints. Compaction attempts to preserve useful context, but it is a summary, not an immutable ledger of every statement or query result.
Two operating modes, two different responsibilities
1. Inline compaction for applications that own the transcript
In stateless mode, the application sends a messages array to agent:compact. Snowflake returns a summary to the caller without persisting it to a thread. The application must then wrap that summary in a compaction content block and include it in a later agent:run request. This gives the application control over when to compact, what history to retain separately, and how to store or discard summaries.
This mode fits custom applications with their own session store, compliance retention policy or cross-channel conversation history. It also makes application-level mistakes possible: a client could accidentally prepend the wrong summary, reuse another user’s context, or discard recent un-compacted turns. The implementation needs explicit conversation IDs, tenant scoping, summary versioning and recovery rules.
2. Thread compaction for conversations stored in Snowflake
In stateful mode, the application supplies thread_id and optionally end_message_id. Snowflake reads the thread up to the selected boundary and persists a COMPACTION message. The response includes end_message_id. To continue, the next agent:run call uses parent_message_id set to that returned value; Snowflake folds the persisted summary into the conversation context.
This mode reduces the need for a client to reconstruct the summary manually, but the application still owns the decision to compact and the correctness of the continuation pointer. An incorrect boundary can leave the assistant without an important recent turn. Compaction does not delete original thread messages; original history remains available through the thread API, subject to access permissions.
A useful implementation rule is to keep one authoritative continuation pointer per active thread, update it atomically, and log the boundary selected for every compaction. Do not allow concurrent writers to silently advance different branches of the same business conversation.
What can get lost when history is compressed?
The most dangerous omissions are often small. Consider a revenue investigation in which the user said, ‘Exclude intercompany sales and use the board-approved exchange rate.’ A later compacted summary might preserve the subject and timeframe while omitting the exclusion. The next answer could be fluent, numerically plausible and wrong for the business decision.
Five classes of context deserve special protection. First, metric definitions: whether revenue is booked, billed or recognized; whether margins include freight; and which fiscal calendar applies. Second, active filters and exceptions: region, subsidiary, excluded products, one-time transactions and user-approved adjustments. Third, source provenance: the table, semantic model, document or query used for the prior answer. Fourth, open tasks: unresolved questions, pending comparisons and user corrections. Fifth, authorization boundaries: which user, role and tenant are allowed to see the underlying data.

Do not ask a free-form summary to serve as the sole source of truth for those facts. Keep authoritative metric definitions in a governed semantic layer, preserve query IDs and data snapshots where appropriate, and reapply access controls to every subsequent tool call. Compaction can help maintain conversational continuity, but it cannot substitute for a reliable data model or permission system.
A practical architecture for governed analytics agents
A robust design separates four layers. The conversation layer holds the user turns, recent assistant responses and compaction state. The business-context layer holds durable metric definitions, approved dimensions, fiscal calendars and organization-specific rules. The evidence layer records tool calls, query identifiers, source references and result timestamps. The governance layer enforces identity, role-based access, retention and audit policies. Only the conversation layer should depend primarily on a generated summary.
Teams building governed dashboards and semantic definitions can anchor the agent to a consistent reporting foundation rather than hoping the conversation history reconstructs business logic. Actiknow’s business intelligence consulting and data integration services describe the relevant implementation disciplines: source integration, modeling, dashboard delivery and maintenance.

An application should attach a compacted summary to the correct session, then rehydrate essential structured state before invoking the agent. For example, keep a typed object containing fiscal_period=’FY2026-Q3′, metric=’recognized_revenue’, currency=’USD’, excluded_entities=[‘intercompany’], and approved_definition_version=’v4′. These are illustrative application fields, not parameters promised by the Snowflake API. They can be validated independently of the generated summary.
For custom interfaces and workflow orchestration, the integration design is as important as the model call. Actiknow’s custom software and integration services describe web applications, API integrations and database setup, which are relevant capabilities when a business needs to embed an agent into an existing product or operational process.
A controlled implementation sequence
Step 1: Establish a no-compaction baseline
Choose realistic sessions with five, ten, twenty and more turns. Include short follow-ups, changing filters, references to earlier tables, user corrections and contradictory instructions. Capture each question, the approved expected answer, relevant SQL or tool evidence, input and output token counts, elapsed time and credit consumption. Without this baseline, an apparent cost improvement may simply reflect shorter or lower-quality responses.

Step 2: Define when to compact
Trigger compaction based on measured context growth, predicted context-window pressure or an application policy after a completed assistant turn. A fixed every-N-turn rule is simple but can waste credits on short conversations and delay compaction for tool-heavy turns. A threshold based on estimated tokens plus a safety margin is usually more defensible. The correct threshold depends on the selected model, agent configuration and workload, so test it rather than copying an arbitrary number.
Step 3: Preserve structured state outside the summary
Store the active question, approved metrics, time range, filters, data access scope, source IDs and outstanding actions in application-controlled records. Treat the summary as a narrative aid. If a user changes a filter, update structured state first, then continue the agent. If a summary conflicts with the structured state, the application should resolve the conflict or ask for clarification rather than silently choosing one.
Step 4: Compact and continue using the documented API contract
For inline mode, send the existing transcript to agent:compact and place the returned summary in a compaction content block in the next agent:run messages. For thread mode, supply thread_id, capture the returned end_message_id, and set it as parent_message_id for continuation. Snowflake documents that supplying both messages and thread_id gives precedence to thread_id. Stateless input also has conversation-order requirements. Validate request schemas and error paths against the current API reference.
Step 5: Run semantic regression tests
Replay the same follow-up prompts with and without compaction. Score factual correctness, filter retention, metric-definition fidelity, source traceability, permission compliance and the agent’s ability to say when evidence is missing. A binary pass/fail score for critical errors is more useful than a single average quality number. If a summary drops an exclusion that changes a financial total, the session fails even if the prose is otherwise excellent.
Step 6: Deploy with observability and rollback
Record each compaction event, conversation ID, mode, model, boundary, token counts, credits, duration, summary version and subsequent evaluation outcome. Store sensitive content only where policy allows. Use a feature flag or configuration switch so selected users can fall back to full-history context if quality regresses. Maintain a rollback procedure that restores a known conversation checkpoint without confusing users about what the agent remembers.
How to calculate whether compaction saves money
A lower token count on the next run does not automatically mean lower total cost. The compaction call consumes tokens and is billed. The economic comparison is total session cost, including compaction operations, subsequent agent calls, tool usage where applicable, and the operational cost of failed or repeated answers.
Use this conceptual calculation: net session savings = baseline session AI credits minus (compacted-session AI credits + compaction AI credits). Then separately track human review, retries and incidents. Snowflake states that agent:compact calls are billed at the model’s applicable AI Credits per million tokens processed. Usage appears in CORTEX_AGENT_USAGE_HISTORY with the origin application ‘compaction’, allowing teams to separate this activity from ordinary agent runs.

A useful measurement table contains: session length; total input and output tokens; number of compactions; compaction credits; run credits; end-to-end latency; correct-answer rate; critical-context-loss rate; and user correction rate. Report medians and tail values, not only averages. High-volume support assistants and occasional executive research sessions may produce very different economics.
Avoid a universal savings percentage. A conversation that ends immediately after compaction may never recover the cost of the summary. A long, repetitive session with many subsequent turns may benefit substantially. The crossover point is workload-specific and should be established using representative sessions and current Snowflake pricing.
Security and governance requirements that do not disappear
Compaction is not a security boundary. The agent must still enforce the caller’s access rights when retrieving data or invoking tools. Snowflake documents that Cortex Agents API calls require the relevant Cortex user or agent-user database role, and thread compaction additionally depends on thread user-based access control. Application owners should verify the effective role and ownership model before allowing cross-team access to conversations.
A summary can carry sensitive facts even if it is shorter than the source transcript. Apply the same classification, retention, access and deletion policies to compacted context as to the original conversation. Never place one customer’s summary into another customer’s session. Avoid logging raw summaries in general application telemetry when the conversation may include personal or confidential information.
Because thread compaction does not delete original messages, do not treat it as a data minimization or retention mechanism. A compliance requirement to delete conversation history needs a separate documented process. Similarly, a compacted summary is not an audit-quality replacement for original messages, executed SQL, source versions or user approvals.
Failure modes worth testing before launch
Test summary drift after repeated compactions: a condition that survives the first summary may disappear after the third. Test corrections: when a user says a prior figure was wrong, the next answer must use the corrected definition. Test branching: two users or two tabs may continue from different parent messages. Test a compact call that succeeds while the client times out, and ensure retries do not create confusing continuation state. Test long tool results, empty or malformed histories, expired credentials, unauthorized thread access and a model change between compaction and continuation.
Snowflake recommends using the same model for compaction and subsequent agent runs when a model is specified. That is a useful starting point for consistency testing, not a substitute for evaluating output. The endpoint does not stream, so the user experience should account for a distinct compaction wait. An application can communicate that it is preparing conversation context without implying the agent has completed its analysis.
An illustrative business investigation
Imagine a regional finance leader asks an agent to explain a quarterly decline in operating margin. The first turns establish a fiscal quarter, a reporting currency, a region and an exclusion for one-off restructuring costs. The agent retrieves several views and offers a provisional answer. The user then asks to compare the result with a prior forecast and explain which product categories changed.
Without compaction, the application may keep sending the complete transcript, including repeated tool outputs. With compaction, the conversation summary may reduce repeated context. But the implementation should still load the approved margin definition, retained filters, forecast version and source identifiers from structured records. A test passes only if the compacted conversation produces the same materially correct interpretation and can identify its evidence.
This is a hypothetical design example, not a claim that Actiknow or any named customer has deployed this architecture. It illustrates the difference between preserving the flow of a conversation and preserving the meaning of a financial decision.
A 30-day evaluation plan
Week 1
Inventory agent use cases and current session lengths. Define the business-critical fields that must survive, map permissions and choose 30 to 50 representative conversations spanning simple and difficult scenarios. Establish expected answers and a cost baseline.
Week 2
Implement inline or thread-based compaction in a non-production environment. Add event logging, stable session identifiers, structured context storage, error handling and a continuation pointer. Verify the API behavior against the current Snowflake documentation.
Week 3
Run side-by-side regression tests with compaction enabled and disabled. Include multi-turn calculations, user corrections, ambiguous pronouns, access changes and repeated compactions. Review critical failures with data owners and improve the design before considering cost savings.
Week 4
Pilot with a limited user group, monitor credits and latency, and document rollback. Set explicit release criteria, such as zero unauthorized data disclosures, zero critical metric-definition losses in the test set, and a measured economic benefit for the target workload. These are suggested acceptance criteria, not published platform guarantees.
Executive scorecard: what to monitor in production
Quality: percentage of follow-up answers matching approved business definitions; number of critical context omissions; frequency of user corrections; evidence traceability. Reliability: compaction error rate; failed continuations; stale or conflicting parent pointers; recovery time. Economics: total AI credits per completed session, compaction share of credits, latency at the 95th percentile and cost per correct answer. Governance: unauthorized access attempts, retention exceptions and audit completeness.
Assign owners to each measure. The data team owns metric definitions and test evidence; the application team owns session orchestration and failures; security owns access and retention; the product owner decides whether the experience is sufficiently reliable for business users. No single dashboard metric should overrule a critical security or financial-correctness failure.
When to adopt and when to wait
Adopt a controlled pilot when your agent has genuinely long conversations, a clear business value, and an evaluation harness capable of catching missing constraints. The API is particularly relevant when users repeatedly build on earlier analysis and the cost of replaying full history is measurable.
Wait or limit rollout when most conversations are short, the semantic layer is weak, access boundaries are unclear, or the team cannot test answer consistency. A compacted conversation can make an unreliable assistant less expensive to run while leaving the underlying reporting problem unsolved. Also account for Preview status: implementation details, availability and behavior may change.

Frequently asked questions
Is the Cortex Agents Compact API generally available?
No. Snowflake’s documentation currently labels it an Open Preview feature. Review the live documentation and account-specific constraints before production use.
Does compaction delete the original conversation?
No. Snowflake says thread compaction preserves the original messages. The summary is used for subsequent agent context, but the history remains accessible through the thread API according to permissions.
Can it work without Snowflake threads?
Yes. Inline mode accepts a messages transcript and returns a summary to the caller without persisting it. The application then carries the compaction content block into the next agent run.
How do I continue a thread after compacting?
Use the returned end_message_id as parent_message_id on the next agent:run request for that thread. Validate the boundary and handle concurrent session updates.
Does a smaller context always reduce total AI credits?
No. The compact call itself is billable. Compare total credits across the complete session, including subsequent turns, before declaring savings.
Will the summary preserve every filter and definition?
Not reliably enough to assume so. Keep critical business constraints in structured state and test for omissions, corrections and conflicting definitions.
Can I use a different model to summarize?
The API supports a model parameter and can auto-select one. Snowflake recommends using the same model as the corresponding agent runs when specifying a model. Evaluate any alternative before adoption.
Where can I see compaction costs?
Snowflake documents compaction usage in CORTEX_AGENT_USAGE_HISTORY under the ‘compaction’ origin application. Confirm current pricing and available usage fields in your account.
Is a compacted summary an audit record?
No. Preserve original conversations, query evidence, approvals and source references under your organization’s audit and retention policies.
What is the minimum viable pilot?
Use one governed analytics workflow, a representative set of multi-turn sessions, explicit critical-context checks, full-session cost measurement and a tested fallback to uncompacted history.
The bottom line
Snowflake Cortex Agents Compact API gives engineering teams a practical way to manage growing conversation history. Its value comes from retaining enough context for accurate follow-up decisions while reducing unnecessary repetition. The safest design preserves governed business definitions and evidence outside the summary, tests context fidelity under real workloads, and compares total session economics rather than isolated token counts.
If your organization is planning an analytics agent or connecting conversational workflows to governed enterprise data, Actiknow can help assess the data modeling, integration and application requirements. Discuss your use case with the Actiknow team before choosing an implementation approach.
Further reading and product documentation
Snowflake’s September 21, 2026 feature release note and Compact API guide are the primary references for endpoint behavior, Preview status, request modes and usage tracking. Review them again before implementation because Preview contracts can evolve.

