Skip to main content

InfoLang Python SDK

Official Python client for InfoLang semantic memory. Wraps the il-runtime REST API (Forge-compatible) with one-line construction, typed errors, automatic retries, and ergonomic agent helpers.

Repository: __REPO__. Package: infolang (PyPI).

Install

While the package is private, install from the repo:

pip install "infolang @ git+ssh://git@github.com/InfoLang-Inc/__REPO__.git@v0.1.0"

Once published:

pip install infolang

Quickstart

from infolang import InfoLang

il = InfoLang.from_api_key("il_live_...")          # managed cloud
result = il.investigate("How does auth middleware work?")
for chunk in result.chunks:
    print(chunk.score, chunk.text)

Three ways to call, depending on your runtime:

# 1. One-shot
chunks = InfoLang.from_api_key("il_live_...").investigate("query").chunks

# 2. Durable client (connection pooling)
with InfoLang.from_session_file() as il:        # OAuth via ~/.config/infolang/session.json
    il.memorize("a fact worth keeping", source="docs/auth.md")

# 3. Async
import asyncio
from infolang import AsyncInfoLang

async def main():
    async with AsyncInfoLang.from_api_key("il_live_...") as il:
        result = await il.recall("auth middleware", top_k=5)
        print(len(result.chunks))

asyncio.run(main())

Authentication

Mode Constructor Target
Managed cloud (API key) InfoLang.from_api_key("il_live_...") api.infolang.ai
Managed cloud (OAuth) InfoLang.from_session_file() api.infolang.ai
Self-hosted dev InfoLang.from_dev_key("key:namespace") 127.0.0.1:8766
Enterprise mTLS InfoLang.from_mtls("client.pem", "client-key.pem") self-hosted origin

Credentials are also read from the environment: INFOLANG_API_KEY, INFOLANG_DEV_KEY, INFOLANG_BASE_URL, INFOLANG_NAMESPACE.

Core API

Method Purpose
recall(query, *, namespace, top_k, filters, verbose) Semantic recall
recall_hybrid(query, *, namespace, top_k, tag_filter, candidate_pool, use_hybrid) Recall over a candidate pool with tag-inclusion ordering
investigate(query, *, namespace_hint, top_k=5) Agent-style recall
remember(text, *, source, tags, namespace) Store a memory
remember_batch(items, *, namespace, source) Store many memories in one call
memorize(content, *, source, tags, namespace) Alias of remember
forget(memory_id, *, namespace) Delete a memory
reset_namespace(namespace) Bulk clear a namespace (list + forget)
list_banks() / list_recent(*, namespace, n) Introspection
context_pack(query, *, namespace, max_tokens, repo_root) One-shot context string
ingest_repo(namespace, *, repo_root, ref) Index a repository
execute(operations) Batch ops
health.check() Liveness/readiness

Bulk ingest + hybrid recall (benchmarks / evals)

il = InfoLang.from_dev_key("devsecret:default")   # self-hosted runtime

il.reset_namespace("eval_run")                      # clean slate
il.remember_batch(
    [
        {"text": "Alice: I moved to Berlin in March 2024.",
         "tags": ["alice", "march", "2024", "session_1"]},
        {"text": "Bob: My flight is on the 12th.",
         "tags": ["bob", "session_2"]},
    ],
    namespace="eval_run",
)

hits = il.recall_hybrid(
    "When did Alice move to Berlin?",
    namespace="eval_run",
    top_k=20,
    tag_filter=["march", "2024"],   # restrict to chunks carrying these tags
    candidate_pool=500,
)
for chunk in hits.chunks:
    print(chunk.score, chunk.tags, chunk.text)

recall_hybrid fetches up to candidate_pool IL-ranked candidates, then (when tag_filter is given) re-orders so chunks sharing a tag come first and truncates to top_k. This biases a wide recall sweep toward tagged evidence — handy for evals/benchmarks — without requiring any server-side hybrid op.

Errors

All failures raise a subclass of InfoLangError: AuthenticationError, RateLimitError (with retry_after), NotFoundError, ValidationError, ServerError, plus InfoLangConnectionError for transport failures. Every API error carries status, body, and request_id.

Resilience

recall/remember and friends retry 429 and 5xx with exponential backoff plus full jitter (configurable via max_retries), and honor Retry-After. Timeouts default to connect 5s / read 30s.

Development

pip install -e ".[dev]"
ruff check .
mypy
pytest

The REST contract is pinned in openapi/ (see openapi/IL_RUNTIME_VERSION). Regenerate the typed models with scripts/codegen.sh after bumping the pin.

Metadata

Release files for infolang 0.2.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 infolang 0.2.0
File Size Uploaded Provenance Actions
infolang-0.2.0.tar.gz 26.4 kB Without provenance Details for infolang-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for infolang 0.2.0
File Interpreter ABI Platform Actions
infolang-0.2.0-py3-none-any.whl Python 3 none any Details for infolang-0.2.0-py3-none-any.whl

Total release size: 46.8 kB

Release files / infolang-0.2.0.tar.gz

Download URL infolang-0.2.0.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8690a69cb1ae23c4a873f21ec1d0c29d009832e01fbf0c24af4f8e48c889e227
BLAKE2b-256 checksum
How to use checksums
76ed434097f8aad797d147435fad58f8badf90ebbe5d8e4a79ec4d8f224283c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / infolang-0.2.0-py3-none-any.whl

Download URL infolang-0.2.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97282789727fe780d7d6ca5bcb266a3b93fdc951e33e22df6723f5ad47cb63e4
BLAKE2b-256 checksum
How to use checksums
c7d0936e0699d275da2ad76a37676b05b4fd47ba025e137ac142229139c2f413
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for infolang 0.2.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.2.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