# LLMSlim

> LLMSlim is the context layer for production AI agents. LLMSlim Core is an open-source, MIT-licensed Python library (`pip install llmslim`) that compresses, plans and traces the context an agent sends to a model, locally and with explicit provenance. LLMSlim Platform is a private beta built on Core for agent state, decision traces and learned context policies.

## LLMSlim Core

- Package: `llmslim` on PyPI (https://pypi.org/project/llmslim/), current Core version 0.8.1, MIT license.
- Source: https://github.com/Thanatos9404/llmslim
- Publisher: LLMSlim is a product of AMEYOR, an Indian sole proprietorship.
- Runs inside your Python process. The default extractive strategy runs locally and needs no API key; rewrite and hybrid strategies use a model provider you supply.
- Provider-neutral: prepare context for Sarvam, OpenAI, Anthropic, Gemini or a local model; your application keeps control of the model call.
- Provenance-aware: ContextRole labels (system, developer, user, assistant, tool, RAG) keep untrusted retrieved or tool text from gaining protected priority. This mitigates compression-induced instruction elevation; it is not a complete prompt-injection defense.
- The Adaptive Context Planner fits instructions, chat, retrieval, memory and tool schemas into a real token budget deterministically, and reports infeasibility instead of dropping required trusted items.

## Quick start

```bash
pip install llmslim
```

```python
from llmslim import compress

result = compress(long_context, target_ratio=0.5)
print(result.compressed_text)
```

## LLMSlim Platform (private beta)

- Private beta, version 0.9.1; proprietary and not published to PyPI. `pip install llmslim` installs Core only.
- Keeps a tamper-evident timeline of what agents were told and what changed, explains and deterministically replays each context decision, and can learn from recorded outcomes which context helps.
- Learned policies start in shadow mode and change nothing until an evaluation passes and an administrator promotes them; trust boundaries and mandatory instructions always take precedence.
- Details and beta access: https://www.llmslim.app/platform

## FAQ

### Does it need an API key?

No. LLMSlim’s default extractive strategy runs right inside your Python application, with no key and no model call. Rewrite and hybrid strategies plug into any provider you choose.

### Does it work with my model?

Yes. LLMSlim prepares context before your model call, so the output works with Sarvam, OpenAI, Anthropic, Gemini, or a local model. Adapters for LangChain, LlamaIndex and Haystack drop it into the retrieval pipeline you already run. Your application keeps full control of the request.

### How much should I compress?

Start at a 50% target and tune from there against your own evals. Every result shows exactly what was kept and why, so you can push the budget as far as your workload allows.

### What is LLMSlim Platform?

A private beta built on the open-source Core. It keeps a verifiable timeline of what your agents were told and what changed, explains and replays every context decision, and learns from real outcomes which context wins. Learned policies go live only when an administrator promotes them, and roll back instantly. Core stays MIT licensed: pip install llmslim.

## More

- [Documentation](https://www.llmslim.app/docs.md)
- [Integrations](https://www.llmslim.app/integrations.md)
- [Benchmarks](https://www.llmslim.app/benchmarks.md)
- [Engineering notes](https://www.llmslim.app/articles.md)
- [Changelog](https://www.llmslim.app/changelog.md)
- [Full text for language models](https://www.llmslim.app/llms-full.txt)

Canonical page: https://www.llmslim.app
