Skip to main content

Self-learning memory infrastructure for AI products

Project description

Agent Magnet

Self-learning memory infrastructure for AI products. It learns from what users do — not what they say.

Installation

pip install agent-magnet

Two Integration Modes

1. MCP Server (Free, Self-Hosted)

Run on your own infrastructure. You control your data.

Add to your MCP config (Claude Desktop / Cursor / any MCP client):

{
  "mcpServers": {
    "agent-magnet": {
      "command": "agent-magnet-mcp",
      "env": {
        "MAGNET_REDIS_URL": "your_redis_url",
        "MAGNET_OPENAI_KEY": "your_openai_key"
      }
    }
  }
}

Tools available:

  • get_profile — get learned memory profile for a user
  • inject_memory — get memory injection string for system prompt
  • add_signal — record a behavioral signal
  • get_cold_start — get onboarding profile for new users
  • get_team_profile — get shared team memory (requires Redis)
  • get_merged_injection — merged user + team + org memory injection
  • get_project_memory — per-user breakdown of what was learned in a project
  • share_to_team — explicitly share a personal preference to team memory
  • forget_team — remove a preference from team memory
  • add_team_signal — record a signal directly to team scope

2. Proxy (Hosted, Dashboard included)

Change one line. We handle the infrastructure.

from openai import OpenAI

client = OpenAI(
    api_key="mg_sk_...",
    base_url="https://magnet-gateway.onrender.com/v1",
    default_headers={"x-session-id": "user_123"}
)

Get your API key: agentmagnet.app

Team Memory

Memory works for individual users out of the box. To share memory across a team, add Redis and a shared MAGNET_TEAM_ID.

Solo (local SQLite, no Redis needed):

agent-magnet init
# Use local storage? Y
# Team ID: (press Enter to skip)

Each person's preferences are stored privately on their machine.

Team (shared Redis):

agent-magnet init
# Use local storage? N
# Redis URL: redis://your-redis-host:6379
# Team ID: acme-eng

All team members point to the same Redis. Memory is scoped per-user but team-level insights are available.

What team memory gives you:

get_project_memory(project_id="acme-app")
# →
# {
#   "contributors": {
#     "ahmet": {"prefers": ["short responses", "Turkish"], "watch_out": ["never use em-dashes"]},
#     "ayse":  {"prefers": ["detailed explanations"], "dislikes": ["bullet lists"]}
#   },
#   "team_shared": {
#     "prefers": ["short responses"],   ← promoted because 2+ users share it
#     "watch_out": []
#   }
# }

Explicitly share a preference to team:

share_to_team(user_id="ahmet", fact_or_subject="short responses", team_id="acme-eng")

Team memory requires Redis. If you try to use team tools in local mode you'll get:

Team memory requires shared storage. Set MAGNET_REDIS_URL for all team members to use the same Redis instance.

How It Learns

Magnet observes behavioral signals — corrections, rejections, implicit patterns — and builds a living profile per user. No configuration required.

Three memory layers:

  • Behavioral (Redis) — real-time, every request
  • Episodic (Qdrant) — semantic recall when relevant
  • Knowledge (Neo4j) — long-term entity relationships

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_magnet-0.1.12.tar.gz (55.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_magnet-0.1.12-py3-none-any.whl (59.4 kB view details)

Uploaded Python 3

File details

Details for the file agent_magnet-0.1.12.tar.gz.

File metadata

  • Download URL: agent_magnet-0.1.12.tar.gz
  • Upload date:
  • Size: 55.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for agent_magnet-0.1.12.tar.gz
Algorithm Hash digest
SHA256 2d0d5a4a831b27e78d59d6b1f81d65c2837a80e59f5d003a63e3f13b50f07d3b
MD5 22d2c763b1eac26b39bba66895c0f4b9
BLAKE2b-256 12e759d3be6b0bde641bbfa7699b863b10da367b85ce6f77e5a6cd493c1906ea

See more details on using hashes here.

File details

Details for the file agent_magnet-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: agent_magnet-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 59.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for agent_magnet-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 6b07fd40c3369a4b23e422958a4610853f46ef7f58ce28ef9ac03e56e8b32d10
MD5 a1454cf3d88246e95011fe9b6f863428
BLAKE2b-256 ab61b5f0d2365c32260332ca93d0b641535159b7011a5224abfbb9cf54db8853

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page