1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Cursor Agent Bridge Profile — Python SDK 版本
#
# 功能:
# · 通过 Python SDK 调用 Cursor Agent CLI(agent 命令)
# · 支持多轮对话(--resume),session 在 Hub 侧自动持久化
#
# 前提条件:
# 1. Python 3.10+
# 2. Cursor Agent CLI 已安装并在 PATH 中(安装见 https://cursor.com/docs/cli/overview)
# agent --version # 验证
# 3. 已认证:agent login 或 export CURSOR_API_KEY=key-...
# 4. 安装 Python 依赖:pip install -r requirements.txt
# (推荐使用虚拟环境:python3 -m venv .venv && source .venv/bin/activate)
#
# 本地测试(不启动 bridge):
# ILINK_MESSAGE="你好" ILINK_SESSION_ID="" python3 handler.py
#
# 启动 bridge:
# ilink-hub-bridge --config profiles.yaml
#
profiles:
cursor:
script: ./handler.py # bridge 自动用 python3 运行
cwd: /path/to/your/project # ← 改为你的项目目录(agent 会在此目录下运行)
timeout_secs: 1800
max_reply_chars: 8000
cli_session_first_line_prefix: "ILINK_SESSION:" # 必须,否则 session id 会出现在正文里
env:
CURSOR_MODEL: claude-4.6-sonnet-medium # 可选:指定模型,不设则使用默认(composer-2.5-fast)
# 如使用虚拟环境,需指定解释器路径:
# command: ./.venv/bin/python3
# args: ["./handler.py"]
routing:
strategy: fixed
default_profile: cursor
skip_bot_messages: true
require_text: true
send_error_reply: true