Last updated

Quickstart: Agent Memory

Store and retrieve agent learnings so behavior improves over time.

What You Will Build

  • Persist assistant-generated memory
  • Retrieve prior learnings before new actions
  • Keep safety and access controls explicit

Prerequisites

  • PAPR_MEMORY_API_KEY configured in your environment
  • A stable agent runtime identity for external_user_id

Minimal Setup

  1. Write one assistant learning entry.
  2. Search for that learning before the next action.
  3. Submit feedback to reinforce retrieval quality.

1) Store Agent Learning

curl -X POST https://memory.papr.ai/v1/memory \
  -H "X-API-Key: $PAPR_MEMORY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Type: curl" \
  -d '{
    "content": "When refund request is older than 30 days, escalate to manager with purchase metadata attached.",
    "external_user_id": "agent_runtime_001",
    "metadata": {
      "role": "assistant",
      "category": "learning",
      "topics": ["refunds", "escalation"]
    },
    "memory_policy": {
      "mode": "auto",
      "consent": "terms",
      "risk": "none"
    }
  }'

2) Retrieve Learning Before Action

curl -X POST "https://memory.papr.ai/v1/memory/search?response_format=toon&max_memories=20&max_nodes=15" \
  -H "X-API-Key: $PAPR_MEMORY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Type: curl" \
  -d '{
    "query": "What refund handling rules has the assistant learned?",
    "external_user_id": "agent_runtime_001",
    "enable_agentic_graph": true
  }'

3) Feed Quality Signal

curl -X POST https://memory.papr.ai/v1/feedback \
  -H "X-API-Key: $PAPR_MEMORY_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Client-Type: curl" \
  -d '{
    "search_id": "search_123",
    "feedbackData": {
      "feedbackType": "thumbs_up",
      "feedbackSource": "inline",
      "feedbackText": "Retrieved the correct escalation policy."
    }
  }'

Validation Checklist

  • Agent learning is persisted successfully.
  • Retrieval query returns prior learned policy.
  • Feedback call succeeds with the returned search_id.

Troubleshooting

If retrieval misses known learnings, confirm external_user_id consistency and check Search Tuning.

Next Steps