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 onContextWindowLike).create_copass_agent— shipped (lazy-importslanggraph).- First-class
ContextWindowintegration — lands whencopass-corev0.2 ships the primitive.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file copass_langchain-0.1.0.tar.gz.
File metadata
- Download URL: copass_langchain-0.1.0.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34210d0f1a06f7e69d6b7484777b06c3cbf638f1153d257e915ed63bc806ed37
|
|
| MD5 |
bb1a4a4baeed79a31903201cc07ee342
|
|
| BLAKE2b-256 |
cd837ccb8eefeee7fccf87f06cd101a86465ebdae479292ef2bcb39d0ff8355a
|
File details
Details for the file copass_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: copass_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1660aae571831c01236cee79c90e63ae777aa6a69067c80b8b05564fd02ec7bd
|
|
| MD5 |
ca2c1d4f1c4351299dbc0f1643031efd
|
|
| BLAKE2b-256 |
083a6e8d53823541bb416cdc457b59fdd5c50d8c3abd4ba35bda087a317cd4e9
|