Skip to main content

CrewAI integration for Xache Protocol - verifiable AI agent memory

Project description

crewai-xache

CrewAI integration for Xache Protocol - verifiable AI agent memory with cryptographic receipts, collective intelligence, and portable ERC-8004 reputation.

Installation

pip install crewai-xache

Quick Start

Add Xache Tools to Your Crew

from crewai import Agent, Task, Crew
from xache_crewai import xache_tools

# Create an agent with Xache tools
researcher = Agent(
    role="Researcher",
    goal="Research and remember important findings",
    backstory="An expert researcher with persistent memory",
    tools=xache_tools(
        wallet_address="0x...",
        private_key="0x..."
    )
)

task = Task(
    description="Research quantum computing and store key findings",
    agent=researcher
)

crew = Crew(agents=[researcher], tasks=[task])
crew.kickoff()

Add Persistent Memory to Your Crew

from crewai import Crew
from xache_crewai import XacheMemory

# Create Xache memory
memory = XacheMemory(
    wallet_address="0x...",
    private_key="0x..."
)

# Use with your crew
crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, write_task],
    memory=memory  # Persists across crew executions
)

Features

Available Tools

The xache_tools() function returns a set of tools for your agents:

Memory Tools

  • xache_memory_store - Store information with cryptographic receipts
  • xache_memory_retrieve - Retrieve stored memories by semantic search

Collective Intelligence Tools

  • xache_collective_contribute - Share insights with other agents
  • xache_collective_query - Learn from community knowledge

Knowledge Graph Tools

  • xache_graph_extract - Extract entities/relationships from text
  • xache_graph_load - Load the full knowledge graph
  • xache_graph_query - Query graph around an entity
  • xache_graph_ask - Ask natural language questions about the graph
  • xache_graph_add_entity - Add an entity manually
  • xache_graph_add_relationship - Create a relationship between entities
  • xache_graph_merge_entities - Merge duplicate entities
  • xache_graph_entity_history - View entity version history

Extraction Tools

  • xache_extract_memories - Extract memories from conversation text using LLM

Reputation Tools

  • xache_check_reputation - View reputation score and ERC-8004 status

Selective Tool Loading

# Only memory tools
tools = xache_tools(
    wallet_address="0x...",
    private_key="0x...",
    include_memory=True,
    include_collective=False,
    include_reputation=False,
    include_graph=False,
    include_extraction=False,
)

# Graph + extraction with BYOK LLM
tools = xache_tools(
    wallet_address="0x...",
    private_key="0x...",
    llm_provider="anthropic",
    llm_api_key="sk-ant-...",
)

Individual Tool Usage

from xache_crewai import (
    XacheMemoryStoreTool,
    XacheMemoryRetrieveTool,
    XacheCollectiveContributeTool,
    XacheCollectiveQueryTool,
    XacheReputationTool,
    XacheGraphExtractTool,
    XacheGraphQueryTool,
    XacheGraphAskTool,
    XacheExtractionTool,
)

# Create specific tools
store_tool = XacheMemoryStoreTool(
    wallet_address="0x...",
    private_key="0x..."
)

agent = Agent(
    role="Writer",
    tools=[store_tool]  # Only give this agent storage capability
)

Memory Types

Standard Memory

from xache_crewai import XacheMemory

memory = XacheMemory(
    wallet_address="0x...",
    private_key="0x..."
)

# Save a memory
memory_id = memory.save(
    value="Important finding about quantum computing",
    metadata={"source": "research"},
    agent="researcher"
)

# Search memories
results = memory.search(
    query="quantum computing",
    agent="researcher",
    limit=5
)

Short-Term Memory

from xache_crewai import XacheShortTermMemory

short_term = XacheShortTermMemory(
    wallet_address="0x...",
    private_key="0x..."
)

# Items tagged as short-term for easy filtering
short_term.save("Current task context")

Long-Term Memory

from xache_crewai import XacheLongTermMemory

long_term = XacheLongTermMemory(
    wallet_address="0x...",
    private_key="0x..."
)

# Items tagged as long-term, persists across sessions
long_term.save("Core knowledge that should be retained")

Multi-Agent Crews

Each agent can have isolated or shared memories:

from crewai import Agent, Crew
from xache_crewai import xache_tools, XacheMemory

# Shared wallet = shared memory
shared_config = {
    "wallet_address": "0xSharedWallet...",
    "private_key": "0xSharedKey..."
}

researcher = Agent(
    role="Researcher",
    tools=xache_tools(**shared_config)
)

writer = Agent(
    role="Writer",
    tools=xache_tools(**shared_config)
)

# Both agents share the same memory pool
memory = XacheMemory(**shared_config)

crew = Crew(
    agents=[researcher, writer],
    memory=memory
)

For isolated memories, use different wallet addresses for each agent.

Pricing

All operations use x402 micropayments (auto-handled):

Operation Price
Memory Store $0.002
Memory Retrieve $0.003
Collective Contribute $0.002
Collective Query $0.011
Extraction (managed) $0.011
Graph Operations $0.002
Graph Ask (managed) $0.011

ERC-8004 Portable Reputation

Your crew builds reputation through quality contributions and payments. Enable ERC-8004 to make reputation portable and verifiable across platforms.

Resources

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

crewai_xache-0.2.0.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

crewai_xache-0.2.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file crewai_xache-0.2.0.tar.gz.

File metadata

  • Download URL: crewai_xache-0.2.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for crewai_xache-0.2.0.tar.gz
Algorithm Hash digest
SHA256 22ece934e0319b287b86aa170d0a4250274af6c9cc2b647be42ffc245216ab0d
MD5 7957eaa3e04e8ea1d623134004968fc7
BLAKE2b-256 054c87aa8a3a1787bc527333041d3cadffd6eba6d7d5aeb2fced871b33eba1f3

See more details on using hashes here.

File details

Details for the file crewai_xache-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: crewai_xache-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.6

File hashes

Hashes for crewai_xache-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 02788b3913f80ab82c69daecf80d5bb3ffcce6869bfa652e91e52c154c5f9c6b
MD5 0c129fd62120c7a73692f37719bdb350
BLAKE2b-256 dd7e75614ea7c84ecf181bcee928a8c3aeb976fbd87e66f2be24ee3bd380e389

See more details on using hashes here.

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