Multi-modal knowledge library with vector and full-text search for text, code, images, and PDFs
Project description
Agent Library
A personal knowledge library for AI agents, built on Arcade for the Model Context Protocol (MCP).
Status. Agent Library is a community project built by Arcade.dev engineers. It is not an official Arcade.dev product and is not covered by Arcade.dev support or SLAs. See Support below for what to expect.
Naming. The package is Agent Library (
agent-libraryon PyPI,librarianas the Python module). The MCP server inside it identifies itself asLibrarian— that's the role your agent talks to, and it's why the exposed tools are namedLibrarian_SearchLibrary,Librarian_AddToLibrary, and so on.
Overview
Agent Library provides AI agents with persistent storage for text, documents, and knowledge. Agents can store information and retrieve it later through semantic and keyword search, maintaining context across conversations.
graph LR
A[Agent Stores Info] --> B[Parser]
B --> C[Chunker]
C --> D[Embedder]
D --> E[(SQLite + vec)]
F[Agent Queries] --> G[Hybrid Search]
E --> G
G --> H[Relevant Context]
Features
- Persistent knowledge storage for AI agents
- SQLite storage with
sqlite-vecfor vector search - Full-text search using FTS5 with BM25 ranking
- Hybrid search combining semantic and keyword matching
- Max Marginal Relevance (MMR) for diverse results
- Configurable embedding models (local or OpenAI-compatible API)
- Header-aware text chunking with overlap
- Time-bounded search filters
- CLI and MCP server interfaces
Multi-Modal Support
Agent Library supports indexing and searching across multiple file types:
| Asset Type | File Extensions | Features |
|---|---|---|
| Text | .md, .txt |
Frontmatter extraction, header-aware chunking |
| Code | .py, .js, .ts, .go, .rs, .java, .cpp, and more |
Symbol extraction (classes, functions, methods) |
.pdf |
Page-based text extraction | |
| Image | .png, .jpg, .jpeg, .gif, .webp |
Metadata and EXIF extraction, optional OCR |
Installation
The recommended way to install Agent Library is as a uv tool, which gives you the libr CLI and the MCP server in an isolated environment:
uv tool install 'agent-library[all]'
The [all] extra pulls in optional support for PDFs, images, OCR, and code-aware embeddings. If you'd rather install only what you need:
uv tool install agent-library # core only (text + code)
uv tool install 'agent-library[pdf]' # add PDF support
uv tool install 'agent-library[vision]' # add image support
uv tool install 'agent-library[ocr]' # add OCR for image-based PDFs
Installing from source
If you want to contribute or run from a clone:
git clone https://github.com/arcadeai-labs/agent-library.git
cd agent-library
./setup.sh
Or install manually with the dev extras:
uv pip install -e ".[dev,all]"
CLI Usage
# Add files to the library
libr add ~/notes
# Search the library
libr search "machine learning concepts"
# List sources
libr list
# View library statistics
libr index
# Rebuild the index
libr index build
MCP Server
Start the server for AI assistant integration:
# stdio transport (Claude Desktop, CLI)
libr serve stdio
# HTTP transport (Cursor, VS Code)
libr serve http --port 8000
See the Arcade MCP documentation for integration details.
Available Tools
Core Tools (always enabled):
| Tool | Description |
|---|---|
Librarian_SearchLibrary |
Unified search with mode selection (hybrid/semantic/keyword), asset type filtering, and timeframe support |
Librarian_AddToLibrary |
Store new content in the library |
Librarian_UpdateLibraryDoc |
Update existing content |
Librarian_ReadFromLibrary |
Read full document content |
Librarian_RemoveFromLibrary |
Remove content from the library |
Librarian_ListLibraryContents |
List all stored content |
Librarian_IndexDirectoryToLibrary |
Bulk import files from a directory |
Optional Tools (enable with LIBRARIAN_ENABLE_OPTIONAL_TOOLS=true):
| Tool | Description |
|---|---|
Librarian_GetLibraryOverview |
Inspect the library — view selects sections (default; storage locations + doc counts), stats (totals + config), or tree (recursive filesystem walk) |
Librarian_SuggestLibraryLocation |
AI-powered suggestions for where to store content |
Configuration
Set via environment variables:
| Variable | Default | Description |
|---|---|---|
DOCUMENTS_PATH |
./documents |
Root directory for files |
DATABASE_PATH |
~/.librarian/index.db |
SQLite database location |
EMBEDDING_PROVIDER |
openai |
local or openai |
EMBEDDING_MODEL |
all-MiniLM-L6-v2 |
Local model name |
OPENAI_API_BASE |
http://localhost:7171/v1 |
OpenAI-compatible API URL |
OPENAI_EMBEDDING_MODEL |
qwen3-embedding-06b |
API model name |
CHUNK_SIZE |
512 |
Max characters per chunk |
CHUNK_OVERLAP |
50 |
Overlap between chunks |
SEARCH_LIMIT |
10 |
Default results limit |
MMR_LAMBDA |
0.7 |
MMR diversity (0=diverse, 1=relevant) |
HYBRID_ALPHA |
0.7 |
Vector vs keyword weight (1=vector only) |
Project Structure
librarian/
├── cli.py # Command-line interface
├── server.py # MCP server and tool definitions
├── config.py # Configuration management
├── indexing.py # Document indexing service
├── types.py # Shared type definitions
├── storage/
│ ├── database.py # SQLite operations
│ ├── vector_store.py # sqlite-vec search
│ └── fts_store.py # FTS5 search
├── processing/
│ ├── embed/ # Embedding providers
│ ├── parsers/ # Document parsers (md, code, pdf, image)
│ └── transform/ # Text chunking
├── retrieval/
│ └── search.py # Hybrid search + MMR
└── utils/
└── timeframe.py # Time filter utilities
Development
make install # Install dependencies
make test # Run tests
make lint # Run linter
make format # Format code
make typecheck # Type checking
make check # All checks
make evals # Run evaluations
Resources
- Arcade.dev - Build AI-native applications
- Arcade Documentation - Integration guides and API reference
Support
Agent Library is a community project built by Arcade.dev engineers. It is not an official Arcade.dev product and is not covered by Arcade.dev support or SLAs.
- GitHub issues are monitored on a best-effort basis. Expect response times in days-to-weeks, not hours.
- Pull requests are welcome. See CONTRIBUTING.md for how to file one and what we're likely to accept.
- Security vulnerabilities should be reported privately per SECURITY.md, not via public issues.
If you're using Agent Library in something important, snapshot the SQLite index (~/.librarian/index.db) before anything you can't easily redo. The index is a single file — cp is your friend.
Contributing
See CONTRIBUTING.md. Issues, PRs, and new parsers/embedders are all welcome.
License
Apache License 2.0 - see LICENSE for details.
Agent Library was originally developed by Arcade.dev. See NOTICE for attribution requirements when redistributing.
Contact
- Email: contact@arcade.dev
- Website: arcade.dev
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_library-0.13.0.tar.gz.
File metadata
- Download URL: agent_library-0.13.0.tar.gz
- Upload date:
- Size: 157.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f3890f381481e2e3d5916ef59d1f3217f72af9c7df2a5f562cff6303e928b43
|
|
| MD5 |
1517e7aa6c45b0d76bf06e38a62d5560
|
|
| BLAKE2b-256 |
082b825ea657994e61e40c5201943fe1a7ceb870b5bcc3149a67df3158db6066
|
Provenance
The following attestation bundles were made for agent_library-0.13.0.tar.gz:
Publisher:
release.yml on arcadeai-labs/librarian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_library-0.13.0.tar.gz -
Subject digest:
4f3890f381481e2e3d5916ef59d1f3217f72af9c7df2a5f562cff6303e928b43 - Sigstore transparency entry: 1440324472
- Sigstore integration time:
-
Permalink:
arcadeai-labs/librarian@5ac5076a5029a8995c3dce529be550c6299fb4a5 -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/arcadeai-labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ac5076a5029a8995c3dce529be550c6299fb4a5 -
Trigger Event:
push
-
Statement type:
File details
Details for the file agent_library-0.13.0-py3-none-any.whl.
File metadata
- Download URL: agent_library-0.13.0-py3-none-any.whl
- Upload date:
- Size: 111.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15d750a9c79f807177767ae9b601d3eaa8b3f7c125f825fcf1210117ae5537b7
|
|
| MD5 |
3f132d862d1fc71dcd4629b7df87ac30
|
|
| BLAKE2b-256 |
fd670549b1e3ea42396397f27a4ba38331abd58ac222d7a885db9ce729702d7e
|
Provenance
The following attestation bundles were made for agent_library-0.13.0-py3-none-any.whl:
Publisher:
release.yml on arcadeai-labs/librarian
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
agent_library-0.13.0-py3-none-any.whl -
Subject digest:
15d750a9c79f807177767ae9b601d3eaa8b3f7c125f825fcf1210117ae5537b7 - Sigstore transparency entry: 1440324480
- Sigstore integration time:
-
Permalink:
arcadeai-labs/librarian@5ac5076a5029a8995c3dce529be550c6299fb4a5 -
Branch / Tag:
refs/tags/v0.13.0 - Owner: https://github.com/arcadeai-labs
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5ac5076a5029a8995c3dce529be550c6299fb4a5 -
Trigger Event:
push
-
Statement type: