Skip to main content

smara-crewai

CrewAI integration for the Smara Memory API -- persistent, semantic memory for AI agents.

Install

pip install smara-crewai

Quick start

1. Memory backend (automatic)

Plug SmaraMemory into CrewAI so all agent memory is automatically persisted and retrieved via Smara.

import os
from crewai import Agent, Crew, Task
from smara_crewai import SmaraMemory

os.environ["SMARA_API_KEY"] = "smara_..."

crew = Crew(
    agents=[
        Agent(
            role="Researcher",
            goal="Find and remember key facts",
            backstory="You are a diligent research assistant.",
        )
    ],
    tasks=[
        Task(
            description="Research the latest AI memory techniques.",
            expected_output="A summary of techniques.",
        )
    ],
    memory=True,
    memory_config={
        "provider": SmaraMemory(user_id="research-session"),
    },
)

crew.kickoff()

Every memory created during the run is stored in Smara. On the next run (even from a different machine), the same memories are available.

2. Agent tools (explicit)

Give agents SmaraStoreTool and SmaraSearchTool so they can decide when to remember or recall information.

from crewai import Agent
from smara_crewai import SmaraStoreTool, SmaraSearchTool

store = SmaraStoreTool(user_id="customer-support")
search = SmaraSearchTool(user_id="customer-support")

agent = Agent(
    role="Support Agent",
    goal="Help customers and remember their preferences",
    backstory="You are a helpful support agent with long-term memory.",
    tools=[store, search],
)

The agent will autonomously call smara_store_memory when it learns something important and smara_search_memory when it needs past context.

3. Direct client usage

from smara_crewai.client import SmaraClient

client = SmaraClient(api_key="smara_...")

# Store
client.store(user_id="u1", fact="User prefers dark mode", importance=0.7)

# Search
results = client.search(user_id="u1", query="UI preferences")
for mem in results:
    print(mem["fact"], mem.get("score"))

# User context
ctx = client.get_context(user_id="u1")
print(ctx)

Configuration

Parameter Env var Default
api_key SMARA_API_KEY (required)
base_url SMARA_API_URL https://api.smara.io
user_id -- "default"

API reference

SmaraMemory (Storage backend)

  • save(value, metadata=None) -- store a memory (called automatically by CrewAI)
  • search(query, limit=5, score_threshold=0.0) -- retrieve relevant memories

SmaraStoreTool

Agent tool to store a memory. Accepts fact (str) and importance (float 0-1).

SmaraSearchTool

Agent tool to search memories. Accepts query (str) and limit (int 1-50).

Links

Metadata

Release files for smara-crewai 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for smara-crewai 0.1.0
File Size Uploaded
smara_crewai-0.1.0.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for smara-crewai 0.1.0
File Interpreter ABI Platform
smara_crewai-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / smara_crewai-0.1.0.tar.gz

Download URL smara_crewai-0.1.0.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fc61342e83a191a125b65e01f523f8d389994b3fec022d550fc974cb294deae1
BLAKE2b-256 checksum
How to use checksums
22994e5d84f5aed97f97f38c7d0e688487ddbddc612743c723051c6db774b832
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / smara_crewai-0.1.0-py3-none-any.whl

Download URL smara_crewai-0.1.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
479194f2cf0853937c5910b2d01fc9a09af6f85517c672892e56000065750169
BLAKE2b-256 checksum
How to use checksums
c66ee78724b0183a6f10e1f1ea05d771ccb3f97231aa2116dd34003fb6b0fe64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page