Metadata-Version: 2.4
Name: layer-context
Version: 0.1.4
Summary: Context Layer SDK - versioned context infrastructure for AI apps
License: MIT
Project-URL: Homepage, https://get-context-layer.lovable.app
Project-URL: Documentation, https://get-context-layer.lovable.app/docs
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.28.0
Dynamic: license-file

# Context Layer

Python SDK for [ContextLayer](https://get-context-layer.lovable.app) - versioned context infrastructure for AI apps.

## Installation

```bash
pip install layer-context
```

For client-side encryption (optional):
```bash
pip install layer-context cryptography
```

## Quick Start

```python
from layer_context import CL

cl = CL(api_key="cl_sk_your_key_here")

# Create a block
cl.create_block("system-prompt")

# Get a block handle
block = cl.block("system-prompt")

# Append context
block.append("You are a helpful assistant.")
block.append("Always respond in markdown.")

# Get compiled context
print(block.get_context())
# Output: "You are a helpful assistant.\nAlways respond in markdown."

# Update (replace entire context)
block.update("You are a coding assistant. Use Python examples.")

# Delete specific content
block.delete("Use Python examples.")

# Read updated context
print(block.get_context())
# Output: "You are a coding assistant."

# Create a new version
block.create_version()

# Work with specific versions
block.append("V2 content", version=2)
print(block.get_context(version=2))

# View history
entries = block.get_history()

# List all blocks
blocks = cl.list_blocks()
```
## Client-Side Encryption

Enable zero-knowledge encryption so your context is encrypted before it leaves your machine:

```python
cl = CL(
    api_key="cl_sk_your_key_here",
    encryption_key="my-secret-passphrase"
)

block = cl.block("private-data")
block.append("Sensitive context here")

# Data is stored encrypted on the server
# Only you can read it with the same encryption_key
print(block.get_context())  # Decrypted automatically
```

> **Note:** Requires `pip install cryptography`. The server never sees your plaintext data.

## License

MIT
