Skip to main content

LlamaIndex Memory Integration: Bilinc

BilincMemoryBlock is a long-term memory block for LlamaIndex's Memory, backed by Bilinc agent memory.

  • When Memory flushes old messages out of short-term memory, the block saves them to Bilinc as one episodic memory per flush, under the chat's session ID.
  • When Memory builds the prompt, the block recalls the memories most relevant to the latest user message and inserts them as text.

It wraps the official bilinc Python SDK.

Source: https://github.com/ReARCLabs/bilinc-llamaindex

Install

pip install llama-index-memory-bilinc

Credentials

Pass api_key=, or set BILINC_API_KEY. If neither is set, the SDK uses the key saved by bilinc login. Get a key at bilinc.space/signup.

Usage

from llama_index.core.agent.workflow import FunctionAgent
from llama_index.core.memory import Memory
from llama_index.llms.anthropic import Anthropic
from llama_index.memory.bilinc import BilincMemoryBlock

memory = Memory.from_defaults(
    session_id="user-123",
    token_limit=40000,
    memory_blocks=[BilincMemoryBlock(key_prefix="my-agent.chat", recall_limit=5)],
)

agent = FunctionAgent(tools=[], llm=Anthropic(model="claude-sonnet-5-5"))
response = await agent.run("Remember that I prefer short answers.", memory=memory)

Options

Option Default Meaning
api_key env / saved login Bilinc API key
base_url SDK default Override the Bilinc Cloud URL
client built on first call A pre-built bilinc.CloudClient
key_prefix llamaindex.chat Prefix of written keys: <prefix>.<session_id>.<hash>
write_memory_type episodic Memory type of written entries
importance 0.5 Importance of written entries
recall_limit 5 Memories recalled per prompt
profile balanced Recall profile (fast, balanced, verified, deep; depends on plan)
memory_types all Limit recall to these types
write_enabled True False makes the block read-only
priority 0 Memory truncation priority (0 = never truncate)
session_id none Session for writes; when set, it wins over the session Memory passes

Each flush is written once, with an idempotency key derived from its session and content. Keys are <prefix>.<session>.<hash>. The session is the block's session_id when it is set; otherwise it is the one Memory passes (Memory always passes its own session_id). The same messages in two sessions are saved as two memories.

Session IDs are trimmed, and a blank one is ignored. The key and sessionId always carry the same session value. That value is the ID itself up to 256 characters (Bilinc's limit for sessionId), and its hash for a longer ID. If the key would pass Bilinc's 512-character limit, the hash is used in both. If the key is still too long, because key_prefix itself is very long, a warning is logged and the write is skipped.

Bilinc failures never break the agent's turn. A missing key, a rate limit, a connection error or a validation error is logged as a warning (logger llama_index.memory.bilinc.base). A read then returns no memories, and a write is skipped. Saves and recalls use Bilinc credits; see pricing.

Why a memory block

New LlamaIndex code uses Memory with memory blocks; the older ChatMemoryBuffer family is marked deprecated in llama_index.core.memory. A block lets Bilinc sit next to the built-in short-term chat history and other blocks, instead of replacing the whole memory.

Development

pip install -e . pytest pytest-asyncio
pytest

The tests replace the SDK transport with a fake and never reach the network.

License

MIT for this package. The bilinc SDK it depends on has its own license (BUSL-1.1).

Metadata

Release files for llama-index-memory-bilinc 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 llama-index-memory-bilinc 0.1.0
File Size Uploaded Provenance Actions
llama_index_memory_bilinc-0.1.0.tar.gz 11.4 kB Without provenance Details for llama_index_memory_bilinc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for llama-index-memory-bilinc 0.1.0
File Interpreter ABI Platform Actions
llama_index_memory_bilinc-0.1.0-py3-none-any.whl Python 3 none any Details for llama_index_memory_bilinc-0.1.0-py3-none-any.whl

Total release size: 18.9 kB

Release files / llama_index_memory_bilinc-0.1.0.tar.gz

Download URL llama_index_memory_bilinc-0.1.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7022069e756c8f9a768341f364f85304925d24add7d729e7ecee5dddc5d448f9
BLAKE2b-256 checksum
How to use checksums
69ba6637c08805eb9f0cb6344aedf4d682e5fd46fe2482e3226727dff2450a01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

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

Download URL llama_index_memory_bilinc-0.1.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b8652420d5d7fdd408591ba46ae821981fc1984de85756f6c96110b2016ce52
BLAKE2b-256 checksum
How to use checksums
352de9ca16182a9f6ff8e4a8fdfe5b9f3bfe27a516b2c8ebbd20ffd6820010ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.7

Security for llama-index-memory-bilinc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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