Skip to main content

LangChain tool adapters for Copass — drop-in discover/interpret/search tools for LangChain agents

Project description

copass-langchain

LangChain tool adapters for Copass. Python mirror of @copass/langchain. Pulls discover / interpret / search into any LangChain agent, and (optionally) wires them into LangGraph's ReAct prebuilt.

Install

pip install copass-langchain
# or, with the create_copass_agent convenience wrapper:
pip install copass-langchain[agent]

Depends on copass-core + copass-config + langchain-core. langgraph is optional — only needed for create_copass_agent.

Drop-in tools

from copass_core import ApiKeyAuth, CopassClient
from copass_langchain import copass_tools

client = CopassClient(auth=ApiKeyAuth(key="olk_..."))

tools = copass_tools(client=client, sandbox_id="sb_...")
# Pass `tools.all()` (a list of three StructuredTool instances) to your
# agent framework, or pull them individually:
# tools.discover, tools.interpret, tools.search

Tool descriptions and parameter descriptions come from copass-config — identical to the strings used across every other Copass adapter.

Window-aware retrieval (when a Context Window exists)

copass-core v0.1 does not yet ship a ContextWindow class (deferred to v0.2). Until then, copass_tools and CopassWindowCallback accept any object satisfying ContextWindowLike:

class ContextWindowLike(Protocol):
    def get_turns(self) -> list[ChatMessage]: ...
    def add_turn(self, turn: ChatMessage) -> Awaitable[None]: ...

When copass-core ships ContextWindow, it will satisfy this protocol and window-aware retrieval will light up without any consumer changes.

Full agent in one call

from copass_langchain import create_copass_agent
from langchain_anthropic import ChatAnthropic

agent = create_copass_agent(
    client=client,
    sandbox_id="sb_...",
    llm=ChatAnthropic(model="claude-opus-4-7"),
    # window=my_window,  # optional — enables window-aware retrieval + auto-mirroring
)

result = await agent.ainvoke({
    "messages": [("user", "why is checkout flaky?")]
})

Status

  • copass_tools — shipped.
  • CopassWindowCallback — shipped (generic on ContextWindowLike).
  • create_copass_agent — shipped (lazy-imports langgraph).
  • First-class ContextWindow integration — lands when copass-core v0.2 ships the primitive.

Conversation metadata

CopassWindowCallback delegates to ContextWindow.add_turn, so any speaker / participants configured on the underlying window flow through automatically — no LangChain-specific wiring needed:

window = await client.context_window.create(
    sandbox_id=sandbox_id,
    participants=["User", "agent:support-bot"],   # roster set once
)
callback = CopassWindowCallback(window=window)

When the LangChain callback emits a turn, the window's constructor-time roster + role-derived speaker ride on the envelope. Set ChatMessage.name on a turn for richer per-turn speaker provenance — see copass-core for the full envelope surface.

License

MIT.

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

copass_langchain-1.4.8.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

copass_langchain-1.4.8-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file copass_langchain-1.4.8.tar.gz.

File metadata

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

File hashes

Hashes for copass_langchain-1.4.8.tar.gz
Algorithm Hash digest
SHA256 c3a4be99d18239559feffa292fad9b5adf4d7a409281ff25a02f7429ca2f4a19
MD5 709e45232efd2dbd21635f30a2453481
BLAKE2b-256 1f4b9eef62652d8464412318c00f580a9bfa63c41d25cac7b5f7462b4fafe0e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_langchain-1.4.8.tar.gz:

Publisher: release-python.yml on olane-labs/copass

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

File details

Details for the file copass_langchain-1.4.8-py3-none-any.whl.

File metadata

File hashes

Hashes for copass_langchain-1.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 052f5d9681e0a0d80f8ccfcff0f02d3e11ce1290ea25f337c3896b898224cd80
MD5 b82091763f637482b5832bb700ed7589
BLAKE2b-256 3437b00be2a5912b44857c0bf92d170e475420d6b030fdd1ea933a07f7380bd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for copass_langchain-1.4.8-py3-none-any.whl:

Publisher: release-python.yml on olane-labs/copass

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