Skip to main content

langchain-1claw

PyPI License: MIT Python 3.10+

LangChain integration for 1Claw — HSM-backed secrets, multi-chain signing, encrypted memory, and workflow automations for AI agents.

Features

Category Components What it does
Secrets OneclawGetSecretTool, OneclawPutSecretTool, OneclawListSecretsTool, OneclawRotateSecretTool CRUD and rotation for HSM-encrypted vault secrets
Memory OneclawMemoryPutTool, OneclawMemoryGetTool, OneclawMemorySearchTool Encrypted persistent memory with semantic search
Signing OneclawSignMessageTool, OneclawSubmitTransactionTool, OneclawGetBalanceTool EIP-191 signing and multi-chain transaction submission (ETH, BTC, SOL, XRP, ADA, TRX)
Automations OneclawTriggerAutomationTool Trigger pre-configured workflow automations
Chat History OneclawChatMessageHistory, OneclawScratchChatMessageHistory BaseChatMessageHistory backed by encrypted memory
Retriever OneclawMemoryRetriever BaseRetriever backed by semantic memory search

Installation

pip install langchain-1claw

Quick Start

Tool-calling agent

from langchain_openai import ChatOpenAI
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_core.prompts import ChatPromptTemplate

from langchain_1claw import OneclawClient, get_all_tools

# Authenticate with your agent's API key
client = OneclawClient(api_key="ocv_your_agent_key")

# Get all 11 tools
tools = get_all_tools(client)

# Build an agent
llm = ChatOpenAI(model="gpt-4o")
prompt = ChatPromptTemplate.from_messages([
    ("system", "You are a helpful assistant with access to a secure vault, "
               "blockchain signing, encrypted memory, and workflow automations."),
    ("human", "{input}"),
    ("placeholder", "{agent_scratchpad}"),
])

agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)

result = executor.invoke({"input": "What API keys do we have stored?"})
print(result["output"])

Individual tools

from langchain_1claw import OneclawClient, OneclawGetSecretTool

client = OneclawClient(api_key="ocv_...")
tool = OneclawGetSecretTool(client=client)

# Use directly
api_key = tool.invoke({"path": "api-keys/openai"})

# Or with a specific vault
api_key = tool.invoke({"path": "api-keys/openai", "vault_id": "vault-uuid"})

Persistent chat history

from langchain_core.runnables.history import RunnableWithMessageHistory
from langchain_1claw import OneclawClient, OneclawChatMessageHistory

client = OneclawClient(api_key="ocv_...")

chain_with_history = RunnableWithMessageHistory(
    chain,
    lambda session_id: OneclawChatMessageHistory(
        client=client,
        session_id=session_id,
        max_messages=100,  # trim old messages
    ),
)

# Messages persist across sessions, encrypted at rest with HSM-managed keys
result = chain_with_history.invoke(
    {"input": "Remember that my favorite color is blue"},
    config={"configurable": {"session_id": "user-123"}},
)

Ephemeral scratch history (auto-expires)

from langchain_1claw import OneclawScratchChatMessageHistory

history = OneclawScratchChatMessageHistory(
    client=client,
    session_id="temp-session",
    ttl_secs=600,  # auto-delete after 10 minutes
)

Semantic memory retriever (RAG)

from langchain_1claw import OneclawClient, OneclawMemoryRetriever

client = OneclawClient(api_key="ocv_...")
retriever = OneclawMemoryRetriever(
    client=client,
    namespace="knowledge",
    top_k=5,
)

# Use in a RAG chain
docs = retriever.invoke("How do I deploy to production?")
for doc in docs:
    print(f"[{doc.metadata['key']}] {doc.page_content[:100]}...")

Multi-chain transaction signing

from langchain_1claw import OneclawClient, OneclawSubmitTransactionTool

client = OneclawClient(api_key="ocv_...")
tx_tool = OneclawSubmitTransactionTool(client=client)

# Sign and broadcast — private key never leaves the HSM
result = tx_tool.invoke({
    "chain": "ethereum",
    "to": "0xRecipientAddress",
    "value": "0.01",
    "simulate_first": True,  # Tenderly simulation before signing
})

Authentication

The client authenticates via agent API key exchange:

# Key-only auth (auto-discovers agent_id and vault_id)
client = OneclawClient(api_key="ocv_your_key")

# Explicit IDs
client = OneclawClient(
    api_key="ocv_your_key",
    agent_id="agent-uuid",
    vault_id="vault-uuid",
)

# Custom API endpoint
client = OneclawClient(
    api_key="ocv_your_key",
    base_url="https://your-vault.example.com",
)

JWTs are cached and automatically refreshed 60 seconds before expiry.

API Reference

Client

Method Description
get_secret(path) Fetch a decrypted secret
put_secret(path, value) Store or update a secret
list_secrets() List secret paths
delete_secret(path) Delete a secret
rotate_secret(path) Server-side secret rotation
memory_put(namespace, key, value) Store a memory entry
memory_get(namespace, key) Retrieve a memory entry
memory_search(namespace, query) Semantic search over memory
memory_list(namespace) List memory entries
memory_delete(namespace, key) Delete a memory entry
sign_message(message) EIP-191 personal_sign
sign_typed_data(typed_data) EIP-712 typed data signing
submit_transaction(chain, to, value) Sign and broadcast a transaction
sign_transaction(chain, to, value) Sign without broadcasting
list_signing_keys() List agent signing keys
get_signing_key_balance(chain) Get wallet balances
trigger_automation(automation_id) Trigger an automation
list_automations() List available automations
list_vaults() List accessible vaults

Tools

All tools accept a shared OneclawClient via the client parameter. Use get_all_tools(client) to get all 11 tools at once.

Development

git clone https://github.com/1clawAI/langchain-1claw.git
cd langchain-1claw
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src tests
ruff format src tests

# Type check
mypy

License

MIT — see LICENSE.

Download files

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

Source Distribution

langchain_1claw-0.1.0.tar.gz (19.0 kB view details)

Uploaded Source

Built Distribution

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

langchain_1claw-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for langchain_1claw-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9ccf929778772fbfcceb699e5703f9ed86a719eabdb2dc9885cc868d910f4bb3
MD5 8dcd5ebda3a735d80d095468e6d20a42
BLAKE2b-256 f8c9bce90f9f35ad1463f2dd35016ca19037888cf9d101865074df139472e618

See more details on using hashes here.

Provenance

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

Publisher: ci.yml on 1clawAI/langchain-1claw

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

File details

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

File metadata

  • Download URL: langchain_1claw-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for langchain_1claw-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b620b53b243b815263cb96f434b481556f1bba9bfa0e4f7385eca9f2caefaa5e
MD5 1b7049008e9ec4e049388a717770a40c
BLAKE2b-256 3a275a527794117575998c58fa1262fe6cf14ff2dffedb8d19a62331c4890f32

See more details on using hashes here.

Provenance

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

Publisher: ci.yml on 1clawAI/langchain-1claw

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