API Reference
Memory API
Complete API reference for managing agent memory stores - semantic, episodic, procedural, and decision graphs.
Semantic Memory
Vector-based knowledge storage for semantic search and retrieval.
Store Embedding
POST /api/v1/memory/semantic
# Request
curl -X POST https://api.engrami.com/api/v1/memory/semantic?tenant_id=tenant_xyz \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"content": "The company was founded in 2020 in San Francisco.",
"metadata": {
"source": "company_wiki",
"category": "history"
},
"namespace": "knowledge_base"
}'
# Response
{
"id": "mem_vec_123",
"agent_id": "agent_abc123",
"content_hash": "abc123def456",
"embedding_model": "text-embedding-3-small",
"dimensions": 1536,
"namespace": "knowledge_base",
"created_at": "2024-01-20T10:30:00Z"
}Semantic Search
POST /api/v1/memory/semantic/search
# Request
curl -X POST https://api.engrami.com/api/v1/memory/semantic/search \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"query": "When was the company founded?",
"top_k": 5,
"namespace": "knowledge_base",
"threshold": 0.7
}'
# Response
{
"results": [
{
"id": "mem_vec_123",
"content": "The company was founded in 2020 in San Francisco.",
"score": 0.92,
"metadata": {
"source": "company_wiki",
"category": "history"
}
}
],
"query_embedding_time_ms": 45,
"search_time_ms": 12
}Episodic Memory
Conversation history and event-based memory storage.
Store Episode
POST /api/v1/memory/episodic
# Request
curl -X POST https://api.engrami.com/api/v1/memory/episodic?tenant_id=tenant_xyz \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"conversation_id": "conv_xyz789",
"messages": [
{ "role": "user", "content": "How do I reset my password?" },
{ "role": "assistant", "content": "Click on Forgot Password..." }
],
"metadata": {
"user_id": "user_123",
"platform": "web",
"resolved": true
}
}'
# Response
{
"id": "mem_ep_456",
"conversation_id": "conv_xyz789",
"message_count": 2,
"created_at": "2024-01-20T10:35:00Z"
}Get Conversation History
GET /api/v1/memory/episodic/{conversation_id}
# Request
curl https://api.engrami.com/api/v1/memory/episodic/conv_xyz789 \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"conversation_id": "conv_xyz789",
"agent_id": "agent_abc123",
"messages": [
{ "role": "user", "content": "How do I reset my password?", "timestamp": "..." },
{ "role": "assistant", "content": "Click on Forgot Password...", "timestamp": "..." }
],
"metadata": {
"user_id": "user_123",
"resolved": true
},
"created_at": "2024-01-20T10:35:00Z"
}Procedural Memory
Graph-based storage for learned patterns and skills.
Store Procedure
POST /api/v1/memory/procedural
# Request
curl -X POST https://api.engrami.com/api/v1/memory/procedural?tenant_id=tenant_xyz \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"name": "password_reset_procedure",
"steps": [
{ "action": "verify_email", "params": ["user_email"] },
{ "action": "send_reset_link", "params": ["user_email", "reset_token"] },
{ "action": "log_event", "params": ["password_reset_initiated"] }
],
"trigger_conditions": ["user requests password reset"],
"success_criteria": "User receives reset email"
}'
# Response
{
"id": "mem_proc_789",
"name": "password_reset_procedure",
"step_count": 3,
"created_at": "2024-01-20T10:40:00Z"
}Query Procedures
GET /api/v1/memory/procedural
# Request
curl https://api.engrami.com/api/v1/memory/procedural?agent_id=agent_abc123&trigger=password \
-H "Authorization: Bearer YOUR_TOKEN"
# Response
{
"procedures": [
{
"id": "mem_proc_789",
"name": "password_reset_procedure",
"trigger_conditions": ["user requests password reset"],
"relevance_score": 0.95
}
]
}Decision Graphs
Structured decision trees for complex reasoning.
Create Decision Graph
POST /api/v1/memory/decision-graphs
# Request
curl -X POST https://api.engrami.com/api/v1/memory/decision-graphs?tenant_id=tenant_xyz \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"name": "Escalation Decision Tree",
"nodes": [
{ "id": "start", "type": "start", "next": "check_priority" },
{ "id": "check_priority", "type": "condition", "condition": "priority >= high" },
{ "id": "escalate", "type": "action", "action": "escalate_to_human" },
{ "id": "auto_resolve", "type": "action", "action": "attempt_auto_resolution" }
],
"edges": [
{ "from": "check_priority", "to": "escalate", "condition": "true" },
{ "from": "check_priority", "to": "auto_resolve", "condition": "false" }
]
}'
# Response
{
"id": "graph_abc123",
"name": "Escalation Decision Tree",
"node_count": 4,
"created_at": "2024-01-20T10:45:00Z"
}Execute Decision Graph
POST /api/v1/memory/decision-graphs/{graph_id}/execute
# Request
curl -X POST https://api.engrami.com/api/v1/memory/decision-graphs/graph_abc123/execute \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"context": {
"priority": "high",
"ticket_id": "ticket_123"
}
}'
# Response
{
"execution_id": "exec_graph_456",
"path": ["start", "check_priority", "escalate"],
"result": {
"action": "escalate_to_human",
"recommendation": "High priority ticket should be escalated"
},
"execution_time_ms": 25
}Memory Consolidation
Merge and optimize memory across stores.
POST /api/v1/memory/consolidate
# Request
curl -X POST https://api.engrami.com/api/v1/memory/consolidate \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agent_id": "agent_abc123",
"source_types": ["episodic"],
"target_type": "semantic",
"strategy": "summarize",
"threshold": {
"min_conversations": 10,
"max_age_days": 30
}
}'
# Response
{
"consolidation_id": "cons_789",
"status": "completed",
"episodes_processed": 156,
"memories_created": 23,
"storage_saved_mb": 12.5
}