← 返回文档中心

REST API

REST Agent 接口

适合自研 Agent 和脚本。推荐默认 权限:读取 + 写入。普通 Agent 不建议授予 人工审核批准权限。

REST 接入依赖 Agent 自觉执行流程。如果要更稳定地强制记忆,优先使用 Gateway 路线;支持标准工具的客户端可用 MCP 路线

标准流程

  1. GET /api/agent/projects
  2. POST /api/agent/session/start
  3. GET /api/agent/projects/{project_id}/context
  4. POST /api/agent/session/message (user + assistant)
  5. POST /api/agent/session/checkpoint
  6. POST /api/agent/memory/search
  7. GET /api/agent/health/me
  8. POST /api/agent/session/close
事实裁决:搜索结果标记为“当前事实”时优先引用;标记为“历史事实”时只代表过去,不要当成当前结论。
打开提示词库复制 REST 提示词

认证

Authorization: Bearer <OMEMAI_API_KEY>

项目列表

GET /api/agent/projects

开始会话

POST /api/agent/session/start
{"project_id":"...","resume":true}

加载上下文

GET /api/agent/projects/{project_id}/context

保存消息

POST /api/agent/session/message
{"project_id":"...","session_id":"...","role":"user","content":"..."}

记忆检查点

POST /api/agent/session/checkpoint
{"project_id":"...","session_id":"..."}

搜索记忆

POST /api/agent/memory/search
{"project_id":"...","query":"关键事实","scope":"current_project","limit":10}

接入健康

GET /api/agent/health/me