Last updated

Agent Cookbook

This guide is optimized for AI coding agents and developers who want deterministic integration steps.

Prerequisites

  • Papr API key in your runtime environment
  • A stable external_user_id from your application identity layer
  • Access to the API endpoints used in your chosen path

Minimal Setup

  1. Choose one integration path from Rule 1.
  2. Implement write and search calls with current fields only.
  3. Validate with the baseline search settings before tuning.

Rule 1: Pick One Path

  • If input is chat transcripts -> use Messages path.
  • If input is files/docs -> use Document path.
  • If input is rows/events/APIs -> use Structured Data path.
  • If input is agent outcomes/workflows -> use Agent Memory path.

Do not mix all paths at the start. Implement one, verify, then expand.

Rule 2: Use Current Fields

Use:

  • memory_policy
  • external_user_id
  • enable_agentic_graph

Avoid deprecated fields:

  • graph_generation
  • user_id
  • rank_results

Deterministic Recipes

Recipe A: Chat Agent with Long-Term Memory

  1. Store message (POST /v1/messages)
  2. Fetch compressed context (GET /messages/sessions/{session_id}/compress)
  3. Search memory (POST /v1/memory/search with enable_agentic_graph=true)
  4. Generate model response

Recipe B: Structured CRM Agent

  1. Ingest entities in manual mode (POST /v1/memory with memory_policy.mode=manual)
  2. Query related context (POST /v1/memory/search)
  3. Run analytics (POST /v1/graphql)

Recipe C: Document Support Agent

  1. Upload documents (POST /v1/document)
  2. Poll status (GET /v1/document/status/{upload_id})
  3. Search with graph-aware retrieval (POST /v1/memory/search)
{
  "enable_agentic_graph": true,
  "max_memories": 20,
  "max_nodes": 15
}

Use response_format=toon when passing search output directly to an LLM.

Validation Checklist

  • Requests use external_user_id and memory_policy
  • Retrieval uses enable_agentic_graph=true
  • One deterministic path is working end to end

Troubleshooting

Use the Error Playbook for common auth, validation, and retrieval issues.