Integration

Long-term memory for CAMEL-AI agents

CAMEL-AI's 25k-star multi-agent framework is built around societies of agents that role-play and collaborate, but `ChatHistoryMemory`'s default storage is in-process and every agent's facts live in their own head. The recipe ships two layers: `EngramKeyValueStorage` is a `BaseKeyValueStorage` you slot into CAMEL's native `ChatHistoryMemory` so the full transcript survives restarts, and `make_engram_tools()` returns CAMEL `FunctionTool`s (`store_memory` + `query_memory`) the agent can call deliberately mid-thread.

Install

Three steps: sign up for an Engram API key, paste a BYOK LLM-provider key on /models, then drop the snippet below into CAMEL-AI.

Three steps to memory in your agent

  1. Sign up. Free, no card. You'll land on a Getting Started page that walks the next two steps.
  2. Add your LLM key. Engram is BYOK. Paste an OpenAI / Anthropic / Groq / Together / Fireworks key and we'll route every extraction and query call through your provider. You pay your provider directly. We never see your inference.
  3. Paste the snippet below into your agent and restart it. Use Authorization: Bearer <api-key>with the API key from your portal.

engram-camel: two layers — storage + tools

EngramKeyValueStorage slots into ChatHistoryMemory for passive durability; make_engram_tools() returns CAMEL FunctionTools for active fact storage. Source: github.com/lumetra-io/engram-camel-ai.

  1. Clone and install (not yet on PyPI):
  2. Terminal
    git clone https://github.com/lumetra-io/engram-camel-ai
    cd engram-camel-ai && pip install -e .
    export ENGRAM_API_KEY="<api-key>"
  3. Use both layers on a ChatAgent:
  4. Python
    from camel.agents import ChatAgent
    from camel.memories import ChatHistoryMemory
    from engram_camel import EngramKeyValueStorage, make_engram_tools
    
    agent = ChatAgent(
        system_message="You are a helpful researcher.",
        memory=ChatHistoryMemory(
            storage=EngramKeyValueStorage(bucket="history-user-1"),
        ),
        tools=make_engram_tools(bucket="facts-project-alpha"),
    )
  5. For RolePlaying societies, give each role its own history bucket and share one facts bucket so agents build on each other's discoveries.

What you can do once memory's wired in

  • Drop `EngramKeyValueStorage(bucket='my-agent-history')` into `ChatHistoryMemory(storage=...)` so a `ChatAgent` resumes mid-conversation after a process restart
  • Add `make_engram_tools(bucket='my-agent-facts')` to a `ChatAgent(tools=...)` for atomic-fact storage with hybrid retrieval
  • Share one facts bucket across every role in a `RolePlaying` society so the user agent and assistant agent draw from the same memory
  • Per-session history buckets + per-project facts buckets: `EngramKeyValueStorage(bucket=f'history-{user_id}-{session_id}')` paired with `make_engram_tools(bucket=f'facts-{project_id}')`

FAQ

Storage vs tools — which should I use?

Use both. Storage gives you passive durability (every turn auto-persisted, replayed verbatim into context on resume); tools give the agent active curation (one atomic fact per call, retrieved with BM25 + vector + graph fusion). Storage is for resuming conversations; tools are for long-term facts, preferences, and decisions.

Is this PyPI-installable?

Not yet. Clone the repo and `pip install -e .`. The recipe imports as `from engram_camel import EngramKeyValueStorage, make_engram_tools` and uses one `ENGRAM_API_KEY` for both layers.

Does this work with CAMEL's `RolePlaying` societies?

Yes. Both layers are agent-scoped, so each role in a society can have its own history bucket and either a private or shared facts bucket. The typical pattern is per-role history + one shared society-wide facts bucket so agents can build on each other's discoveries.

Ship durable memory in CAMEL-AI today

Free tier: 10K memories and 50K retrievals per month. No credit card. Same Engram backend powers all 41 integrations, so memories you write from one client are immediately queryable from the rest.