Skip to main content

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

Free vs Premium

Agent Magnet is fully usable without an account. The free tier is not a demo — it's the real thing.

Free (no account needed)

  • Local SQLite memory — no Redis, no external services
  • Single-user behavioral memory (preferences, corrections, forgetting)
  • Cross-tool identity — same memory across Claude Code, Cursor, any MCP client
  • Context compression (compress_context, retrieve_original)
  • Bring your own OpenAI key (BYOK)

Premium (API key from agentmagnet.app)

  • Team memory — share learned preferences across a team with a shared Redis
  • Hosted storage — Magnet-managed Redis, no infra to run
  • Compression analytics (compression_stats)
  • Priority support

To enable premium features, set MAGNET_API_KEY=mg_sk_... in your environment or pass it during agent-magnet init.

License

MIT

Metadata

Release files for agent-magnet 0.1.34

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-magnet 0.1.34
File Size Uploaded Provenance Actions
agent_magnet-0.1.34.tar.gz 123.1 kB Without provenance Details for agent_magnet-0.1.34.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-magnet 0.1.34
File Interpreter ABI Platform Actions
agent_magnet-0.1.34-py3-none-any.whl Python 3 none any Details for agent_magnet-0.1.34-py3-none-any.whl

Total release size: 245.5 kB

Release files / agent_magnet-0.1.34.tar.gz

Download URL agent_magnet-0.1.34.tar.gz
Size 123.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e8a3f803638ba88f4cc964be8d087648f2119a4d347b592de4478dd1a442186f
BLAKE2b-256 checksum
How to use checksums
2f012ea9fd269790d3f40f19da6233cd7a18aff8f781b60f1645cba5556da156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / agent_magnet-0.1.34-py3-none-any.whl

Download URL agent_magnet-0.1.34-py3-none-any.whl
Size 122.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e8ccfa09d48017ebd885364d3506500e1b7f178cef2a40cb63c52e998f417d7
BLAKE2b-256 checksum
How to use checksums
b7dddbbad5cc71061a725fec1c9ae52ae6976be8efeeeddbeb492cec88b63a4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for agent-magnet 0.1.34

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.34 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page