Skip to content

HTTP API 概览

Recursive 内置基于 axum 的 HTTP 服务器(recursive http),提供带会话和 SSE 流式输出的 REST API。

启动服务器

bash
recursive http --addr 127.0.0.1:3000

接口汇总

方法路径说明
GET/health健康检查
GET/tools列出已注册工具
POST/run无状态单次运行
POST/sessions创建会话
GET/sessions列出会话
GET/sessions/:id获取会话详情
DELETE/sessions/:id删除会话
POST/sessions/:id/run发送消息(SSE 流式)
GET/openapi.jsonOpenAPI 3.0 规范

快速开始

bash
# 启动服务
recursive http &

# 健康检查
curl http://localhost:3000/health

# 创建会话
SESSION=$(curl -sX POST http://localhost:3000/sessions \
  -H 'Content-Type: application/json' \
  -d '{"system_prompt":"你是一个有用的 Rust 助手。"}' \
  | jq -r .session_id)

# 运行(流式)
curl -N -X POST http://localhost:3000/sessions/$SESSION/run \
  -H 'Content-Type: application/json' \
  -d '{"message":"列出 /workspace 中的文件"}'

Released under the MIT License.