Skip to main content

langchain-1claw

PyPI License: MIT Python 3.10+

You're building a LangChain agent that needs API keys, wallet signing, or memory that survives across sessions. Pasting credentials into .env files works until you deploy, share the repo, or the model accidentally echoes a secret in chat.

This package gives your agent 11 LangChain tools backed by 1Claw. Secrets live in an HSM-encrypted vault. A human grants access through policies, so the agent only reads paths you allow. Signing keys never leave the server. Memory is encrypted and searchable.

Install one package, pass an ocv_ agent API key, and call get_all_tools(). You get vault CRUD, encrypted memory, EIP-191 signing, multi-chain transactions, and automation triggers without writing HTTP clients yourself.

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.

Platform v0.56+ (HITL, HFA, Safe, guardrail governance)

LangChain tools target 1Claw API v0.56+:

Capability Tool impact
Graduated HITL OneclawSubmitTransactionTool may return awaiting_approval — handle 202 in agent loops or use dashboard/mobile approvals.
Guardrail governance Execution intents and guardrail widening use server-side approval queues.
Safe foundation Agent Safe accounts via Vault API (CLI: 1claw agent accounts).
Multichain BTC/SOL/XRP/ADA/TRX signing unchanged; Vault/Shroud deps: rust-bitcoin, solana-sdk v4, xrpl-rust 1.1.0.

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.2.2.tar.gz (20.8 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.2.2-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: langchain_1claw-0.2.2.tar.gz
  • Upload date:
  • Size: 20.8 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.2.2.tar.gz
Algorithm Hash digest
SHA256 0296f9dc3e785089fe1c6bdfe8d7885353ec04374d277964b010ede4fda75393
MD5 1b96a3f3fe2dc7e4e1b3c40b4063d03c
BLAKE2b-256 827b63bb5f2d9684253866c69cec37c0289e150b72e425a53c5597b2c7b92a2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_1claw-0.2.2.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.2.2-py3-none-any.whl.

File metadata

  • Download URL: langchain_1claw-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 16.4 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.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 58bae6f47b79a89f8ef9be697997fec81845920a90205f21755e624d31f8ce51
MD5 6113cbfdd01b8660369a9dfb2c4346d4
BLAKE2b-256 b6dd42b4e02b6e30e09799ddbacf535f1b06bfaaeb8f679d13f1f99c02415aa5

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_1claw-0.2.2-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.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 files

0.1.0

2 files

Supported by

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