メモリAPIリファレンス
認証
すべてのエンドポイントには以下のヘッダーが必要です:
x-api-key: <your-api-key>
x-api-secret: <your-api-secret>
Content-Type: application/json
エンドポイント
エージェントメモリ設定を取得
GET /agents/{agent_id}/memory-settings
エージェントの現在のメモリ設定を返します。
レスポンス例:
{
"memory_enabled": true,
"max_memories": 50,
"auto_approve": false,
"memory_types": ["preference", "fact", "context"]
}
エージェントメモリ設定を更新
PUT /agents/{agent_id}/memory-settings
エージェントのメモリ設定を有効化、無効化、または更新します。
リクエストボディ:
{
"memory_enabled": true,
"max_memories": 50,
"auto_approve": false,
"memory_types": ["preference", "fact", "context"]
}
レスポンス例:
{
"success": true,
"message": "Memory settings updated successfully",
"settings": {
"memory_enabled": true,
"max_memories": 50,
"auto_approve": false,
"memory_types": ["preference", "fact", "context"]
}
}
エージェントの承認済みメモリを取得
GET /agents/{agent_id}/memories
ユーザー別にグループ化された、エージェントのすべての承認済みメモリを返します。
レスポンス例:
{
"memories_by_user": {
"user_123": [
{
"id": "memory_abc",
"agent_id": "agent_123",
"user_id": "user_123",
"memory_content": "User prefers concise technical answers.",
"memory_type": "preference",
"confidence_score": 0.92,
"status": "approved",
"created_at": 1710000000,
"updated_at": 1710000100,
"approved_at": 1710000100,
"source_message_id": "msg_123"
}
]
},
"total_users": 1,
"total_memories": 1
}
特定ユーザーの承認済みメモリを取得
GET /agents/{agent_id}/memories/user/{user_id}
1人のユーザーと1つのエージェントの承認済みメモリレコードを返します。
レスポンス例:
[
{
"id": "memory_abc",
"agent_id": "agent_123",
"user_id": "user_123",
"memory_content": "User prefers concise technical answers.",
"memory_type": "preference",
"confidence_score": 0.92,
"status": "approved",
"created_at": 1710000000,
"updated_at": 1710000100,
"approved_at": 1710000100,
"source_message_id": "msg_123"
}
]
保留中のメモリ承認を取得
GET /memory-approvals/pending
認証済みユーザーの保留中のメモリ承認を返します。オプションで?agent_id={agent_id}を使用してエージェントでフィルタできます。
レスポンス例:
[
{
"id": "memory_abc",
"agent_id": "agent_123",
"user_id": "user_123",
"memory_content": "User prefers concise technical answers.",
"memory_type": "preference",
"confidence_score": 0.92,
"source_message": "Please keep answers short and technical.",
"created_at": 1710000000,
"expires_at": 1710604800
}
]
メモリを承認または却下
POST /memory-approvals/{memory_id}/action
保留中のメモリレコードを承認または却下します。
リクエストボディ:
{
"action": "approve"
}
レスポンス例:
{
"success": true,
"message": "Memory approved successfully",
"memory_id": "memory_abc"
}
メモリを削除
DELETE /memories/{memory_id}
メモリレコードを却下としてマークして削除します。
レスポンス例:
{
"success": true,
"message": "Memory deleted successfully",
"memory_id": "memory_abc"
}