Get started with AgentMemo in 5 minutes. Persistent state, workflows, and cost optimization for AI agents.
Sign up and grab your API key. 7-day free trial, no credit card required.
Start Free Trial →# TypeScript/JavaScript
npm install @agentmemo/client
# Python
pip install agentmemo
// TypeScript/JavaScript
import { AgentMemo } from '@agentmemo/client'
const client = new AgentMemo({
apiKey: 'ap_prod_your_key_here'
})
// Save state (survives agent restarts)
await client.saveState({
component: "email_processor",
key: "last_processed_id",
value: { id: "msg_123", timestamp: Date.now() }
})
// Load state later
const state = await client.getState("email_processor", "last_processed_id")
console.log(state.data.value.id) // → "msg_123"
Agents lose context when they restart. AgentMemo persists state across sessions.
// Session 1
await client.saveState({
component: "my_agent",
key: "progress",
value: { step: 5, processed: 127 }
})
// Agent restarts...
// Session 2 - pick up where you left off
const state = await client.getState("my_agent", "progress")
console.log(state.data.value.step) // → 5
Document workflows once with expensive models (Opus), then execute forever with cheap models (Haiku).
// Design workflow with Opus ($15/M tokens)
// Document every step, decision, edge case
// Execute with Haiku ($0.25/M tokens)
// 60x cost reduction, same output
After 10+ successful executions, AgentMemo detects when you can downgrade models.
const analysis = await client.observe({ days: 30 })
if (analysis.downgrade_opportunities.count > 0) {
const opp = analysis.downgrade_opportunities.opportunities[0]
console.log(opp.agent_pitch)
// → "I've executed 'process_email' 150 times with 95% success.
// Switching from opus to haiku saves $47/month.
// Should I make this change?"
}
14 endpoints for agent infrastructure.
/api/state
Save persistent state
{
"component": "email_processor",
"key": "last_processed_id",
"value": { "id": "msg_123" }
}
/api/state
Load persistent state
GET /api/state?component=email_processor&key=last_processed_id
/api/observe
Analyze patterns, detect optimization opportunities
GET /api/observe?agent_id=my-agent&days=30
See full API documentation for all endpoints.
from agentmemo_crewai import AgentMemoMemory
agent = Agent(
role="Email Processor",
memory=AgentMemoMemory(
api_key="your-key",
component="email_agent"
)
)
import { AgentMemoCheckpoint } from '@agentmemo/langgraph'
const graph = new StateGraph({
checkpointer: new AgentMemoCheckpoint({
apiKey: process.env.AGENTMEMO_API_KEY
})
})
Track which emails you've already processed, even if agent restarts.
// Load last processed email ID
const state = await client.getState("email_processor", "last_id")
const lastId = state?.data?.value?.id || 0
// Process new emails
const newEmails = await getEmailsSince(lastId)
for (const email of newEmails) {
await processEmail(email)
// Update last processed ID
await client.saveState({
component: "email_processor",
key: "last_id",
value: { id: email.id }
})
}
Hand off work between agents without losing context.
// Agent A creates handoff
const handoff = await client.createHandoff({
to_agent_id: "specialist-agent",
workflow_id: "complex-task-workflow",
context: { task_id: "123", progress: "50%" },
reason: "Requires specialist knowledge"
})
// Agent B accepts and continues
await client.acceptHandoff(handoff.id)