Persistent Memory

Financial context that survives agent rebuilds, retraining, and version updates.

GET /v1/memory/{agent_id}

Retrieve the complete memory profile for an agent.

Response

{
  "agent_id": "agent_123",
  "memory": {
    "vendor_history": {
      "openai.com": {
        "total_spent": 12500.00,
        "avg_transaction": 45.00,
        "transaction_count": 278,
        "last_transaction": "2026-03-20",
        "learned_preferences": {
          "preferred_model": "gpt-4o-mini",
          "batch_size": 1000
        }
      }
    },
    "spending_patterns": {
      "daily_average": 125.00,
      "peak_days": ["monday", "tuesday"],
      "monthly_trend": "increasing"
    }
  },
  "version": 3,
  "created_at": "2025-06-15T00:00:00Z",
  "updated_at": "2026-03-20T14:30:00Z"
}

GET /v1/memory/{agent_id}/vendors

Get vendor-specific history and learned preferences.

GET /v1/memory/agent_123/vendors?vendor=openai.com

{
  "vendor": "openai.com",
  "total_spent": 12500.00,
  "transaction_count": 278,
  "avg_transaction": 45.00,
  "first_transaction": "2025-06-20",
  "last_transaction": "2026-03-20",
  "learned_preferences": {
    "preferred_model": "gpt-4o-mini",
    "batch_size": 1000,
    "optimal_time_of_day": "morning"
  },
  "issues": []
}

GET /v1/memory/{agent_id}/patterns

Analyze spending patterns and trends.

{
  "daily_average": 125.00,
  "weekly_average": 875.00,
  "monthly_average": 3750.00,
  "peak_days": ["monday", "tuesday"],
  "peak_hours": [9, 10, 14, 15],
  "trend": {
    "direction": "increasing",
    "rate": 0.05,
    "confidence": 0.92
  },
  "anomalies": []
}

Memory Persistence

Memory is stored externally and persists across:

  • Agent rebuilds
  • Model retraining
  • Version updates
  • Platform migrations

Pro tip: Use memory queries to inform agent decisions. For example, check vendor history before negotiating rates or choosing service tiers.