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.1.0.tar.gz (7.7 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.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyagent_compress-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for pyagent_compress-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b3c34225ef9bf6e1cbc2702c07b6f7adc9d9a9b98a20e582f0ce148066d2ca02
MD5 fc5b461f41fca7dc7b8096dfae65da22
BLAKE2b-256 01b96d139b89e72cc70aa0548c334fbb91980509a582d3c1cb6250c48bf2d8cd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyagent_compress-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2c7e28d5ee06a086a9c44fa9ad840cda72e8377b71227c470e88ba52ebcb227
MD5 a7f771df2a8ff7eba9f50034a93ed55e
BLAKE2b-256 860bddb8d73586455fe9dae254e892448ed835fc5e56a7b8c9a90110d99301a9

See more details on using hashes here.

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