Skip to main content

anlyon-langchain

LangChain integration for Anlyon: AnlyonVectorStore and AnlyonRetriever over Anlyon Memory, AnlyonChatMessageHistory over Anlyon Sessions, and AnlyonTracer for nested run/span tracing.

Trace a LangChain invocation

from anlyon import Client
from anlyon_langchain import AnlyonTracer

client = Client(api_key="anlyon_live_...")
tracer = AnlyonTracer(client, application="support-agent")

# Pass the callback to any LangChain runnable/agent invocation.
result = chain.invoke({"question": "Where is my order?"}, config={"callbacks": [tracer]})

The handler creates one Anlyon run for the root callback and parent-linked workflow_step, model_call, and tool_call spans for nested callbacks. It is best-effort: Anlyon transport failures never change the application result.

Installation

pip install anlyon-langchain

Retrieval

from anlyon import Client
from anlyon_langchain import AnlyonVectorStore

client = Client()  # uses ANLYON_API_KEY
store = AnlyonVectorStore(client, collection="docs")
retriever = store.as_retriever()

Chat history

AnlyonChatMessageHistory puts a chain's conversation in an Anlyon Session durable across processes, and summarized automatically once the thread gets long.

from anlyon import Client
from anlyon_langchain import AnlyonChatMessageHistory
from langchain_core.runnables.history import RunnableWithMessageHistory

client = Client()

chain_with_history = RunnableWithMessageHistory(
    chain,
    lambda session_id: AnlyonChatMessageHistory(client, session_id),
    input_messages_key="input",
    history_messages_key="history",
)

# `session_id` is an Anlyon session id  create one with client.sessions.create()
chain_with_history.invoke(
    {"input": "Where is my order?"},
    config={"configurable": {"session_id": "ses_abc123"}},
)

.messages reads the thread back as LangChain messages, .add_messages() appends a turn in one round-trip, and .clear() truncates the thread while keeping the session id usable.

See the Anlyon docs for the full guide.

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anlyon_langchain-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anlyon_langchain-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file anlyon_langchain-0.1.0.tar.gz.

File metadata

  • Download URL: anlyon_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for anlyon_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb91f1b4106cfad14bf9a936b1a192012080ee790a316a97986316178485846e
MD5 18f8f4a2f6d5a49d1b18f524b5fe7509
BLAKE2b-256 45add4886d25a5db47562aacac63d16a4e73d7a8255657ee42167f3cf1eeaf08

See more details on using hashes here.

Provenance

The following attestation bundles were made for anlyon_langchain-0.1.0.tar.gz:

Publisher: publish-python.yml on AnlyonHQ/anlyon-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file anlyon_langchain-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for anlyon_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3400f8d8b1191085ef733463ffd2ce67045e98471d283552d3477c04879e3adf
MD5 48b876bfa9895250cf0f164cabb8d521
BLAKE2b-256 dc66dc06a9b37d6df7b8e06dde273a2626e0417c2e1b939d7a2ee168c6f0f709

See more details on using hashes here.

Provenance

The following attestation bundles were made for anlyon_langchain-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on AnlyonHQ/anlyon-platform

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

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