{
 "schema_version": 1,
 "generated": "2026-10-24",
 "id": "tencentcloud-octop-memory--add-memory-to-a-python-agent",
 "repo": "TencentCloud/octop-memory",
 "repo_url": "https://github.com/TencentCloud/octop-memory",
 "repo_slug": "tencentcloud-octop-memory",
 "title": "Add capture and recall to a custom Python agent",
 "page_title": "How to add capture and recall to a custom Python agent with Octop Memory",
 "summary": "Call MemoryService from your own agent loop to capture turns and recall context.",
 "who": "A Python developer building a custom agent who needs it to keep context from earlier turns and sessions.",
 "problem": "The agent loses earlier conversation context and has no shared memory layer to query.",
 "outcome": "Each turn is captured and relevant memory is returned as prompt-ready text before the next model call.",
 "steps": [
  "Run `pip install octop-memory`",
  "Create a Memory object with namespace=\"<namespace>\" and backend_config={\"db_path\": \"<db path>\"}",
  "Wrap it with MemoryService(memory) in your agent code",
  "Call capture_turn() after each exchange, and recall(\"<query>\") before each model call",
  "Inject result.rendered into the model prompt and print it during testing"
 ],
 "agent_prompt": "Use the octop-memory repo to wire MemoryService into the agent in <project path> with the SQLite database at <db path>. Run one captured turn and one recall with the query <query>, then return result.rendered. Verify that the recall output includes the text from the captured turn.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "45 minutes",
 "basis": "readme",
 "caveat": "Automated capture and extraction depend on the LLMClient you inject, because the package does not configure a model on install.",
 "category": "Personal productivity",
 "tags": [
  "Personal productivity"
 ],
 "lang": "python",
 "requirements": [
  "Python 3.12 or newer",
  "pip to install the octop-memory package",
  "A database path for local SQLite storage, or a PostgreSQL DSN for server deployments",
  "An injected LLMClient only if you want automated extraction, promotion, or page regeneration; manual storage and lexical recall work without a model"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/tencentcloud-octop-memory/add-memory-to-a-python-agent/",
 "md": "https://dedupedai.com/use-cases/tencentcloud-octop-memory/add-memory-to-a-python-agent/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/tencentcloud-octop-memory--add-memory-to-a-python-agent.json",
 "api_version": "v1"
}
