Repository navigation
Conversation
…SDK) A task-augmented run_agent returns a task id at once; tasks/get reports the latest episode or step, tasks/result the usual result and tasks/cancel stops the run through the existing cancellation path. Plain calls are unchanged; decide and list_agents refuse task calls with -32601. Closes #102
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Required human contributor answers
Per the repo owner's (Danyang, @Birfy) standing instruction, these are filled from the issue (#102) instead of waiting for separate human answers.
What outcome are you trying to achieve?
Answer: A host can start a long
run_agentwithout holding onetools/callrequest open for the whole browser budget, then poll and cancel it ([MCP] Adopt MCP Tasks so long run_agent can outlive the host session #102).What is the highest-leverage variable for that outcome?
Answer: Whether
s1a-mcpcan answer a task-augmentedtools/callwhile staying onmcp<2([Deps] Bound mcp below 2 and record what blocks the move to the 2026-07-28 SDK #74).How will this work move that variable rather than create busywork?
Answer: It does the spike from scope item 1 and lands the path the 1.x SDK supports, with contract tests for the task path, the plain path and cancel, and docs that say what is and is not verified.
Who is the customer or user, and what do they actually need?
Answer: People calling S1A agents from MCP hosts (Claude Code, Codex) whose tool timeouts are shorter than a browser run.
After answering the four questions: is a PR needed at all to achieve this outcome?
Human decision and rationale (or explicit source reference): Yes; #102 scopes this as one opt-in PR.
For a bug fix: link actual observed failure evidence.
Evidence: Not a bug fix: a new opt-in call mode.
Why
run_agentcan take minutes (Allrecipes budgets 300 s), and today a host must keep the request open the whole time. Closes #102.How
Spike result (scope item 1): the installed
mcp1.30.0 implements tasks as the 2025-11-25 experimental API (SEP-1686:capabilities.tasks,params.task,tasks/get|result|list|cancel). It does not implement the 2026-07-28 extension form, and it marks the experimental API deprecated ("tasks (SEP-1686) were removed from the MCP specification and are expected to return as a separate MCP extension"). So tasks can land on 1.x, but only in the 2025-11-25 shape; a host that speaks only the extension form will keep the plain call. The mcp 2 move from #74 is not needed for this, and it would not give the extension form either.Start with
s1a/mcp_server.py, thenTestRunAgentAsTaskintests/test_mcp_server.py._TaskServer(FastMCP)marksrun_agentexecution.taskSupport: "optional"intools/list. Atools/callwithouttasktakes FastMCP's unchanged path. Withtask, it callsrun_task, returns aCreateTaskResultat once, and runs the same FastMCP tool call in the session's task group.episode N/M,step N/M) become the task'sstatusMessageviaupdate_status(rate-bounded like progress notifications; the limiter is now shared as_rate_bounded).tasks/cancelwraps the SDK's handler (session scope and terminal-state checks) and then cancels the run'sanyio.CancelScope, which is the same cancellationnotifications/cancelledtriggers today, so the slot is freed, the browser closed and the cancellation recorded ([MCP] Keep long run_agent calls inside host tool timeouts: progress, bounded lock wait, cancellation, documented settings #83)._TaskStore(InMemoryTaskStore)keeps a cancelled task cancelled: the SDK otherwise raises "Cannot transition from terminal status" when the unwinding run completes.ttlis raised to at least 1 h, because the in-memory store counts it from creation and the client default (60 s) would drop a run part-way.isErrorresult (as they are the plain call's result). A task call ofdecideorlist_agentsis a-32601protocol error.What
s1a-mcpadvertises thetaskscapability;run_agentis task-optional. No change for clients that send notask.docs/skills.md§ Long runs as MCP tasks (what is and is not verified),docs/architecture.md§ MCP SDK 2.x (the port must move or drop this path), CHANGELOG.Verification
uv run ruff format --check . && uv run ruff check . && uv run ty check(all pass)uv run pytest -q: 1356 passed, 123 skipped;scripts/smoke.sh:smoke: okCHANGELOG.mdand the docs say what the code does nowNew tests (in-memory client using the SDK's
session.experimentaltask calls): capability andtaskSupportadvertisement; task returns at once,workingwithepisode 1/2, holds the run slot, thencompletedwith the summary; a real counter run as a task returns the same summary and job folder; bad flags and busy refusal end asisErrorresults;tasks/canceltears the browser and session down, frees the slot, leaves the taskcancelled; task call ofdecideis-32601.Demo / evidence
main113ef26; no System1-Omni involved.