Skip to main content

LangChain integration for the Colber platform — callbacks, memory, and a 6-service toolkit.

Project description

colber-langchain

LangChain integration for the Colber platform — observability callbacks, semantic memory backed by colber-memory, and a 6-service toolkit. Apache-2.0.

This is the first public plugin in the "Lego" GTM lever. It depends only on langchain-core (not the full langchain package) and the published colber-sdk PyPI release, so it stays lightweight and is independently versionable.

Install

pip install colber-langchain

For local development inside the Colber monorepo:

pip install -e apps/colber-langchain

Components

ColberCallbackHandler

Captures LangChain run events as Colber observability spans + structured logs. Attach to any chain / agent via the standard callbacks=[...] argument.

from colber_langchain import ColberCallbackHandler

callback = ColberCallbackHandler(
    agent_did="did:key:z6Mk...",
    operator_id="op-demo",
    service_name="my-langchain-agent",
)
# Then plug into any LangChain runnable:
result = my_chain.invoke({"input": "hello"}, config={"callbacks": [callback]})

Hooks covered: on_chain_start/end/error, on_llm_start/end/error, on_chat_model_start, on_tool_start/end/error, on_agent_action, on_agent_finish. Each hook produces a span; *_error hooks also emit a structured log. Trace correlation follows LangChain's parent_run_id so every nested step lives under a single trace id.

Network failures to the observability service are caught and logged at WARN; the chain is never aborted because the backend is sick.

ColberMemory

Backs LangChain's BaseMemory with the colber-memory service (Qdrant + ACL + chiffrement). Cross-agent share semantics are wired in: pass share_with=[did1, did2, ...] and every saved memory is automatically shared.

from colber_langchain import ColberMemory

memory = ColberMemory(
    agent_did="did:key:z6Mk...",
    top_k=5,
    share_with=["did:key:z6MkPeer1", "did:key:z6MkPeer2"],
)

A chat-history flavour (ColberChatMessageHistory) is also exported for use with RunnableWithMessageHistory.

ColberToolkit

Exposes the 6 Colber services as LangChain tools (one per operation, 14 in total).

from colber_langchain import ColberToolkit

toolkit = ColberToolkit()
tools = toolkit.get_tools()  # list[BaseTool]
Service Tools
identity colber_identity_register, colber_identity_resolve
reputation colber_reputation_score, colber_reputation_feedback
memory colber_memory_store, colber_memory_query, colber_memory_share
negotiation colber_negotiation_start, colber_negotiation_propose, colber_negotiation_counter, colber_negotiation_settle
insurance colber_insurance_quote, colber_insurance_subscribe, colber_insurance_claim

Pass services=["negotiation", "insurance"] to scope down the surface for a deal-only agent.

The observability service is not exposed as a tool — ColberCallbackHandler already gives the agent first-class observability without LLM-driven calls.

Configuration

The plugin reads three environment variables when no explicit ColberClient is passed:

Env var Description
COLBER_BASE_URLS JSON object mapping each of the 6 service names to its base URL. Wins if set.
COLBER_BASE_URL Single ingress base URL (e.g. https://api.colber.dev); paths are appended internally per ColberClient.from_base_url.
COLBER_AUTH_TOKEN Optional bearer token forwarded to every Colber service.

If none are set, the plugin falls back to ColberClient.local() (β-VM ports on localhost).

You can always pass a pre-built client explicitly:

from colber_sdk import ColberClient
from colber_langchain import ColberToolkit

client = ColberClient.from_base_url("https://api.colber.dev", auth_token="...")
toolkit = ColberToolkit(client=client)

Out of scope (Wave 2.1+ follow-up)

  • LangGraph integration (custom graph nodes wrapping Colber services).
  • Custom prompt templates pre-baked with reputation/memory context.
  • Attestation flow helpers (auto-sign + verify Colber payloads inside an agent loop).

These are noted as Wave 2.1+ follow-ups in the Colber ROADMAP.

License

Apache-2.0 — same license as colber-sdk and @colber/mcp.

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

colber_langchain-0.1.0.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

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

colber_langchain-0.1.0-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: colber_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for colber_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb2d742abaa7a6be28c7d35ab2d861dd3d23b61fb91f0c872f702412e60f6031
MD5 3df5fe1896361471f1c401f6bf0c6f83
BLAKE2b-256 0c41d0fd0e514e6386b6b3cddad9cb5c149465ed7eaba91bdb9856800c487545

See more details on using hashes here.

Provenance

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

Publisher: release-colber-langchain.yml on Obi49/Colber

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

File details

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

File metadata

File hashes

Hashes for colber_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6faeaf2374ecac015b4498d0b4cbbfcbaafbd4a08c6fad63a70f6fc267e974bd
MD5 47df33c379702f5b580972d3469f4366
BLAKE2b-256 15b380e8461c6c5698a0bb0b20a03c6d99c8b75c39300885be5adfe925c5e6f7

See more details on using hashes here.

Provenance

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

Publisher: release-colber-langchain.yml on Obi49/Colber

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