The repository or configuration that created this release differ from a previous release. View details.
Adaptive Context Resolution
Multi-resolution data serialization for token-efficient LLM communication.
Overview
Adaptive Context Resolution enables data sources to serve information at multiple resolution levels, dramatically reducing token consumption when communicating with LLMs.
| Level | Name | Description | Typical Tokens |
|---|---|---|---|
| L0 | Existence | Boolean presence check | 1-3 |
| L1 | Summary | Natural language one-liner | 10-30 |
| L2 | Key Facts | Structured essential fields | 50-150 |
| L3 | Full Detail | Complete data | Unbounded |
Results: 88-96% token reduction vs JSON for typical workloads.
Installation
pip install adaptive-context-resolution
With optional dependencies:
pip install adaptive-context-resolution[tiktoken] # Accurate token counting
pip install adaptive-context-resolution[llm] # LLM-assisted summaries
Quick Start
from acp import ACPDocument, ResolutionLevel
# Your data
user = {
"id": "user-123",
"name": "Alice Chen",
"email": "alice@example.com",
"role": "Senior Engineer",
"department": "Platform",
"status": "active",
"skills": ["Python", "Go", "Kubernetes"],
"preferences": {"theme": "dark", "notifications": True}
}
# Create ACP document (auto-generates all levels)
doc = ACPDocument.from_dict(user, entity="user", id="user-123")
# Get data at different resolutions
doc.get(level=ResolutionLevel.L0_EXISTENCE) # "exists"
doc.get(level=ResolutionLevel.L1_SUMMARY) # "Alice Chen, Senior Engineer, Platform, active"
doc.get(level=ResolutionLevel.L2_KEY_FACTS) # {"name": "Alice Chen", "role": "Senior Engineer", ...}
doc.get(level=ResolutionLevel.L3_FULL) # Full data
# Or specify a token budget
doc.get(token_budget=50) # Returns highest level that fits
Token Counts
print(doc.token_counts)
# {'L0': 1, 'L1': 12, 'L2': 45, 'L3': 180}
Custom Level Generation
# Specify which fields matter for L2
doc = ACPDocument.from_dict(
data=user,
entity="user",
id="user-123",
key_fields=["name", "role", "email"],
summary_template="{name} <{email}>"
)
MCP Integration
from acp.mcp import ACPServer, acp_resource
server = ACPServer()
@server.resource("user", key_fields=["name", "role"])
def get_user(user_id: str) -> dict:
return database.get_user(user_id)
# Handle requests with resolution control
result = server.handle_request(
"user",
{"user_id": "123"},
level=ResolutionLevel.L2_KEY_FACTS
)
ACP Format Output
print(doc.to_acp_format())
@acp 1.0
@entity: user
@id: user-123
L0: exists
L1: "Alice Chen, Senior Engineer, Platform, active"
L2:
name: Alice Chen
role: Senior Engineer
department: Platform
status: active
L3:
{"id": "user-123", "name": "Alice Chen", ...}
@meta:
tokens: {L0: 1, L1: 12, L2: 45, L3: 180}
License
MIT License - see LICENSE for details.
Contributing
Contributions welcome! Please read our contributing guidelines.
Metadata
Release files for adaptive-context-resolution 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Change of provenance
The repository or configuration that created these release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| adaptive_context_resolution-0.1.1.tar.gz | 10.3 kB | With provenance | Details for adaptive_context_resolution-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| adaptive_context_resolution-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for adaptive_context_resolution-0.1.1-py3-none-any.whl |
Total release size: 23.0 kB
Release files / adaptive_context_resolution-0.1.1.tar.gz
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | adaptive_context_resolution-0.1.1.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d2798998c14ef52441d04ec7f3d62b20d07bccec932f65a97e3219d0e44ea17
|
|
BLAKE2b-256 checksum How to use checksums |
59c676e202e03c1e3dec2062e148257519c12d266782b512b79e14badd16501f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logRelease files / adaptive_context_resolution-0.1.1-py3-none-any.whl
Change of provenance
This file belongs to a release with changed provenance: the repository or configuration that created the release files differ from that of a previous release.
We recommend inspecting the repository and configuration before proceeding. View details.
| Download URL | adaptive_context_resolution-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22880b140a3c73a9da71665c503e24241655a7037c98eacd2a4f7962714dafcd
|
|
BLAKE2b-256 checksum How to use checksums |
eac0c1644543ffaaf21b3d6304b6dedb3ab8319c613caf1137e969993f4467a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logSecurity for adaptive-context-resolution 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Change of provenance
The repository and configuration that created this release differ from a previous release.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Repository
- Removed 0.1.0 github.com/bhansa/acp-protocol
- Added 0.1.1 github.com/bhansa/adaptive-context-resolution
Attestation for adaptive_context_resolution-0.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.