Quick Start (5 minutes)

1. Get Your API Key

Sign up and grab your API key. 7-day free trial, no credit card required.

Start Free Trial →

2. Install the SDK

# TypeScript/JavaScript
npm install @agentmemo/client

# Python
pip install agentmemo

3. Save Your First State

// 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"

Core Concepts

Persistent State

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

Workflows (The Win)

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

Cost Optimization

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?"
}

API Reference

14 endpoints for agent infrastructure.

POST /api/state

Save persistent state

{
  "component": "email_processor",
  "key": "last_processed_id",
  "value": { "id": "msg_123" }
}
GET /api/state

Load persistent state

GET /api/state?component=email_processor&key=last_processed_id
GET /api/observe

Analyze patterns, detect optimization opportunities

GET /api/observe?agent_id=my-agent&days=30

See full API documentation for all endpoints.

Framework Integrations

CrewAI

from agentmemo_crewai import AgentMemoMemory

agent = Agent(
    role="Email Processor",
    memory=AgentMemoMemory(
        api_key="your-key",
        component="email_agent"
    )
)

LangGraph

import { AgentMemoCheckpoint } from '@agentmemo/langgraph'

const graph = new StateGraph({
  checkpointer: new AgentMemoCheckpoint({
    apiKey: process.env.AGENTMEMO_API_KEY
  })
})

Common Patterns

Email Processor

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 }
  })
}

Multi-Agent Coordination

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)

Ready to Start?

7-day free trial. No credit card required.

Start Free Trial →