repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | --- |
| #2 | title: Camel AI |
| #3 | description: "Plug Mem0 cloud memory into Camel's agents with the built‑in Mem0Storage." |
| #4 | partnerBadge: "Camel AI" |
| #5 | --- |
| #6 | |
| #7 | # Camel AI integration |
| #8 | |
| #9 | Connect Camel's agent framework to Mem0 so every agent can persist and recall conversation context across sessions with minimal setup. |
| #10 | |
| #11 | <Info> |
| #12 | **Prerequisites** |
| #13 | - Mem0: `MEM0_API_KEY` (or self-hosted endpoint), `pip install mem0ai` |
| #14 | - Camel AI: `pip install camel-ai` (requires Python 3.9+) |
| #15 | - Optional: OpenAI API key if you run LLM-backed agents |
| #16 | </Info> |
| #17 | |
| #18 | <Note>Camel provides a Python SDK today. A TypeScript path is not available yet.</Note> |
| #19 | |
| #20 | ## Configure credentials |
| #21 | |
| #22 | <Tabs> |
| #23 | <Tab title="Mem0"> |
| #24 | <Steps> |
| #25 | <Step title="Export your API key"> |
| #26 | ```bash |
| #27 | export MEM0_API_KEY="sk-..." |
| #28 | ``` |
| #29 | </Step> |
| #30 | <Step title="(Self-host) Point to your Mem0 API"> |
| #31 | ```bash |
| #32 | export MEM0_BASE_URL="https://your-mem0-domain" |
| #33 | ``` |
| #34 | </Step> |
| #35 | </Steps> |
| #36 | </Tab> |
| #37 | <Tab title="Camel"> |
| #38 | <Steps> |
| #39 | <Step title="Install Camel with Mem0 dependency"> |
| #40 | ```bash |
| #41 | pip install "camel-ai>=0.2.0" mem0ai |
| #42 | ``` |
| #43 | </Step> |
| #44 | <Step title="(Optional) Add your model credentials"> |
| #45 | ```bash |
| #46 | export OPENAI_API_KEY="sk-openai..." |
| #47 | ``` |
| #48 | </Step> |
| #49 | </Steps> |
| #50 | </Tab> |
| #51 | </Tabs> |
| #52 | |
| #53 | <Tip> |
| #54 | Mem0Storage reads `MEM0_API_KEY` automatically. Pass `api_key` explicitly only when you need to override the environment. |
| #55 | </Tip> |
| #56 | |
| #57 | ## Wire Mem0 into a Camel agent |
| #58 | |
| #59 | <Steps> |
| #60 | <Step title="Create a Mem0-backed memory store"> |
| #61 | ```python |
| #62 | import os |
| #63 | from camel.storages import Mem0Storage |
| #64 | |
| #65 | mem0_store = Mem0Storage( |
| #66 | api_key=os.environ.get("MEM0_API_KEY"), |
| #67 | agent_id="travel_agent", |
| #68 | user_id="alice", |
| #69 | metadata={"source": "camel-demo"}, |
| #70 | ) |
| #71 | ``` |
| #72 | </Step> |
| #73 | <Step title="Attach it to Camel memory"> |
| #74 | ```python |
| #75 | from camel.memories import ChatHistoryMemory, ScoreBasedContextCreator |
| #76 | from camel.utils import OpenAITokenCounter |
| #77 | from camel.types import ModelType |
| #78 | |
| #79 | memory = ChatHistoryMemory( |
| #80 | context_creator=ScoreBasedContextCreator( |
| #81 | token_counter=OpenAITokenCounter(ModelType.GPT_4O_MINI), |
| #82 | token_limit=1024, |
| #83 | ), |
| #84 | storage=mem0_store, |
| #85 | agent_id="travel_agent", |
| #86 | ) |
| #87 | ``` |
| #88 | </Step> |
| #89 | <Step title="Let your agent read and write Mem0"> |
| #90 | ```python |
| #91 | from camel.agents import ChatAgent |
| #92 | from camel.messages import BaseMessage |
| #93 | |
| #94 | agent = ChatAgent( |
| #95 | system_message=BaseMessage.make_assistant_message( |
| #96 | role_name="Agent", |
| #97 | content="You are a helpful travel assistant. Reuse stored memories." |
| #98 | ) |
| #99 | ) |
| #100 | |
| #101 | agent.memory = memory |
| #102 | |
| #103 | response = agent.step( |
| #104 | BaseMessage.make_user_message( |
| #105 | role_name="User", |
| #106 | content="I prefer boutique hotels in Paris." |
| #107 | ) |
| #108 | ) |
| #109 | |
| #110 | print(response.msgs[0].content) |
| #111 | ``` |
| #112 | </Step> |
| #113 | </Steps> |
| #114 | |
| #115 | <Info icon="check"> |
| #116 | Run `python camel_mem0_demo.py` (or the snippet above in a REPL). You should see the agent respond and the memory persisted to Mem0. Re-running with a new prompt should include the stored preference. |
| #117 | </Info> |
| #118 | |
| #119 | ## Verify the integration |
| #120 | |
| #121 | - Mem0 dashboard shows new memories under `agent_id=travel_agent` and `user_id=alice`. |
| #122 | - `mem0_store.load()` returns the records you just wrote. |
| #123 | - Camel agent replies reference prior user preferences on subsequent runs. |
| #124 | |
| #125 | ## Troubleshooting |
| #126 | |
| #127 | - **Missing MEM0_API_KEY** — set `export MEM0_API_KEY="sk-..."` or pass `api_key` into `Mem0Storage`. |
| #128 | - **No memories returned** — ensure `agent_id`/`user_id` in your query match what you used when writing. |
| #129 | - **Network errors to Mem0** — if self-hosting, set `MEM0_BASE_URL` to your deployment URL. |
| #130 | |
| #131 | <CardGroup cols={2}> |
| #132 | <Card |
| #133 | title="Memory types in Mem0" |
| #134 | description="Choose between chat history and semantic search for your Camel agents." |
| #135 | icon="sparkles" |
| #136 | href="/core-concepts/memory-types" |
| #137 | /> |
| #138 | <Card |
| #139 | title="Try LangChain next" |
| #140 | description="Wire the same Mem0 project into LangChain workflows." |
| #141 | icon="rocket" |
| #142 | href="/integrations/langchain" |
| #143 | /> |
| #144 | </CardGroup> |
| #145 |