Skip to content

API Reference parrot.tools.compression.levels

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.tools.compression.levels

View source

Compression filter levels for the tool-result compression pipeline.

Defines :class:FilterLevel, the ordered set of compression aggressiveness levels applied to tool results, and a small helper (:func:cap) used to clamp an effective level to a ceiling (e.g. capping lossy levels to MINIMAL when no :class:WorkingMemoryToolkit is available to recover teed payloads).

Class FilterLevel

Aggressiveness of tool-result compression.

Members are ordered from least to most aggressive. MINIMAL is the documented, conservative default (spec G2): only lossless transformations are applied when nothing else is configured.

Attributes:

Attribute Type Description
NONE Passthrough — no compression is applied.
MINIMAL Lossless only: JSON separator compaction, null-key elision, exact dedup. This is the default when nothing is configured (G2).
NORMAL Bounded lossy transformations: columnarization, grouping, long-field clipping with a recovery marker. Activates the working-memory tee.
AGGRESSIVE Structural summary only; the full body lives exclusively in working memory.

Function cap

Clamp level so it never exceeds ceiling.

cap(level: FilterLevel, ceiling: FilterLevel) -> FilterLevel

Parameter Type Default Description
level FilterLevel The level to clamp.
ceiling FilterLevel The maximum allowed level.

Returns: FilterLevel — level unchanged if it does not exceed ceiling; otherwise ceiling.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally