Metadata-Version: 2.4
Name: 1claw-crewai-tools
Version: 0.2.0
Summary: CrewAI tools for 1Claw — HSM-backed secrets, signing, memory, and automations for AI agents
Author-email: 1Claw <ops@1claw.xyz>
License-Expression: MIT
Project-URL: Documentation, https://docs.1claw.xyz/docs/integrations/crewai
Project-URL: Homepage, https://github.com/1ClawAI/1claw-crewai-tools
Project-URL: Repository, https://github.com/1ClawAI/1claw-crewai-tools
Project-URL: Changelog, https://github.com/1ClawAI/1claw-crewai-tools/releases
Keywords: 1claw,crewai,secrets,vault,agents,signing,memory,hsm,blockchain
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: crewai>=0.100.0
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
Requires-Dist: respx>=0.21; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: freezegun>=1.5; extra == "dev"
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Dynamic: license-file

# 1claw-crewai-tools

[![PyPI version](https://img.shields.io/pypi/v/1claw-crewai-tools.svg)](https://pypi.org/project/1claw-crewai-tools/)
[![Python versions](https://img.shields.io/pypi/pyversions/1claw-crewai-tools.svg)](https://pypi.org/project/1claw-crewai-tools/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![CI](https://github.com/1ClawAI/1claw-crewai-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/1ClawAI/1claw-crewai-tools/actions/workflows/ci.yml)

**CrewAI tools for [1Claw](https://1claw.xyz) — HSM-backed secrets, multi-chain signing, encrypted memory, and automation workflows for AI agents.**

11 tools that give CrewAI agents secure access to vault secrets, blockchain signing keys, persistent memory, and workflow automations — all guarded by policy-based access control. Private keys never leave the HSM.

## Install

```bash
pip install 1claw-crewai-tools
```

> PyPI package: **`1claw-crewai-tools`** · Python import: **`oneclaw_crewai`**

## Quick Start

### All tools at once (recommended)

```python
import os
from crewai import Agent, Crew, Process, Task
from oneclaw_crewai import OneclawClient, get_all_tools

client = OneclawClient(
    api_key=os.environ["ONECLAW_AGENT_API_KEY"],
    # agent_id and vault_id are auto-resolved from the API key
)

tools = get_all_tools(client)  # 11 tools

researcher = Agent(
    role="Blockchain Researcher",
    goal="Check wallet balances and sign transactions",
    backstory="You use 1Claw tools for all credential and signing operations.",
    tools=tools,
)

task = Task(
    description="Check the Ethereum balance, then sign the message 'hello world'.",
    expected_output="Balance and signature details.",
    agent=researcher,
)

crew = Crew(agents=[researcher], tasks=[task], process=Process.sequential)
crew.kickoff()
```

### Single tool (backward-compatible)

```python
from oneclaw_crewai import OneclawVaultTool

vault_tool = OneclawVaultTool(
    agent_id=os.environ["ONECLAW_AGENT_ID"],
    api_key=os.environ["ONECLAW_AGENT_API_KEY"],
    vault_id=os.environ["ONECLAW_VAULT_ID"],
)

agent = Agent(
    role="Engineer",
    goal="Build features using vault-stored API keys",
    backstory="You use tools instead of pasted secrets.",
    tools=[vault_tool],
)
```

## Available Tools

| Tool | Name | Description |
|------|------|-------------|
| `OneclawVaultTool` | `oneclaw_vault` | Fetch a decrypted secret by path |
| `OneclawPutSecretTool` | `oneclaw_put_secret` | Store or update a secret |
| `OneclawListSecretsTool` | `oneclaw_list_secrets` | List secrets (paths, not values) |
| `OneclawRotateSecretTool` | `oneclaw_rotate_secret` | Server-side secret rotation |
| `OneclawMemoryPutTool` | `oneclaw_memory_put` | Store a value in encrypted memory |
| `OneclawMemoryGetTool` | `oneclaw_memory_get` | Retrieve a value from memory |
| `OneclawMemorySearchTool` | `oneclaw_memory_search` | Semantic search over memory |
| `OneclawSignMessageTool` | `oneclaw_sign_message` | EIP-191 message signing |
| `OneclawSubmitTransactionTool` | `oneclaw_submit_transaction` | Sign and broadcast transactions |
| `OneclawGetBalanceTool` | `oneclaw_get_balance` | Check signing key balances |
| `OneclawTriggerAutomationTool` | `oneclaw_trigger_automation` | Trigger automation workflows |

## Multi-Agent Crew Example

```python
from crewai import Agent, Crew, Process, Task
from oneclaw_crewai import OneclawClient, get_all_tools

client = OneclawClient(api_key=os.environ["ONECLAW_AGENT_API_KEY"])
tools = get_all_tools(client)

# Agent 1: Manages secrets and credentials
secrets_agent = Agent(
    role="Secrets Manager",
    goal="Manage and rotate API credentials securely",
    backstory="You handle all credential lifecycle operations.",
    tools=tools,
)

# Agent 2: Handles blockchain operations
blockchain_agent = Agent(
    role="Blockchain Operator",
    goal="Execute blockchain transactions safely",
    backstory="You check balances and sign transactions using 1Claw.",
    tools=tools,
)

# Agent 3: Remembers context across sessions
memory_agent = Agent(
    role="Knowledge Manager",
    goal="Store and recall important information",
    backstory="You use encrypted memory for persistent knowledge.",
    tools=tools,
)

rotate_task = Task(
    description="Rotate the secret at 'api-keys/external-service'.",
    expected_output="Confirmation of rotation with new version number.",
    agent=secrets_agent,
)

balance_task = Task(
    description="Check the Ethereum signing key balance.",
    expected_output="Native balance in ETH.",
    agent=blockchain_agent,
)

remember_task = Task(
    description="Store today's rotation status in memory under key 'last-rotation'.",
    expected_output="Confirmation that the value was stored.",
    agent=memory_agent,
)

crew = Crew(
    agents=[secrets_agent, blockchain_agent, memory_agent],
    tasks=[rotate_task, balance_task, remember_task],
    process=Process.sequential,
)
crew.kickoff()
```

## Authentication

The `OneclawClient` supports two auth patterns:

**Key-only (recommended)** — agent ID and vault ID auto-resolved:
```python
client = OneclawClient(api_key="ocv_...")
```

**Explicit IDs** — for backward compatibility or multi-vault setups:
```python
client = OneclawClient(
    api_key="ocv_...",
    agent_id="<agent-uuid>",
    vault_id="<vault-uuid>",
)
```

## Testing

### Unit tests (offline, no credentials needed)

```bash
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest -v
ruff check src tests
```

All network calls are mocked with `respx`; no 1Claw account required.

## Security

- Tool output can contain **plaintext credentials**. Never `print()` or log return values.
- All tools set `cache_function` to always return `False` — no framework-level caching.
- CrewAI's `verbose=True` prints tool output to stdout — use `verbose=False` in production.
- Private signing keys **never leave the HSM** — signing happens server-side.

## Links

- [1Claw Documentation](https://docs.1claw.xyz)
- [CrewAI Integration Guide](https://docs.1claw.xyz/docs/integrations/crewai)
- [Source Code](https://github.com/1ClawAI/1claw-crewai-tools)

## License

MIT — see [LICENSE](LICENSE).
