Simple Key-Value Store for Python AI Agents

Free · Open source (MIT) · Works with LangChain, CrewAI, AutoGen · No signup

You're building a Python AI agent that needs to remember things between runs, but Redis feels like overkill and SQLite requires too much boilerplate. You just want simple key-value storage that works out of the box — no setup, no configuration, no database management.

The Problem with Agent State

Most Python developers hit this wall within hours of building their first AI agent. Your agent learns something useful, makes a decision, or processes user data — then the process restarts and everything vanishes.

# This doesn't survive restarts
agent_memory = {}
agent_memory["user_preference"] = "dark_mode"
agent_memory["last_action"] = "sent_email"

# Process restarts... memory gone

You need persistent storage, but the traditional options are frustrating. Redis requires a server installation and connection management. SQLite needs schema design and SQL queries. JSON files break with concurrent access. Dictionary persistence libraries often fail silently or lack proper error handling.

Your agent needs to remember user preferences, track conversation state, store API tokens, cache expensive computations, or maintain task progress. Without reliable python agent storage, you're rebuilding state from scratch every time.

The Fix: BotWire Memory

BotWire Memory gives you persistent key-value storage in three lines of code. No servers, no configuration, no API keys.

pip install botwire
from botwire import Memory

# Create a namespaced memory store
memory = Memory("my-agent")

# Store any JSON-serializable data
memory.set("user_id", "alice-123")
memory.set("preferences", {"theme": "dark", "notifications": True})
memory.set("conversation_count", 42)

# Retrieve data (survives process restarts)
user_id = memory.get("user_id")  # "alice-123"
prefs = memory.get("preferences")  # {"theme": "dark", "notifications": True}
count = memory.get("conversation_count", default=0)  # 42

That's it. Your data persists across restarts, processes, and even different machines.

How It Works

BotWire Memory is a simple HTTP-backed key-value store. Each Memory("namespace") creates an isolated storage space for your agent. Data is automatically serialized to JSON and stored remotely at https://botwire.dev.

from botwire import Memory

# Different agents, isolated storage
user_agent = Memory("user-sessions")
task_agent = Memory("background-tasks")

# Set with automatic JSON serialization
user_agent.set("session_42", {
    "user_id": "alice", 
    "started_at": "2024-01-15T10:30:00Z",
    "messages": 15
})

# Get with default values
session = user_agent.get("session_42", default={})
message_count = session.get("messages", 0)

# List all keys in namespace
all_sessions = user_agent.list_keys()  # ["session_42", "session_43", ...]

# Delete when done
user_agent.delete("session_42")

The ai agent kv store automatically handles JSON serialization, so you can store dictionaries, lists, strings, numbers, and booleans directly. No manual encoding required.

Cross-process access works seamlessly. Multiple Python processes can share the same namespace, making it perfect for distributed agents or microservices that need shared state.

# Process A
memory = Memory("shared-counter")
memory.set("count", 100)

# Process B (different machine, same namespace)
memory = Memory("shared-counter") 
current = memory.get("count")  # 100
memory.set("count", current + 1)

Framework Integration

BotWire includes adapters for popular agent frameworks. For LangChain applications, use BotWireChatHistory to persist conversation memory:

from langchain.llms import OpenAI
from botwire import BotWireChatHistory

# Persistent chat history per user
history = BotWireChatHistory(session_id="user-alice")

# LangChain will automatically save/load messages
llm = OpenAI()
result = llm.predict("Hello!", chat_history=history)
# Chat history survives restarts

For CrewAI agents, use the built-in memory tools:

from botwire.memory import memory_tools

# Get remember/recall/list_memory tools
tools = memory_tools("crew-mission-alpha")

# CrewAI agents can now remember things between tasks
# Tools: remember(key, value), recall(key), list_memory()

When NOT to Use BotWire

BotWire Memory is purpose-built for simple python storage needs, but it's not right for every use case:

Vector search or embeddings — BotWire stores JSON, not vectors. Use Pinecone or Weaviate for semantic search. • High-throughput applications — The free tier limits writes to 1000/day per namespace. Use Redis for thousands of operations per minute. • Sub-millisecond latency — HTTP calls add ~50-200ms. Use in-memory caches for microsecond response times.

FAQ

Why not just use Redis? Redis requires server installation, connection management, and configuration. BotWire works immediately with zero setup, making it perfect for prototypes and simple agents.

Is this actually free? Yes, permanently. 1000 writes/day per namespace, 50MB storage per namespace, unlimited reads. No credit card required, no signup, no API keys.

What about data privacy? Data is stored on BotWire servers. For sensitive data, self-host the open-source version (MIT license, single FastAPI + SQLite service) or use local storage solutions.

BotWire Memory eliminates the friction between "quick prototype" and "production-ready agent storage." Install it, add three lines of code, and your Python agents can finally remember things that matter.

pip install botwire

Get started at https://botwire.dev.

Install in one command:

pip install botwire

Start free at botwire.dev