Overview
Claude Managed Agents is Anthropic’s hosted platform for running autonomous AI agents. Mengram connects via MCP to give your agents persistent memory across sessions — facts, events, and self-improving workflows.
Setup
1. Get a Mengram API key
Sign up at mengram.io — free tier includes 40 adds and 200 searches per month.
2. Add Mengram to your agent definition
{
"name": "my-agent",
"model": "claude-sonnet-4-6",
"instructions": "You are a helpful assistant with persistent memory.",
"mcp_servers": [
{
"type": "url",
"name": "mengram",
"url": "https://mengram.io/mcp"
}
],
"tools": [
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": true,
"permission_policy": {"type": "always_allow"}
}
},
{
"type": "mcp_toolset",
"mcp_server_name": "mengram",
"default_config": {
"enabled": true,
"permission_policy": {"type": "always_allow"}
}
}
]
}
Set permission_policy to always_allow for the MCP toolset. The default (always_ask) requires manual tool confirmation via the API — without it, every memory tool call will time out.
3. Store your API key in a vault
Managed Agents use vaults for secrets. Create a vault, add your Mengram API key as a static_bearer credential, then pass the vault when creating a session:
import anthropic
client = anthropic.Anthropic()
# Create a vault for this user
vault = client.beta.vaults.create(display_name="My User")
# Add Mengram API key as a credential
client.beta.vaults.credentials.create(
vault_id=vault.id,
display_name="Mengram Memory",
auth={
"type": "static_bearer",
"mcp_server_url": "https://mengram.io/mcp",
"token": "om-your-mengram-api-key",
},
)
# Create an environment (container config for the session)
env = client.beta.environments.create(display_name="Default")
# Create a session — Anthropic injects the token automatically
session = client.beta.sessions.create(
agent=agent.id,
vault_ids=[vault.id],
environment_id=env.id,
)
Once connected, your agent gets 29 memory tools:
Core Memory
| Tool | Description |
|---|
remember | Save conversation to memory — auto-extracts facts, events, procedures |
remember_text | Save plain text to memory |
recall | Semantic search through past memories |
search | Advanced structured search with relevance scores |
search_all | Unified search across all 3 memory types |
timeline | Search memory by time range |
list_memories | List all stored entities |
Procedural Learning
| Tool | Description |
|---|
list_procedures | Retrieve learned workflows with success/failure tracking |
procedure_feedback | Report outcomes — procedures evolve on failure |
procedure_history | View how a procedure evolved over time |
Context & Profile
| Tool | Description |
|---|
context_for | Get relevant context pack for a specific task |
checkpoint | Save a session checkpoint with key decisions |
generate_rules_file | Generate project rules from memory |
Knowledge Graph
| Tool | Description |
|---|
get_graph | Get all entities and relationships |
get_entity | Get details of a specific entity |
merge_entities | Merge duplicate entities |
dedup | Auto-find and merge duplicates |
Insights
| Tool | Description |
|---|
reflect | Trigger AI reflection on memories |
get_reflections | Get AI-generated insights and patterns |
run_agents | Run memory agents (curator, connector, digest) |
For the complete list of all 29 tools with parameters, see MCP Server.
Example: Support agent
import anthropic
client = anthropic.Anthropic()
# Create the agent with Mengram MCP
agent = client.beta.agents.create(
name="support-agent",
model="claude-sonnet-4-6",
instructions="""You are a customer support agent with persistent memory.
At the start of each conversation:
1. Use recall() to search for the customer's past interactions
2. Use context_for() to get relevant procedures
After resolving issues:
1. Use remember() to save the conversation
2. Use procedure_feedback() to report success/failure""",
mcp_servers=[
{
"type": "url",
"name": "mengram",
"url": "https://mengram.io/mcp"
}
],
tools=[
{
"type": "agent_toolset_20260401",
"default_config": {
"enabled": True,
"permission_policy": {"type": "always_allow"}
}
},
{
"type": "mcp_toolset",
"mcp_server_name": "mengram",
"default_config": {
"enabled": True,
"permission_policy": {"type": "always_allow"}
}
}
]
)
# Store Mengram API key in a vault
vault = client.beta.vaults.create(display_name="Customer")
client.beta.vaults.credentials.create(
vault_id=vault.id,
display_name="Mengram Memory",
auth={
"type": "static_bearer",
"mcp_server_url": "https://mengram.io/mcp",
"token": "om-your-mengram-api-key",
},
)
# Create environment and session
env = client.beta.environments.create(display_name="Support")
session = client.beta.sessions.create(
agent=agent.id,
vault_ids=[vault.id],
environment_id=env.id,
)
# Send a message — agent recalls past context automatically
client.beta.sessions.events.send(
session_id=session.id,
events=[{
"type": "user.message",
"content": [{"type": "text", "text": "I'm having trouble with my deployment again"}]
}]
)
# Stream the response
with client.beta.sessions.events.stream(session_id=session.id) as stream:
for event in stream:
if event.type == "agent.message":
for block in event.content:
if hasattr(block, "text"):
print(block.text)
if event.type == "agent.turn_complete":
break
Mengram vs Memory Stores
Managed Agents include built-in Memory Stores (research preview). Here’s how they compare:
| Feature | Mengram | Memory Stores |
|---|
| Memory types | 3 (semantic + episodic + procedural) | 1 (text documents) |
| Auto-extraction | Yes — pass conversations, get structured knowledge | No — manual text only |
| Procedural learning | Yes — workflows evolve from failures | No |
| Cognitive Profile | Yes — one-call system prompt generation | No |
| Knowledge graph | Yes | No |
| Semantic search | Yes | Yes |
| Multi-user isolation | Yes (user_id parameter) | Per-agent only |
| Works beyond Anthropic | Yes (any LLM, any framework) | Managed Agents only |
| Status | Production | Research preview |
Self-hosted
If you’re self-hosting Mengram, point the MCP URL to your instance:
{
"type": "url",
"name": "mengram",
"url": "http://your-host:8420/mcp"
}
See Self-hosting guide for setup instructions.
Next steps