DEDUPED Hot AI repos, turned into use cases Get the Monday 5

How to add capture and recall to a custom Python agent with Octop Memory

Call MemoryService from your own agent loop to capture turns and recall context.

Who it is forA Python developer building a custom agent who needs it to keep context from earlier turns and sessions.

The problemThe agent loses earlier conversation context and has no shared memory layer to query.

The outcomeEach turn is captured and relevant memory is returned as prompt-ready text before the next model call.

What you need first

  • 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

Steps

  1. Run pip install octop-memory
  2. Create a Memory object with namespace="<namespace>" and backend_config={"db_path": "<db path>"}
  3. Wrap it with MemoryService(memory) in your agent code
  4. Call capture_turn() after each exchange, and recall("<query>") before each model call
  5. Inject result.rendered into the model prompt and print it during testing

Prompt for your agent

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.

Caveat. Automated capture and extraction depend on the LLMClient you inject, because the package does not configure a model on install.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for TencentCloud/octop-memory and "Add capture and recall to a custom Python agent"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer