[MCP] Adopt MCP Tasks so long run_agent can outlive the host session

未關閉
#102 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
48/100
Issue 類型
功能
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
python

研究方向

Start by reading #74 and #83, then inspect the MCP server and existing run_agent tests to find the pinned MCP version, capability handling, and cancellation path. First determine whether MCP Tasks are possible on MCP 1.x; if not, record the blocker. Done means task-capable clients get task status and cancellation for run_agent, other clients retain synchronous behavior, contract tests cover both paths, and docs/skills.md documents verified host settings.

由索引模型根據 Issue 內容生成。

描述

Why

#83 (merged) keeps a long run_agent inside the current host request: progress notifications, a bounded lock wait, cancellation, and documented host timeout settings. That still assumes the tool call is one open request the host waits on.

In late October 2026 hosts moved past that model. Claude Code v2.1.304+ (public beta, protocol revision 2026-07-28) can turn a long MCP tool into a server-side task: the tools/call returns as soon as the server accepts the job, the job keeps running on the server, and the client polls status (including across /resume). Coverage and the six host-side config decisions: MCP tasks landed in Claude Code (2026-10-26). Related industry notes on progress resetting client timeouts (still useful alongside tasks): MCP “Request timed out” (-32001) on long tools (tested 2026-10-09).

run_agent is exactly the long call (Allrecipes budgets 300 s; the README chat-model Allrecipes run was 138.7 s). Today s1a-mcp is pinned to mcp>=1.26,<2 because openjiuwen / fastmcp still need mcp 1.x (#74). MCP Tasks need the 2026-07-28 revision and a server that answers with a task when the client declares io.modelcontextprotocol/tasks.

Proposed scope (one PR, opt-in)

  1. Spike whether Tasks can land while staying on mcp 1.x, or whether the mcp 2 / fastmcp 4 move from #74 is a hard prerequisite; record the blocker in the issue if so.
  2. If feasible: make run_agent (and only that tool) return an MCP task when the client advertises task support; keep today's synchronous path when it does not.
  3. Progress / status updates on the task; cancel maps to the existing cancellation path from #83.
  4. Document Claude Code / Codex settings for Tasks vs plain tool timeouts in docs/skills.md (link the host docs; do not invent host flags).
  5. Contract tests with a fake client capability blob: task path vs sync path; no live browser required.

Acceptance criteria

  • With a client that does not advertise tasks, behaviour matches today (existing MCP tests pass).
  • With a client that does, run_agent accepts and reports a task id / status without holding the original request open for the full browser budget.
  • Cancel stops the agent within the same bounds as #83.
  • Skills / README name which hosts were verified and which still need a raised tool_timeout only.

Out of scope

  • Reworking decide / list_agents into tasks.
  • Lifting the mcp pin for its own sake (only if Tasks require it; otherwise leave #74's follow-up alone).
  • Guaranteeing every host (Codex, Cursor, Claude desktop) supports Tasks — document what does.

References

主要語言
Python
星號
120
分支
21
平均合併
17 小時 13 分鐘
30 天內合併 PR
7

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ThinkFlowLab/system1-agents 的其他 Issue

查看 ThinkFlowLab/system1-agents 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。