LangChain document loader for Anytype spaces.
Project description
Anytype Loader
Python loader for Anytype spaces. Load documents into LangChain format for RAG pipelines and AI applications. Supports both sync and async operations.
Installation
pip install anytype-loader
Supports langchain-core 1.x by default. For LangChain 0.x, install with pip install anytype-loader[langchain].
Prerequisites
- Anytype desktop app running locally
- API key from Anytype settings
- Space names you want to load
What it does
The loader retrieves documents from your Anytype spaces and converts them to LangChain Document objects:
- Resolves space names to IDs via
/v1/spaces - Lists objects with pagination via
/v1/spaces/:space_id/objects(or/v1/spaces/:space_id/searchwithqueryparameter) - Fetches full content for each object via
/v1/spaces/:space_id/objects/:object_id - Returns documents with markdown content and metadata including space info, timestamps, tags, and object properties
Example metadata:
{
"id": "<object_id>",
"space_id": "<space_id>",
"space_name": "Personal",
"name": "Project Notes",
"archived": false,
"type": "Page",
"created_at": "2024-11-02T21:20:00Z",
"updated_at": "2025-11-28T19:17:37Z",
"last_opened_at": "2025-11-28T19:03:43Z",
"tags": ["work", "urgent"],
"description": "Q4 planning document"
}
Quickstart
Sync
from anytype_loader import AnytypeLoader
loader = AnytypeLoader(
url="http://127.0.0.1:31009",
api_key="YOUR_API_KEY",
space_names=["Personal", "Work"],
page_size=50,
query="project", # optional: search instead of listing all objects
)
docs = loader.load()
Async
Recommended: context manager (auto-cleanup)
import asyncio
from anytype_loader import AnytypeLoader
async def main():
async with AnytypeLoader(
url="http://127.0.0.1:31009",
api_key="YOUR_API_KEY",
space_names=["Personal", "Work"],
page_size=50,
) as loader:
docs = await loader.aload()
asyncio.run(main())
Alternative: manual cleanup
async def main():
loader = AnytypeLoader(
url="http://127.0.0.1:31009",
api_key="YOUR_API_KEY",
space_names=["Personal", "Work"],
)
docs = await loader.aload()
await loader.aclose() # required for cleanup
asyncio.run(main())
What it does
- Resolves provided
space_namesvia/v1/spacesto get IDs. - Lists objects via
/v1/spaces/:space_id/objects(or/v1/spaces/:space_id/searchwhenqueryis set) with pagination (limit/offset). - Fetches each object via
/v1/spaces/:space_id/objects/:object_id. - Returns
Documentobjects withmarkdowncontent and flattened metadata including:space_id,space_name,object_id,name,archived,type, tags (tag names), and selected dates (created_at,updated_at,last_opened_atwhen present).
Example metadata from one document:
{
"space_id": "<space_id>",
"space_name": "Johnson",
"object_id": "<object_id>",
"id": "<object_id>",
"name": "Pattern - Availability",
"archived": false,
"type": "Page",
"created_at": "2024-11-02T21:20:00Z",
"tags": ["testTag"],
"updated_at": "2025-11-28T19:17:37Z",
"description": "Test Desc",
"last_opened_at": "2025-11-28T19:03:43Z"
}
Implementation notes
- Async implementation uses pooled
httpx.AsyncClientwith bounded concurrency for efficient parallel fetching - All timestamps are returned in ISO 8601 format
- Tag references are resolved to tag names in metadata
- Empty or missing fields are omitted from metadata
Project details
Release history Release notifications | RSS feed
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 anytype_loader-1.0.1.tar.gz.
File metadata
- Download URL: anytype_loader-1.0.1.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
144ff021df29e0246fbc73db64f3aa1ab4b03118ed4cfb4a8743ee086b9fe8dc
|
|
| MD5 |
c43d85b067716dbd4623ce6ecec7d4e8
|
|
| BLAKE2b-256 |
5352b01c0602168f05e65ddc0e73d5f9813e31615c56a7fcf4c73a85acda1985
|
File details
Details for the file anytype_loader-1.0.1-py3-none-any.whl.
File metadata
- Download URL: anytype_loader-1.0.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf01911496d066fc84d35339dd1024da1be8b195c1ed28ffb9d74b9e8cc8d9d5
|
|
| MD5 |
dc0ab16150906bf7c217f92d46c73f6f
|
|
| BLAKE2b-256 |
5d3029a74b27cda0776cdf6f99b9c0f2cfad716200094ff0284089209441f6cc
|