Skip to main content

ContextOS

ContextOS — The right context. Every time.

ContextOS is an opinionated, open-source Python library for Context Engineering: building, selecting, and preparing high-quality context to include in prompts for Large Language Models (LLMs). It is model-agnostic and designed to work with hosted and local models.

Current release: v0.1.0

Highlights

  • Opinionated pipeline for deterministic context selection
  • Budget-aware token estimation and context trimming
  • Pluggable ranking and optimization stages
  • Strong type coverage (py.typed) and CI-tested code

Installation

Install the latest release from PyPI:

pip install piddi-os

Import the library:

from contextos import ContextEngine

Quick Start

from contextos import ContextEngine

engine = ContextEngine()
engine.add_text("Angular introduced Signals.")
engine.add_text("React introduced Hooks.")

prompt = engine.build(query="Explain Angular Signals", max_tokens=500)
print(prompt)

Features

  • ContextEngine: simple, composable public API
  • ContextStore: in-memory context management
  • Pipeline stages: ranking, budgeting, optimization
  • Token estimation and budget enforcement
  • Explainable optimization and tracing

Examples & Docs

See the examples/ directory and the docs/ folder for usage patterns, architecture notes, and recipes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Maintainers

Maintained by the Keshav Labs.

Release files for piddi-os 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for piddi-os 0.1.0
File Size Uploaded
piddi_os-0.1.0.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piddi-os 0.1.0
File Interpreter ABI Platform
piddi_os-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 26.5 kB

Release files / piddi_os-0.1.0.tar.gz

Download URL piddi_os-0.1.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6c07638454323182ec6875865631abf19a84f2a95dba732b740cd80fa57dd0fe
BLAKE2b-256 checksum
How to use checksums
2191bba6d0644a026bb9d6ea0540dc79fcc89e605fab493ca926e895e09c6176
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release files / piddi_os-0.1.0-py3-none-any.whl

Download URL piddi_os-0.1.0-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef673498a660b37dce19f2a40713bd9fca9e6edcf0f663c21b3a7879d6f95ae9
BLAKE2b-256 checksum
How to use checksums
e20da65fec39793ec1c2a3c98cb7e08fe02e687f258625099c4c8f2ee1c7fd05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page