This release is a pre-release and may not be stable for production use.
Swarmauri Compacting Conversation
Keep a rolling summary of older conversation turns while retaining recent messages for the next model request. Supports Python 3.10 through 3.14.
Features
- Plans compaction for complete user turns and preserves the newest configured turns.
- Keeps leading system and developer instructions verbatim and checks that tool results match their calls before selecting an older turn.
- Previews compacted context and refuses to apply a stale plan.
Installation
uv add --prerelease allow swarmauri_conversation_compacting
pip install --pre swarmauri_conversation_compacting
Usage
from swarmauri_conversation_compacting import CompactingConversation
from swarmauri_standard.messages.AgentMessage import AgentMessage
from swarmauri_standard.messages.HumanMessage import HumanMessage
conversation = CompactingConversation(keep_recent_turns=1)
conversation.add_messages([
HumanMessage(content="Use Python 3.12 for this project."),
AgentMessage(content="I'll target Python 3.12."),
HumanMessage(content="What should the project metadata say?"),
])
plan = conversation.plan_compaction()
if plan is not None:
# In an application, summarize plan.previous_summary and plan.older_messages.
conversation.apply_compaction(plan, "The project targets Python 3.12.")
The model-facing history includes the rolling summary. Applying a plan removes the summarized messages from messages. Archive the original messages separately if your application needs a complete transcript.
Agents using AgentCompactionMixin supply sync and async summarization methods. An adopting agent can set trigger_tokens on the conversation and call compact_if_needed() or acompact_if_needed() before dispatch. Supply a token counter for the request format and include any current instructions and tool definitions.
Metadata
Release files for swarmauri_conversation_compacting 0.1.0.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swarmauri_conversation_compacting-0.1.0.dev0.tar.gz | 6.4 kB | Without provenance | Details for swarmauri_conversation_compacting-0.1.0.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_conversation_compacting-0.1.0.dev0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_conversation_compacting-0.1.0.dev0-py3-none-any.whl |
Total release size: 14.7 kB
Release files / swarmauri_conversation_compacting-0.1.0.dev0.tar.gz
| Download URL | swarmauri_conversation_compacting-0.1.0.dev0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57772701b57bac50c50b48f49612bb00368186c88745b429841a8e796309ade8
|
|
BLAKE2b-256 checksum How to use checksums |
0ee27159a7eb4be8d4ef8843b9095ee0056cc5e41a484f072c60aa4d161710d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_conversation_compacting-0.1.0.dev0-py3-none-any.whl
| Download URL | swarmauri_conversation_compacting-0.1.0.dev0-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ed722c287bcdbfeb1a66475a1af46d7834849a6b6a69d3683bbe8d75d489928
|
|
BLAKE2b-256 checksum How to use checksums |
80fe2b5513bb7927afc655fd1bb30e2fb5b00509984ebdcf506e8945ad060275
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_conversation_compacting 0.1.0.dev0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.