Skip to main content

calado LangChain callback handler — captures chain, LLM, tool, and retriever events and ships them to calado for analysis.

Project description

calado-langchain

Drop-in calado observability for LangChain and LangGraph agents.

Install

pip install 'calado-langchain==0.0.1'

Requires Python 3.9+ and langchain-core>=0.2.10,<0.5.

Quick start

import os
from calado_langchain import CaladoCallbackHandler

os.environ["CALADO_API_KEY"] = "cl_..."

handler = CaladoCallbackHandler()

# Per-chain mode
chain.invoke(
    {"input": "..."},
    config={
        "callbacks": [handler],
        "metadata": {"session_id": "user-42"},
    },
)

The SDK reads session_id from metadata. It also picks up thread_id (LangGraph convention) and langsmith_session_id / langchain_session_id automatically, plus a session:<id> tag as a fallback.

Or set CALADO_ENABLED=true plus CALADO_API_KEY=cl_... and the handler attaches to every chain in the process automatically. No code change required.

On the first successful POST a single line lands in stderr:

[calado] Connected. First batch sent. View at https://app.calado.ai/agents/<agent_id>

Public surface

CaladoCallbackHandler(
    *,
    api_key=None,           # or env CALADO_API_KEY
    base_url=None,          # or env CALADO_BASE_URL, default https://app.calado.ai
    batch_size=10,
    flush_interval_s=30.0,
    max_run_age_s=3600.0,
    max_queue_bytes=10 * 1024 * 1024,
    debug=False,
    mask=None,              # callable: dict -> dict | None (sync or async)
)

CaladoAsyncCallbackHandler(...)  # same signature, for ainvoke / LangGraph

handler.status()    # dict — see docs/transport-spec.md §3
await handler.astatus()
handler.flush(timeout_s=5.0)
handler.shutdown(timeout_s=5.0)

Constructor is keyword-only. The mask callable can be either sync or async; the SDK detects which without invoking it. Returning None drops that single child run (per-OV7 granularity). Patterns and recipes live at https://docs.calado.ai/ingestion/redaction.

Diagnostics

python -m calado_langchain doctor

Prints the installed calado-langchain and langchain-core versions, the supported range, and the fix command on resolver failure.

Pre-1.0 semver

calado-langchain is pre-1.0. Minor versions (0.x.0) may introduce breaking changes. Pin exactly until 1.0 ships. See CHANGELOG.md.

Links

Project details


Download files

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

Source Distribution

calado_langchain-0.0.1.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

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

calado_langchain-0.0.1-py3-none-any.whl (32.2 kB view details)

Uploaded Python 3

File details

Details for the file calado_langchain-0.0.1.tar.gz.

File metadata

  • Download URL: calado_langchain-0.0.1.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for calado_langchain-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a827ea8b5e3f63cf8bbd2a7cdef07ba15fc7cf4a82b0d52b207a7601b7106c39
MD5 eb07a3d9b0b79d5a27c4580baa9b8085
BLAKE2b-256 d7d65c5c8370f9ad80fe1eca88482874e9136a3bb0a292d69bb90a821c0af5b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for calado_langchain-0.0.1.tar.gz:

Publisher: publish-python-langchain.yml on 43designstudio/calado

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

File details

Details for the file calado_langchain-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for calado_langchain-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b111f30fafdf0987ac3b41c1b87b87ac6a2263c28224de770f790382ad531dbf
MD5 182cd204dfa299d562facc6b5782c0f8
BLAKE2b-256 75653795fdee4f3afb9b1f87930ba6e470f7cb85346cac550d9c8e3a7c8166bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for calado_langchain-0.0.1-py3-none-any.whl:

Publisher: publish-python-langchain.yml on 43designstudio/calado

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page