Skip to main content

cap-shield

Context selection for AI agents. Measured, not estimated.

pip install cap-shield
from cap_shield import CapShield

cap = CapShield(api_key="cap_live_...")

cap.remember("support", "Customer reports a delayed parcel, order 4471")
ctx = cap.context("support", "what did the customer complain about?")

print(ctx.text)              # send this to your model
print(ctx.saving_pct, "%")   # how much you did not send
print(ctx.left_behind)       # ...and how many entries were left behind

What this does

Your agent's history grows every turn, and the whole thing is billed on every call. This selects what answers the question and leaves the rest.

Measured on our corpus with cl100k_base: 80.5 % of context not sent at a 1000-token budget. Measured on LongMemEval-S, 500 questions: 93.8 % retrieval recall against 51.9 % for word matching.

That second number is the one that matters. A saving is worthless if what was dropped is what your agent needed — so we publish both.

What this does not do

It does not call your model. ctx.text goes to Claude, GPT or whatever you use. This library never sees your model provider's keys.

It is not a proxy. Your uptime does not depend on ours for the model call itself.

Measure before you commit

No account needed:

CapShield(api_key="anything").measure(
    texts=["...your actual messages..."],
    query="what your agent would search for")

Runs on your own traffic and stores nothing.

Two mechanisms, deliberately separate

context() saves tokens — what your model is billed for. pack() saves bytes — bandwidth and storage. The packet is decompressed before the model sees it, so it saves no tokens.

Conflating them is the most common misunderstanding about this product.

Full documentation

https://cap-shield-robin.fly.dev/docs/quickstart

Download files

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

Source Distribution

cap_shield-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

cap_shield-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cap_shield-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for cap_shield-0.1.0.tar.gz
Algorithm Hash digest
SHA256 eea71fe2a582bc2dab3bdacd12054a940b1be1d895b96baf0cd105027ecf0185
MD5 aebbd3858849bab243888d73836ad410
BLAKE2b-256 33df50c7c97d1c0f60dc33f711bed291fee73793a735988e13f54ed0215f3717

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cap_shield-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for cap_shield-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e51667fb0cef32ff2e303fceedf32082d02c905ad7b944ec47a771a2188e940a
MD5 725fc749bd39d6405f043c2d052bd541
BLAKE2b-256 6a51b2b17f655b3b42b35b2ff5e5b5e88e8abaadf83738945e4382247ae1f5a0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.0

2 files

This release

0.1.0 This release

2 files

Supported by

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