Skip to content

Commit 53cdfa7

Browse files
committed
docs: refresh project README
1 parent 0da4d78 commit 53cdfa7

1 file changed

Lines changed: 126 additions & 5 deletions

File tree

README.md

Lines changed: 126 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,131 @@
11
# lance-context
2-
Manage Multimodal Agentic Context Lifecycle with Lance
32

4-
## Quickstart
3+
Multimodal, versioned context storage for agentic workflows built on top of [Lance](https://lancedb.github.io/lance/).
4+
5+
Lance Context gives AI agents a durable memory that can store text, binary payloads (images, Arrow tables, etc.), and semantic embeddings in a single columnar table. Every append produces a new Lance dataset version, so you can time-travel to prior checkpoints, branch off experiments, or reproduce conversations. The project ships with both a Rust API and a thin, Pythonic wrapper that integrates easily with orchestration frameworks.
6+
7+
## Why another context store?
8+
9+
Key motivations inspired by the broader Lance roadmap<sup>[1](https://github.com/lance-format/lance/discussions/5716)</sup>:
10+
11+
- **Multimodal first** – store text, images, and structured data together, keeping the original bytes plus typed metadata.
12+
- **Version aware** – each append creates an immutable snapshot, enabling time-travel, branching, and auditability for long-running agents.
13+
- **Searchable semantics** – embeddings are managed alongside content so you can run Lance vector search without leaving the dataset.
14+
- **Columnar performance** – backed by the Lance file format, giving fast analytics, compaction, and cloud-friendly storage.
15+
16+
## Features
17+
18+
- Unified schema for agent messages (`ContextRecord`) with optional embeddings and metadata.
19+
- Automatic versioning via Lance manifests with `checkout(version)` support.
20+
- Python API (`lance_context.api.Context`) aligned with the Rust implementation.
21+
- Integration tests that exercise real persistence, image serialization, and version rollbacks.
22+
23+
## Project layout
24+
25+
```
26+
rust/lance-context # Core Rust crate (ContextStore, schema, serialization)
27+
python/ # Python bindings, wheel build, and pytest suite
28+
python/tests/ # High-level integration tests
29+
```
30+
31+
## Getting started
32+
33+
Install the Python package (wheel publishing coming soon):
534

635
```bash
7-
make venv
8-
make install
9-
make test
36+
pip install lance-context
1037
```
38+
39+
Then follow the usage examples below to create a `Context`, append entries, and time-travel through versions.
40+
41+
## Usage
42+
43+
### Python
44+
45+
```python
46+
from pathlib import Path
47+
from lance_context.api import Context
48+
49+
uri = Path("context.lance").as_posix()
50+
ctx = Context.create(uri)
51+
52+
# Add multimodal entries
53+
ctx.add("user", "Where should I travel in spring?")
54+
55+
from PIL import Image
56+
image = Image.new("RGB", (2, 2), color="teal")
57+
ctx.add("assistant", image)
58+
59+
print("Current version:", ctx.version())
60+
61+
# Time-travel to prior state
62+
first_version = ctx.version()
63+
ctx.add("assistant", "Let me fetch suggestions…")
64+
ctx.checkout(first_version)
65+
66+
print("Entries after checkout:", ctx.entries())
67+
```
68+
69+
### Rust
70+
71+
```rust
72+
use lance_context::{ContextStore, ContextRecord, StateMetadata};
73+
use chrono::Utc;
74+
75+
# tokio_test::block_on(async {
76+
let mut store = ContextStore::open("context.lance").await?;
77+
let record = ContextRecord {
78+
id: "run-1-1".into(),
79+
run_id: "run-1".into(),
80+
created_at: Utc::now(),
81+
role: "user".into(),
82+
state_metadata: Some(StateMetadata {
83+
step: Some(1),
84+
active_plan_id: None,
85+
tokens_used: None,
86+
custom: None,
87+
}),
88+
content_type: "text/plain".into(),
89+
text_payload: Some("hello world".into()),
90+
binary_payload: None,
91+
embedding: None,
92+
};
93+
store.add(&[record]).await?;
94+
println!("Current version {}", store.version());
95+
# Ok::<(), Box<dyn std::error::Error>>(())
96+
# })?;
97+
```
98+
99+
## Testing
100+
101+
- `make test` – Python pytest suite (including persistence integration tests).
102+
- `cargo test --manifest-path rust/lance-context/Cargo.toml` – Rust unit tests.
103+
- `python/.venv/bin/ruff check python/` and `python/.venv/bin/pyright` – linting/type checks.
104+
105+
## Roadmap
106+
107+
We are tracking future enhancements as GitHub issues:
108+
109+
- [Support S3-backed context stores](https://github.com/lance-format/lance-context/issues/14)
110+
- [Add relationship column for GraphRAG workflows](https://github.com/lance-format/lance-context/issues/15)
111+
- [Background compaction for Lance fragments](https://github.com/lance-format/lance-context/issues/16)
112+
113+
Contributions are welcome—feel free to comment on the issues above or open your own proposals.
114+
115+
## Contributing
116+
117+
1. Fork and clone the repository.
118+
2. Create a feature branch off `main`.
119+
3. Set up the development environment:
120+
```bash
121+
make venv # creates python/.venv using uv
122+
make install # installs the package in editable mode with test extras
123+
make test # runs pytest (python/tests/)
124+
cargo test --manifest-path rust/lance-context/Cargo.toml
125+
```
126+
4. Run linting/type checks: `python/.venv/bin/ruff check python/`, `python/.venv/bin/pyright`, and `~/.cargo/bin/cargo fmt -- --check`.
127+
5. Open a Pull Request with a clear summary of the change.
128+
129+
## License
130+
131+
Licensed under the Apache License, Version 2.0. See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)