Skip to main content

Antfly for LangChain

Persistent vector and hybrid retrieval, text/image embeddings, reranking, document and media storage, and graph context backed by an Antfly server. Python 3.11 or newer. Apache-2.0 licensed.

Stable release: 0.1.0. Requires antfly-sdk>=0.2.1,<0.3 and a compatible Antfly server; 0.3.0-rc.5 is the tested baseline. See the server setup.

Install

pip install langchain-antfly==0.1.0
# Graph ingestion and tools are included; no extra is required.

The package connects to an existing Antfly server; it does not install or start one. Configure a compatible server with inference enabled and choose an installed embedding model using the setup guide. Models are not downloaded automatically.

Retrieve three documents

import os

from antfly import AntflyClient
from langchain_antfly import AntflyEmbeddings, AntflyVectorStore
from langchain_core.documents import Document

with AntflyClient(
    base_url=os.environ["ANTFLY_URL"], token=os.getenv("ANTFLY_TOKEN")
) as client:
    embeddings = AntflyEmbeddings(
        client=client, model=os.environ["ANTFLY_EMBEDDING_MODEL"]
    )
    store = AntflyVectorStore.from_documents(
        [
            Document(id="owner", page_content="Mira Chen owns operations."),
            Document(id="target", page_content="The shipment target is 120 crates."),
            Document(id="storage", page_content="Apples are stored in the cool warehouse."),
        ],
        embeddings,
        client=client,
        table="langchain_example",
        distance_metric="cosine",
    )
    documents = store.as_retriever(search_kwargs={"k": 1}).invoke(
        "Who owns operations?"
    )
    print(documents[0].page_content)

The factory creates a missing table or reuses a compatible one. Stable document IDs make repeated writes update the same records. To attach without writing, construct AntflyVectorStore(client=client, table="langchain_example", embedding=embeddings). Delete this example's dedicated table with client.drop_table("langchain_example") inside the client context when finished. Async factories, retrieval and mutations are also available.

Graph input migration in 0.1.0rc2

Starting with 0.1.0rc2, this package provides GraphDocument, Node, and Relationship directly from langchain_antfly; graph storage no longer needs Community. Existing structurally compatible graph documents remain valid inputs. Published 0.1.0rc1 is unchanged and still requires its [graph] extra. See the migration guide for imports, source ownership and base-class compatibility.

More examples

Persistent LangGraph agent memory is available separately in langgraph-store-antfly. This package does not include a chat-model adapter or an execution checkpointer.

Metadata

Release files for langchain-antfly 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 langchain-antfly 0.1.0
File Size Uploaded Provenance Actions
langchain_antfly-0.1.0.tar.gz 29.4 kB With provenance Details for langchain_antfly-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for langchain-antfly 0.1.0
File Interpreter ABI Platform Actions
langchain_antfly-0.1.0-py3-none-any.whl Python 3 none any Details for langchain_antfly-0.1.0-py3-none-any.whl

Total release size: 64.6 kB

Release files / langchain_antfly-0.1.0.tar.gz

Download URL langchain_antfly-0.1.0.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1d0cbbe4c7bd75904a7e84ada5d20342d02157198d17f86851e61a8744163a19
BLAKE2b-256 checksum
How to use checksums
9c1a8c2f7509ddc945fd5d16f0b5fe1495a08e1b43e5876c25e75172d89cfc6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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

Download URL langchain_antfly-0.1.0-py3-none-any.whl
Size 35.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7a23240470afac0cc5c2093283914bac538e974ae7dd3c824b205c93bd959404
BLAKE2b-256 checksum
How to use checksums
60bc57c4a31a3f34239db3ae1545272a97042884528c909e2874b5da12985195
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

Security for langchain-antfly 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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for langchain_antfly-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 17, 2026.

Transparency log

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.

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