Skip to main content

Inter-agent message compression and token budget management for multi-agent LLM systems

Project description

pyagent-compress

Inter-agent message compression and token budget management for multi-agent LLM systems. Reduce token costs without losing key information.

Install

pip install pyagent-compress

Components

  • MessageCompressor — Reduce message size by removing filler and ranking sentences
  • AgentPruner — Detect and remove non-contributing agents
  • InteractionPruner — Detect consensus and prune redundant rounds
  • TokenBudget — Enforce per-agent and per-workflow token limits
  • CompressMiddleware — Auto-compress agent outputs

Quick Example

from pyagent_compress import MessageCompressor, TokenBudget

compressor = MessageCompressor(target_ratio=0.5)
result = compressor.compress("Let me think about this... Basically, revenue grew 15%.")
print(f"Savings: {result.savings_pct:.0%}")

budget = TokenBudget(workflow_limit=50_000, per_agent_limit=10_000)
budget.consume("agent_a", 3000)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyagent_compress-0.2.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyagent_compress-0.2.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pyagent_compress-0.2.0.tar.gz.

File metadata

  • Download URL: pyagent_compress-0.2.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyagent_compress-0.2.0.tar.gz
Algorithm Hash digest
SHA256 941957a091dc1b0704aa229372253aac95edcaedeb2440e1af242848b74a9e8e
MD5 9ec67b4273d38d40f39590f04ed6ff45
BLAKE2b-256 12a1b2fe0119eaf6cd1e219f18e55481c747671798c13ed15eecb73e35dbd449

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_compress-0.2.0.tar.gz:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyagent_compress-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pyagent_compress-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 59fcb6de0fd9c2cc9be34f7c68899af8961b76869bc2c33f6ec297c69a0ff82e
MD5 6b26c20bd2b78bcab542a9cdf823174f
BLAKE2b-256 df40fb721fc047ff60b1e6d8ad2d3c9a3411cc4d460275e02c4bf3a6fae7902e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyagent_compress-0.2.0-py3-none-any.whl:

Publisher: publish.yml on pyagent-core/pyagent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page